Added Disko setup; And test impermanence on node 1 & 2

This commit is contained in:
2026-06-27 21:43:29 +02:00
parent e2e63fbcab
commit 57f6b25a9e
10 changed files with 254 additions and 164 deletions
+1
View File
@@ -2,6 +2,7 @@
result result
result-* result-*
*.qcow2 *.qcow2
extra-files/*
# Ignore everything in the secrets directory # Ignore everything in the secrets directory
secrets/* secrets/*
Generated
+79 -38
View File
@@ -90,6 +90,26 @@
"type": "github" "type": "github"
} }
}, },
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1781152676,
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -223,6 +243,27 @@
"type": "github" "type": "github"
} }
}, },
"home-manager_2": {
"inputs": {
"nixpkgs": [
"impermanence",
"nixpkgs"
]
},
"locked": {
"lastModified": 1768598210,
"narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": { "hyprcursor": {
"inputs": { "inputs": {
"hyprlang": "hyprlang", "hyprlang": "hyprlang",
@@ -647,6 +688,25 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1769548169,
"narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nix-homebrew": { "nix-homebrew": {
"inputs": { "inputs": {
"brew-src": "brew-src" "brew-src": "brew-src"
@@ -688,42 +748,6 @@
"type": "github" "type": "github"
} }
}, },
"nixlib": {
"locked": {
"lastModified": 1736643958,
"narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1769813415,
"narHash": "sha256-nnVmNNKBi1YiBNPhKclNYDORoHkuKipoz7EtVnXO50A=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "8946737ff703382fda7623b9fab071d037e897d5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1780749050, "lastModified": 1780749050,
@@ -772,6 +796,22 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1768564909,
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1781577229, "lastModified": 1781577229,
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=", "narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
@@ -857,14 +897,15 @@
"inputs": { "inputs": {
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"darwin": "darwin", "darwin": "darwin",
"disko": "disko",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprcursor": "hyprcursor", "hyprcursor": "hyprcursor",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprland-plugins": "hyprland-plugins", "hyprland-plugins": "hyprland-plugins",
"impermanence": "impermanence",
"nix-homebrew": "nix-homebrew", "nix-homebrew": "nix-homebrew",
"nixcord": "nixcord", "nixcord": "nixcord",
"nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur", "nur": "nur",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
+10 -69
View File
@@ -5,11 +5,7 @@
# monorepo w/ recipes ("derivations") # monorepo w/ recipes ("derivations")
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-generators = { # declarative disk layout
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@@ -99,7 +95,6 @@
nixvim, nixvim,
hyprland, hyprland,
sops-nix, sops-nix,
nixos-generators,
nur, nur,
impermanence, impermanence,
disko, disko,
@@ -108,57 +103,17 @@
let let
primaryUser = "phil"; primaryUser = "phil";
mkIso = installer = nixpkgs.lib.nixosSystem {
{
hostName,
isDarwin ? false,
isServer ? false,
}:
nixos-generators.nixosGenerate {
system = "x86_64-linux"; system = "x86_64-linux";
format = "iso"; specialArgs = { inherit inputs; };
specialArgs = {
inherit
inputs
primaryUser
self
hostName
isDarwin
isServer
;
};
modules = [ modules = [
{ {
nixpkgs.overlays = [ nixpkgs = {
inputs.nur.overlays.default config.allowUnfree = true;
(import ./overlays { inherit (inputs) nur; }) hostPlatform = "x86_64-linux";
];
}
{ nixpkgs.config.allowUnfree = true; }
{ nixpkgs.hostPlatform = "x86_64-linux"; }
{ networking.hostName = hostName; }
./hosts/${hostName}/configuration.nix
./nixos
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = {
inherit
inputs
primaryUser
self
hostName
isDarwin
isServer
;
};
users.${primaryUser} = import ./home;
backupFileExtension = "backup";
useGlobalPkgs = true;
useUserPackages = true;
}; };
} }
./hosts/installer/configuration.nix
]; ];
}; };
@@ -229,6 +184,8 @@
in in
{ {
nixosConfigurations = { nixosConfigurations = {
"installer" = installer;
"cyper-desktop" = mkSystem { "cyper-desktop" = mkSystem {
hostName = "cyper-desktop"; hostName = "cyper-desktop";
system = "x86_64-linux"; system = "x86_64-linux";
@@ -266,23 +223,7 @@
}; };
packages.x86_64-linux = { packages.x86_64-linux = {
cyper-desktop-iso = mkIso { hostName = "cyper-desktop"; }; installer = self.nixosConfigurations.installer.config.system.build.isoImage;
cyper-controller-iso = mkIso {
hostName = "cyper-controller";
isServer = true;
};
cyper-proxy-iso = mkIso {
hostName = "cyper-proxy";
isServer = true;
};
cyper-node-1-iso = mkIso {
hostName = "cyper-node-1";
isServer = true;
};
cyper-node-2-iso = mkIso {
hostName = "cyper-node-2";
isServer = true;
};
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
disko.devices.disk.main = { disko.devices.disk.main = {
type = "disk"; type = "disk";
device = "/dev/sda"; # change to your actual disk, e.g. /dev/nvme0n1 device = "/dev/sda";
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
+3 -22
View File
@@ -31,29 +31,10 @@
"mode=755" "mode=755"
]; ];
}; };
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
"/nix" = {
device = "/dev/disk/by-label/NIXSTORE";
fsType = "ext4";
neededForBoot = true;
};
"/persist" = {
device = "/dev/disk/by-label/NIXPERSIST";
fsType = "ext4";
neededForBoot = true;
};
};
swapDevices = [ "/nix".neededForBoot = true;
{ device = "/dev/disk/by-label/NIXSWAP"; } "/persist".neededForBoot = true;
]; };
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+1
View File
@@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./disko.nix
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
+68
View File
@@ -0,0 +1,68 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"fmask=0022"
"dmask=0022"
];
extraArgs = [
"-n"
"NIXBOOT"
];
};
};
swap = {
size = "4G";
content = {
type = "swap";
extraArgs = [
"-L"
"NIXSWAP"
];
};
};
nix = {
size = "50G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/nix";
mountOptions = [ "defaults" ];
extraArgs = [
"-L"
"NIXSTORE"
];
};
};
persist = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/persist";
extraArgs = [
"-L"
"NIXPERSIST"
];
};
};
};
};
};
}
+3 -25
View File
@@ -31,32 +31,10 @@
"mode=755" "mode=755"
]; ];
}; };
"/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
"/nix" = {
device = "/dev/disk/by-label/NIXSTORE";
fsType = "ext4";
neededForBoot = true;
};
"/persist" = {
device = "/dev/disk/by-label/NIXPERSIST";
fsType = "ext4";
neededForBoot = true;
};
};
swapDevices = [ "/nix".neededForBoot = true;
{ "/persist".neededForBoot = true;
device = "/persist/swapfile"; };
size = 4096;
}
];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
+80
View File
@@ -0,0 +1,80 @@
{ modulesPath, pkgs, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
boot.zfs.forceImportRoot = false;
time.timeZone = "Europe/Berlin";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
};
services.openssh = {
enable = true;
openFirewall = true;
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = false;
};
};
users.users = {
root.openssh.authorizedKeys.keyFiles = [
../../secrets/ssh-key
];
phil = {
isNormalUser = true;
password = "nixos";
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keyFiles = [
../../secrets/ssh-key
];
};
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
networking = {
useNetworkd = true;
useDHCP = false;
firewall.enable = false;
};
systemd.network = {
enable = true;
networks."10-ethernet" = {
matchConfig.Name = "en*";
networkConfig = {
Address = "192.168.2.99/24";
Gateway = "192.168.2.1";
DNS = "192.168.2.2";
DHCP = "no";
};
};
};
environment.systemPackages = with pkgs; [
htop
lsscsi
pciutils
usbutils
nvme-cli
];
system.stateVersion = "26.05";
}
+1 -2
View File
@@ -1,8 +1,7 @@
{ primaryUser, ... }:
{ {
sops = { sops = {
defaultSopsFile = ../secrets/secrets.yaml; defaultSopsFile = ../secrets/secrets.yaml;
defaultSopsFormat = "yaml"; defaultSopsFormat = "yaml";
age.keyFile = "/home/${primaryUser}/.config/nix/secrets/keys.txt"; age.keyFile = "/persist/secrets/age-key.txt";
}; };
} }