diff --git a/flake.nix b/flake.nix index 676ca8eb..fb47c016 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,10 @@ }; # System application(s) + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + } ragenix = { url = "github:yaxitech/ragenix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/thinkpad-e595/hardware.nix b/hosts/thinkpad-e595/hardware.nix index 36b0827a..7df76a00 100644 --- a/hosts/thinkpad-e595/hardware.nix +++ b/hosts/thinkpad-e595/hardware.nix @@ -9,27 +9,6 @@ in { imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - fileSystems."/" = { - device = "/dev/disk/by-label/nixos"; - fsType = "ext4"; - options = ["noatime" "x-gvfs-hide"]; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-label/home"; - fsType = "ext4"; - neededForBoot = true; - options = ["noatime" "x-gvfs-hide"]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/BOOT"; - fsType = "vfat"; - options = ["x-gvfs-hide"]; - }; - - swapDevices = [{device = "/dev/disk/by-label/swap";}]; - boot = { initrd = { availableKernelModules = [ diff --git a/hosts/thinkpad-e595/partition.nix b/hosts/thinkpad-e595/partition.nix new file mode 100644 index 00000000..25ab1fac --- /dev/null +++ b/hosts/thinkpad-e595/partition.nix @@ -0,0 +1,34 @@ +{disks ? ["/dev/sda"], ...}: { + disko.devices.disk.vdb = { + device = builtins.elemAt disks 0; + type = "disk"; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + name = "ESP"; + start = "1MiB"; + end = "512MiB"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + name = "root"; + start = "512MiB"; + end = "100%"; + part-type = "primary"; + content = { + type = "filesystem"; + format = "bcachefs"; + mountpoint = "/"; + }; + } + ]; + }; + }; +} diff --git a/modules/disko.nix b/modules/disko.nix new file mode 100644 index 00000000..4bfd2ac2 --- /dev/null +++ b/modules/disko.nix @@ -0,0 +1,18 @@ +{ + options, + config, + inputs, + lib, + pkgs, + ... +}: let + inherit (builtins) pathExists; + inherit (lib) optional; + inherit (inputs) disko; + + diskoConf = "${config.snowflake.hostDir}/partition.nix"; +in { + imports = + [disko.nixosModules.default] + ++ optional (pathExists diskoConf) (import diskoConf {}); +}