Initial rewrite
This commit is contained in:
parent
3fd137aad3
commit
f161e02f36
29 changed files with 204 additions and 103 deletions
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.8 MiB |
Before Width: | Height: | Size: 4.8 MiB After Width: | Height: | Size: 4.8 MiB |
217
flake.nix
217
flake.nix
|
@ -2,125 +2,150 @@
|
|||
description = "System config";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
util = import ./lib {
|
||||
inherit system pkgs home-manager lib;
|
||||
overlays = (pkgs.overlays);
|
||||
};
|
||||
defSystem = systemArch: baseConfig:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
system = "${systemArch}";
|
||||
modules = [
|
||||
{ _module.args.inputs = inputs; }
|
||||
{ _module.args.self-overlay = self.overlay; }
|
||||
{ _module.args.overlay-unstable = self.overlay-unstable; }
|
||||
({ ... }: {
|
||||
imports = builtins.attrValues self.nixosModules ++ [
|
||||
{
|
||||
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
||||
nixpkgs.overlays = [ self.overlay self.overlay-unstable ];
|
||||
}
|
||||
|
||||
inherit (util) user;
|
||||
inherit (util) host;
|
||||
baseConfig
|
||||
home-manager.nixosModules.home-manager
|
||||
{ home-manager.useUserPackages = true; }
|
||||
];
|
||||
|
||||
inherit (import ./pkgs {
|
||||
inherit pkgs;
|
||||
}) myPkgs;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = [ ];
|
||||
};
|
||||
|
||||
system = "x86_64-linux";
|
||||
|
||||
vm1BiosConfig = {
|
||||
boot = {
|
||||
type = "bios";
|
||||
qemu = true;
|
||||
grubInstallDevice = "/dev/vda";
|
||||
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
})
|
||||
];
|
||||
};
|
||||
core.enable = true;
|
||||
};
|
||||
|
||||
vm1UefiConfig = {
|
||||
boot = {
|
||||
type = "uefi";
|
||||
qemu = true;
|
||||
};
|
||||
core.enable = true;
|
||||
};
|
||||
|
||||
vm2Config = {
|
||||
boot = {
|
||||
type = "uefi";
|
||||
qemu = true;
|
||||
};
|
||||
core.enable = true;
|
||||
};
|
||||
|
||||
nixosUsers = [{
|
||||
name = "erwin";
|
||||
groups = [ "wheel" "networkmanager" "video" ];
|
||||
uid = 1000;
|
||||
shell = pkgs.fish;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNoTcRsAxDwpiIj6nhUXwzSQjtcgKCR0RDlzP57wi0W erwin@horusvr-ws2"
|
||||
];
|
||||
}];
|
||||
# nixosUsers = [{
|
||||
# name = "erwin";
|
||||
# groups = [ "wheel" "networkmanager" "video" ];
|
||||
# uid = 1000;
|
||||
# shell = pkgs.fish;
|
||||
# openssh.authorizedKeys.keys = [
|
||||
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNoTcRsAxDwpiIj6nhUXwzSQjtcgKCR0RDlzP57wi0W erwin@horusvr-ws2"
|
||||
# ];
|
||||
# }];
|
||||
|
||||
in
|
||||
{
|
||||
homeManagerConfigurations = {
|
||||
erwin = user.mkHMUser {
|
||||
userConfig = {
|
||||
git.enable = true;
|
||||
ssh.enable = true;
|
||||
applications.enable = true;
|
||||
gpg.enable = true;
|
||||
fish.enable = true;
|
||||
sway.enable = true;
|
||||
};
|
||||
username = "erwin";
|
||||
# homeManagerConfigurations = {
|
||||
# erwin = user.mkHMUser {
|
||||
# userConfig = {
|
||||
# git.enable = true;
|
||||
# ssh.enable = true;
|
||||
# applications.enable = true;
|
||||
# gpg.enable = true;
|
||||
# fish.enable = true;
|
||||
# sway.enable = true;
|
||||
# };
|
||||
# username = "erwin";
|
||||
# };
|
||||
# };
|
||||
|
||||
overlay = final: prev: (import ./overlays) final prev;
|
||||
overlay-unstable = final: prev: {
|
||||
unstable = import nixpkgs-unstable {
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixosModules = builtins.listToAttrs (map
|
||||
(x: {
|
||||
name = x;
|
||||
value = import (./modules + "/${x}");
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = {
|
||||
vm1 = host.mkHost {
|
||||
name = "vm1";
|
||||
NICs = [ "enp1s0" ];
|
||||
kernelPackage = pkgs.linuxPackages;
|
||||
initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
|
||||
kernelMods = [ "kvm-amd" ];
|
||||
kernelParams = [ ];
|
||||
systemConfig = vm1UefiConfig;
|
||||
|
||||
users = nixosUsers;
|
||||
|
||||
cpuCores = 6;
|
||||
};
|
||||
|
||||
vm2 = host.mkHost {
|
||||
name = "vm2";
|
||||
NICs = [ "enp1s0" ];
|
||||
kernelPackage = pkgs.linuxPackages;
|
||||
initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
|
||||
kernelMods = [ "kvm-amd" ];
|
||||
kernelParams = [ ];
|
||||
systemConfig = vm2Config;
|
||||
|
||||
users = nixosUsers;
|
||||
|
||||
cpuCores = 4;
|
||||
};
|
||||
|
||||
# loki = host.mkHost {
|
||||
# name = "loki";
|
||||
# NICs = [ "enp4s0" ];
|
||||
# vm1 = host.mkHost {
|
||||
# name = "vm1";
|
||||
# NICs = [ "enp1s0" ];
|
||||
# kernelPackage = pkgs.linuxPackages;
|
||||
# initrdMods = [ "nvme" "xhci_pci" "ahci" ];
|
||||
# initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
|
||||
# kernelMods = [ "kvm-amd" ];
|
||||
# kernelParams = [ ];
|
||||
# systemConfig = vm1UefiConfig;
|
||||
|
||||
# users = nixosUsers;
|
||||
|
||||
# cpuCores = 6;
|
||||
# };
|
||||
|
||||
# vm2 = host.mkHost {
|
||||
# name = "vm2";
|
||||
# NICs = [ "enp1s0" ];
|
||||
# kernelPackage = pkgs.linuxPackages;
|
||||
# initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
|
||||
# kernelMods = [ "kvm-amd" ];
|
||||
# kernelParams = [ ];
|
||||
# systemConfig = vm2Config;
|
||||
|
||||
# users = nixosUsers;
|
||||
|
||||
# cpuCores = 4;
|
||||
# };
|
||||
vm2 = defSystem "x86_64-linux" {
|
||||
imports = [
|
||||
(import (./machines/vm2/configuration.nix) { inherit self; })
|
||||
];
|
||||
};
|
||||
|
||||
# loki = defSystem "x86_64-linux" {
|
||||
# imports = [
|
||||
# (import (./machines/loki/configuration.nix) { inherit self; })
|
||||
# ];
|
||||
# };
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
(flake-utils.lib.eachSystem [ "x86_64-linux" ])
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
config = {
|
||||
allowUnsupportedSystem = true;
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
rec {
|
||||
packages = flake-utils.lib.flattenTree {
|
||||
rofi-wayland = pkgs.rofi-wayland;
|
||||
};
|
||||
|
||||
apps = {
|
||||
rofi-wayland = flake-utils.lib.mkApp { drv = packages.rofi-wayland; };
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
31
machines/vm2/configuration.nix
Normal file
31
machines/vm2/configuration.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
imports = [ ./hardware-configuration.nix ../../users/erwin.nix ];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
networking = {
|
||||
hostname = "vm2";
|
||||
useDHCP = false;
|
||||
interfaces.enp1s.useDHCP = true;
|
||||
};
|
||||
|
||||
nix = {
|
||||
package = pkgs.nixUnstable;
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
};
|
||||
|
||||
services.openssh.enable = true;
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "21.05"; # Did you read the comment?
|
||||
}
|
32
machines/vm2/hardware-configuration.nix
Normal file
32
machines/vm2/hardware-configuration.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[{ device = "/dev/disk/by-label/swap"; }];
|
||||
|
||||
}
|
3
overlays/default.nix
Normal file
3
overlays/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
self: super: {
|
||||
rofi-wayland = super.pkgs.callPackage ../pkgs/rofi-wayland { };
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
with pkgs;
|
||||
{
|
||||
myPkgs = {
|
||||
rofi-wayland = callPackage ./rofi-wayland.nix { };
|
||||
};
|
||||
}
|
17
users/erwin.nix
Normal file
17
users/erwin.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
users.users.erwin = {
|
||||
isNormalUser = true;
|
||||
home = "/home/erwin";
|
||||
exdraGroups = [ "wheel" "adm" "audio" "video" ];
|
||||
shell = pkgs.fish;
|
||||
openssh.authorizedKeys.keyFiles = [
|
||||
(pkgs.fetchurl {
|
||||
url = "https://github.com/eboskma.keys";
|
||||
sha256 = "1l7f425kvfmrs4dfcvllb76182jgb14l1silyy4qmjxvinawb1yj";
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
nix.allowedUsers = [ "erwin" ];
|
||||
}
|
Loading…
Reference in a new issue