diff options
author | Baitinq <30861839+Baitinq@users.noreply.github.com> | 2022-08-25 22:15:21 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-08-25 22:15:21 +0200 |
commit | 4e274fd9c934f0f1edef32de3b0502cf2dc21c64 (patch) | |
tree | 6b26eaa0fc91f6b462ca02b9efbc813c1143f8c4 /hosts/luna | |
parent | Disko: Add esp flag to efi partition and rename label to part-label (diff) | |
download | nixos-config-4e274fd9c934f0f1edef32de3b0502cf2dc21c64.tar.gz nixos-config-4e274fd9c934f0f1edef32de3b0502cf2dc21c64.tar.bz2 nixos-config-4e274fd9c934f0f1edef32de3b0502cf2dc21c64.zip |
Implement disko as a module (#2)
This allows us to build it independently when bootstraping a system
Diffstat (limited to 'hosts/luna')
-rw-r--r-- | hosts/luna/disks.nix | 107 |
1 files changed, 63 insertions, 44 deletions
diff --git a/hosts/luna/disks.nix b/hosts/luna/disks.nix index e8341da..8fc4b1f 100644 --- a/hosts/luna/disks.nix +++ b/hosts/luna/disks.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ inputs, lib, config, pkgs, ... }: let partitionsConfig = { type = "devices"; @@ -99,60 +99,79 @@ let }; in { - fileSystems."/" = { - device = "none"; - fsType = "tmpfs"; - }; + config = { - boot.initrd.luks.devices."encrypted_boot" = { - device = "/dev/disk/by-uuid/4f5ba100-5c69-49ce-b0cf-2f219a5e9e51"; - preLVM = true; - }; + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + }; - fileSystems."/boot" = { - device = "/dev/mapper/encrypted_boot"; - fsType = "vfat"; - }; + boot.initrd.luks.devices."encrypted_boot" = { + device = "/dev/disk/by-uuid/4f5ba100-5c69-49ce-b0cf-2f219a5e9e51"; + preLVM = true; + }; - fileSystems."/boot/efi" = { - device = "/dev/disk/by-uuid/BD51-1431"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/mapper/encrypted_boot"; + fsType = "vfat"; + }; - boot.initrd.luks.devices."encrypted_nix".device = "/dev/disk/by-uuid/596e43d3-ccda-4f06-bce9-58d6a8c0dd79"; + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/BD51-1431"; + fsType = "vfat"; + }; - fileSystems."/nix" = { - device = "/dev/mapper/encrypted_nix"; - fsType = "btrfs"; - neededForBoot = true; - options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; - }; + boot.initrd.luks.devices."encrypted_nix".device = "/dev/disk/by-uuid/596e43d3-ccda-4f06-bce9-58d6a8c0dd79"; - boot.initrd.luks.devices."encrypted_home_and_persist".device = "/dev/disk/by-uuid/47a8ddde-1237-4a0f-84c4-f17fbd22ea3f"; + fileSystems."/nix" = { + device = "/dev/mapper/encrypted_nix"; + fsType = "btrfs"; + neededForBoot = true; + options = [ "subvol=nix" "compress-force=zstd" "noatime" ]; + }; - fileSystems."/persist" = { - device = "/dev/mapper/encrypted_home_and_persist"; - fsType = "btrfs"; - neededForBoot = true; - options = [ "subvol=persist" "compress-force=zstd" "noatime" ]; - }; + boot.initrd.luks.devices."encrypted_home_and_persist".device = "/dev/disk/by-uuid/47a8ddde-1237-4a0f-84c4-f17fbd22ea3f"; - fileSystems."/home" = { - device = "/dev/mapper/encrypted_home_and_persist"; - fsType = "btrfs"; - options = [ "subvol=home" "compress-force=zstd" ]; - }; + fileSystems."/persist" = { + device = "/dev/mapper/encrypted_home_and_persist"; + fsType = "btrfs"; + neededForBoot = true; + options = [ "subvol=persist" "compress-force=zstd" "noatime" ]; + }; + + fileSystems."/home" = { + device = "/dev/mapper/encrypted_home_and_persist"; + fsType = "btrfs"; + options = [ "subvol=home" "compress-force=zstd" ]; + }; - services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.enable = true; - swapDevices = [ ]; + swapDevices = [ ]; - zramSwap.enable = true; + zramSwap.enable = true; + + + environment.systemPackages = [ + config.disko-create + config.disko-mount + ]; + }; + options.disko-create = with lib; mkOption { + type = types.package; + default = pkgs.buildEnv { + name = "disko-create"; + paths = [ (pkgs.writeScriptBin "disko-create" (inputs.disko.lib.create partitionsConfig)) pkgs.parted ]; + }; + }; + + options.disko-mount = with lib; mkOption { + type = types.package; + default = pkgs.buildEnv { + name = "disko-mount"; + paths = [ (pkgs.writeScriptBin "disko-mount" (inputs.disko.lib.mount partitionsConfig)) pkgs.parted ]; + }; + }; - environment.systemPackages = with pkgs;[ - parted - (pkgs.writeScriptBin "disko-create" (inputs.disko.lib.create partitionsConfig)) - (pkgs.writeScriptBin "disko-mount" (inputs.disko.lib.mount partitionsConfig)) - ]; } |