diff --git a/.gitignore b/.gitignore index 6ba9cff..adebacb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .pre-commit-config.yaml .direnv +todo* diff --git a/README.md b/README.md index 18a93b6..6c42222 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ ## Hosts - `patricknix` my main laptop - `desktopnix` my main desktop +- `testienix` old laptop for testing ## Users - `patrick` my normal everyday unprivileged user @@ -79,7 +80,9 @@ 2. Don't forget to add necesarry config for filesystems, etc. 3. Generate ISO image with `nix build --print-out-paths --no-link .#images..live-iso` - This might take multiple minutes(~10) -3. Copy ISO to usb and boot + - Alternatively boot an official nixos image connect with password +3. Copy ISO to usb using dd +3. After booting copy the installer to the live system using `nix copy --to .#packages..installer-package.` ## Deploy diff --git a/hosts.toml b/hosts.toml index 1dbe05c..603be95 100644 --- a/hosts.toml +++ b/hosts.toml @@ -5,3 +5,7 @@ system = "x86_64-linux" [desktopnix] type = "nixos" system = "x86_64-linux" + +[testienix] +type = "nixos" +system = "x86_64-linux" diff --git a/hosts/desktopnix/fs.nix b/hosts/desktopnix/fs.nix index ecab8eb..3ec9d3a 100644 --- a/hosts/desktopnix/fs.nix +++ b/hosts/desktopnix/fs.nix @@ -12,9 +12,9 @@ type = "table"; format = "gpt"; partitions = [ - (partEfiBoot "boot" "0%" "512MiB") + (partEfiBoot "boot" "0%" "1GiB") (partSwap "swap" "1GiB" "17GiB") - (partLuksZfs "rpool" "17GiB" "100%") + (partLuksZfs "rpool" "rpool" "17GiB" "100%") ]; }; }; @@ -25,7 +25,7 @@ type = "table"; format = "gpt"; partitions = [ - (partLuksZfs "infantry-fighting-vehicle" "0%" "100%") + (partLuksZfs "infantry-fighting-vehicle" "infantry-fighting-vehicle" "0%" "100%") ]; }; }; @@ -36,7 +36,7 @@ type = "table"; format = "gpt"; partitions = [ - (partLuksZfs "panzer" "0%" "100%") + (partLuksZfs "panzer" "panzer" "0%" "100%") ]; }; }; diff --git a/hosts/patricknix/fs.nix b/hosts/patricknix/fs.nix index 2ab6abe..5c9e160 100644 --- a/hosts/patricknix/fs.nix +++ b/hosts/patricknix/fs.nix @@ -14,7 +14,7 @@ partitions = [ (partEfiBoot "boot" "0%" "512MiB") #(partSwap "swap" "1GiB" "17GiB") - (partLuksZfs "rpool" "512MiB" "100%") + (partLuksZfs "rpool" "rpool" "512MiB" "100%") ]; }; }; diff --git a/hosts/testienix/default.nix b/hosts/testienix/default.nix new file mode 100644 index 0000000..3d16bf4 --- /dev/null +++ b/hosts/testienix/default.nix @@ -0,0 +1,16 @@ +{inputs, ...}: { + imports = [ + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-ssd + + # TODO: sollte entfernt werden für server + ../common/core + + ../common/hardware/intel.nix + ../common/hardware/physical.nix + ../common/hardware/zfs.nix + + ./net.nix + ./fs.nix + ]; +} diff --git a/hosts/testienix/fs.nix b/hosts/testienix/fs.nix new file mode 100644 index 0000000..a79ff2d --- /dev/null +++ b/hosts/testienix/fs.nix @@ -0,0 +1,57 @@ +{ + config, + lib, + ... +}: { + disko.devices = { + disk = { + internal-hdd = { + type = "disk"; + device = "/dev/disk/by-id/${config.secrets.secrets.local.disko.internal-hdd}"; + content = with lib.disko.gpt; { + type = "table"; + format = "gpt"; + partitions = [ + (partEfiBoot "boot" "0%" "1GiB") + (partSwap "swap" "1GiB" "17GiB") + (partLuksZfs "rpool" "rpool" "17GiB" "100%") + ]; + }; + }; + external-hdd-1 = { + type = "disk"; + device = "/dev/disk/by-id/${config.secrets.secrets.local.disko.external-hdd-1}"; + content = with lib.disko.gpt; { + type = "table"; + format = "gpt"; + partitions = [ + (partLuksZfs "panzer-1" "panzer" "0%" "100%") + ]; + }; + }; + external-hdd-2 = { + type = "disk"; + device = "/dev/disk/by-id/${config.secrets.secrets.local.disko.external-hdd-2}"; + content = with lib.disko.gpt; { + type = "table"; + format = "gpt"; + partitions = [ + (partLuksZfs "panzer-2" "panzer" "0%" "100%") + ]; + }; + }; + }; + + zpool = with lib.disko.zfs; { + rpool = defaultZpoolOptions // {datasets = defaultZfsDatasets;}; + panzer = + defaultZpoolOptions + // { + datasets = { + "save" = unmountable; + "safe/data" = filesystem "/data"; + }; + }; + }; + }; +} diff --git a/hosts/testienix/net.nix b/hosts/testienix/net.nix new file mode 100644 index 0000000..07236d8 --- /dev/null +++ b/hosts/testienix/net.nix @@ -0,0 +1,12 @@ +{config, ...}: { + networking = { + inherit (config.secrets.secrets.local.networking) hostId; + }; + systemd.network.networks = { + "01-lan1" = { + DHCP = "yes"; + matchConfig.MACAddress = config.secrets.secrets.local.networking.lan1.mac; + dns = ["192.168.178.2"]; + }; + }; +} diff --git a/hosts/testienix/secrets/secrets.nix.age b/hosts/testienix/secrets/secrets.nix.age new file mode 100644 index 0000000..bb13ae6 Binary files /dev/null and b/hosts/testienix/secrets/secrets.nix.age differ diff --git a/lib/disko.nix b/lib/disko.nix index 89baef6..ef9f76f 100644 --- a/lib/disko.nix +++ b/lib/disko.nix @@ -22,7 +22,7 @@ inputs: self: super: { randomEncryption = true; }; }; - partLuksZfs = name: start: end: { + partLuksZfs = name: pool: start: end: { inherit start end; name = "enc-${name}"; content = { @@ -31,7 +31,7 @@ inputs: self: super: { extraOpenArgs = ["--allow-discard"]; content = { type = "zfs"; - pool = name; + inherit pool; }; }; }; diff --git a/nix/installer-configuration.nix b/nix/installer-configuration.nix index 568fa4f..d7eb43e 100644 --- a/nix/installer-configuration.nix +++ b/nix/installer-configuration.nix @@ -15,6 +15,9 @@ ]; }; + # Grub broken + boot.loader.systemd-boot.enable = true; + environment = { variables.EDITOR = "nvim"; systemPackages = with pkgs; [