summaryrefslogtreecommitdiffstats
path: root/lass/1systems/hilum/physical.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-02-02 17:03:15 +0100
committertv <tv@krebsco.de>2023-02-02 17:03:15 +0100
commit3c1a1f0f09e1789ebda529e597c1bb8b7bc7d0c4 (patch)
treee041536cd96726fb87adc15fbe95f1eabd280ba9 /lass/1systems/hilum/physical.nix
parentfc00990f712663688e5aea85624cb9317e9f4128 (diff)
parent46ae6fc00c3e1aee5bc5db846ec91e30c430f0f1 (diff)
Merge remote-tracking branch 'prism/master' into head
Diffstat (limited to 'lass/1systems/hilum/physical.nix')
-rw-r--r--lass/1systems/hilum/physical.nix43
1 files changed, 29 insertions, 14 deletions
diff --git a/lass/1systems/hilum/physical.nix b/lass/1systems/hilum/physical.nix
index f8bab57d6..6f160062d 100644
--- a/lass/1systems/hilum/physical.nix
+++ b/lass/1systems/hilum/physical.nix
@@ -1,11 +1,38 @@
-{ lib, pkgs, ... }:
+{ config, lib, pkgs, ... }:
{
imports = [
./config.nix
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
+ {
+ # nice hack to carry around state passed impurely at the beginning
+ options.mainDisk = let
+ tryFile = path: default:
+ if lib.elem (builtins.baseNameOf path) (lib.attrNames (builtins.readDir (builtins.dirOf path))) then
+ builtins.readFile path
+ else
+ default
+ ;
+ in lib.mkOption {
+ type = lib.types.str;
+ default = tryFile "/etc/hilum-disk" "/dev/sdz";
+ };
+ config.environment.etc.hilum-disk.text = config.mainDisk;
+ }
+ {
+ options.luksPassFile = lib.mkOption {
+ type = lib.types.nullOr lib.types.str;
+ default = null;
+ };
+ }
];
+ disko.devices = import ./disk.nix {
+ inherit lib;
+ disk = config.mainDisk;
+ keyFile = config.luksPassFile;
+ };
+
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
@@ -13,21 +40,9 @@
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
- boot.loader.grub.device = "/dev/disk/by-id/usb-General_USB_Flash_Disk_0374116060006128-0:0";
+ boot.loader.grub.device = config.mainDisk;
boot.loader.grub.efiInstallAsRemovable = true;
- fileSystems."/" =
- { device = "/dev/disk/by-uuid/6db29cdd-ff64-496d-b541-5f1616665dc2";
- fsType = "ext4";
- };
-
- boot.initrd.luks.devices."usb_nix".device = "/dev/disk/by-uuid/3c8ab3af-57fb-4564-9e27-b2766404f5d4";
-
- fileSystems."/boot" =
- { device = "/dev/disk/by-uuid/2B9E-5131";
- fsType = "vfat";
- };
-
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 4;