From 3656d672c47021e63f52a5b8278101d1185e76f9 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Mon, 8 Apr 2024 22:09:31 +0200 Subject: [PATCH] working --- template/libs/default.nix | 148 ++++++++++++++++++-------------------- template/system/disko.nix | 1 - 2 files changed, 70 insertions(+), 79 deletions(-) diff --git a/template/libs/default.nix b/template/libs/default.nix index 01e81be..eda834e 100644 --- a/template/libs/default.nix +++ b/template/libs/default.nix @@ -3,7 +3,6 @@ device ? throw "Missing required argument device. (e.g. /dev/sda)", swapCapacity ? throw "Missing required argument swapCapacity. (e.g. 16G)", ssd ? false, - efi ? true, ... }: { disko.devices = { @@ -13,88 +12,81 @@ type = "disk"; content = { type = "gpt"; - partitions = - { - "luks" = { - size = "100%"; - content = { - type = "luks"; - name = "crypted"; - settings.allowDiscards = true; + partitions = { + "boot" = { + size = "512M"; + type = "EF02"; + }; + "esp" = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; - content = { - type = "btrfs"; - extraArgs = ["-f"]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = - [ - "compress=zstd" - "noatime" - ] - ++ ( - if ssd - then ["ssd"] - else [] - ); - }; - "/persist" = { - mountpoint = "/persist"; - mountOptions = - [ - "compress=zstd" - "noatime" - ] - ++ ( - if ssd - then ["ssd"] - else [] - ); - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = - [ - "compress=zstd" - "noatime" - ] - ++ ( - if ssd - then ["ssd"] - else [] - ); - }; - "/swap" = { - mountpoint = "/.swapvol"; - swap.swapfile.size = swapCapacity; - }; + "luks" = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + settings.allowDiscards = true; + + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = + [ + "compress=zstd" + "noatime" + ] + ++ ( + if ssd + then ["ssd"] + else [] + ); + }; + "/persist" = { + mountpoint = "/persist"; + mountOptions = + [ + "compress=zstd" + "noatime" + ] + ++ ( + if ssd + then ["ssd"] + else [] + ); + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = + [ + "compress=zstd" + "noatime" + ] + ++ ( + if ssd + then ["ssd"] + else [] + ); + }; + "/swap" = { + mountpoint = "/.swapvol"; + swap.swapfile.size = swapCapacity; }; }; }; }; - } - // ( - if efi - then { - "esp" = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = ["umask=0077"]; - }; - }; - } - else { - "boot" = { - size = "512M"; - type = "EF02"; - }; - } - ); + }; + }; }; }; }; diff --git a/template/system/disko.nix b/template/system/disko.nix index 240d36f..f889756 100644 --- a/template/system/disko.nix +++ b/template/system/disko.nix @@ -3,5 +3,4 @@ libs.diskSetup { device = "/dev/sda"; ssd = true; swapCapacity = "2G"; - efi = true; }