From b0a8e6548047715798a9efefdc3012fd6b6d7f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Thu, 31 Aug 2023 22:34:22 +0200 Subject: [PATCH] feat: added test system --- .gitignore | 1 + README.md | 5 ++- hosts.toml | 4 ++ hosts/desktopnix/fs.nix | 8 ++-- hosts/patricknix/fs.nix | 2 +- hosts/testienix/default.nix | 16 +++++++ hosts/testienix/fs.nix | 57 ++++++++++++++++++++++++ hosts/testienix/net.nix | 12 +++++ hosts/testienix/secrets/secrets.nix.age | Bin 0 -> 917 bytes lib/disko.nix | 4 +- nix/installer-configuration.nix | 3 ++ 11 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 hosts/testienix/default.nix create mode 100644 hosts/testienix/fs.nix create mode 100644 hosts/testienix/net.nix create mode 100644 hosts/testienix/secrets/secrets.nix.age 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 0000000000000000000000000000000000000000..bb13ae69efc2a914698dee8db3609b72fce473f7 GIT binary patch literal 917 zcmZwB>xw4O@}|FJ||)w8`ovc*TaVhBl7Wf0^kxQ}=htJ$PsFe&F1 zpXsH20?pwmv7)d5XTl^CBG9^}fP+jAWOHdtDfcC>AW)u6;2a7X+2MLe3xWS@by~U? z#k8_jLYjl7&DlLfBoL_wF;appb!CHZ*|CILY%4Axpm3+5x2vp>@wgPqu<;@_PBm&! zrIR1fesw_6f+M-9v_aps_M{6!P<7>6M+RzfSPZ+^z~dAg#pHZ4M29L6)zDHBXqc?Y zs!32Q5p6+rLjlTlGwoOK_P;S&fa91BGo%HPEYT1n9XL6l zG6ri#ZCPYubeKd8v&9di5wt!YZ34kyFc2-*aKA*AaVY{p>7JbG*6O~KW=Oi6H3|al zgtIzfSDQG|0p8o0U3ufxr#7Zy#B+}|1VH@hQ{RaHu^KtYukO6{!Y4!Lx5?V_LtiZD zU)#@)3`QQW%wAvnaaNX2E=^xRfA5V!bMIc^=C2V4#FMe-e~mvnbYtw}t<2QD;B9U3 z>KWzW)S*|d;#~Hgg?w}RrpG6??-y=megn3o*WQ}E(t7>vz|ZTaj&FMZ;w5|b#i6