feat: added test system

This commit is contained in:
Patrick Großmann 2023-08-31 22:34:22 +02:00
parent 26e8003332
commit b0a8e65480
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
11 changed files with 104 additions and 8 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.pre-commit-config.yaml
.direnv
todo*

View file

@ -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.<target-system>.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 <target> .#packages.<target-system>.installer-package.<target>`
## Deploy

View file

@ -5,3 +5,7 @@ system = "x86_64-linux"
[desktopnix]
type = "nixos"
system = "x86_64-linux"
[testienix]
type = "nixos"
system = "x86_64-linux"

View file

@ -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%")
];
};
};

View file

@ -14,7 +14,7 @@
partitions = [
(partEfiBoot "boot" "0%" "512MiB")
#(partSwap "swap" "1GiB" "17GiB")
(partLuksZfs "rpool" "512MiB" "100%")
(partLuksZfs "rpool" "rpool" "512MiB" "100%")
];
};
};

View file

@ -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
];
}

57
hosts/testienix/fs.nix Normal file
View file

@ -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";
};
};
};
};
}

12
hosts/testienix/net.nix Normal file
View file

@ -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"];
};
};
}

Binary file not shown.

View file

@ -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;
};
};
};

View file

@ -15,6 +15,9 @@
];
};
# Grub broken
boot.loader.systemd-boot.enable = true;
environment = {
variables.EDITOR = "nvim";
systemPackages = with pkgs; [