diff --git a/flake.lock b/flake.lock index 39c0522..77a285c 100644 --- a/flake.lock +++ b/flake.lock @@ -180,16 +180,15 @@ ] }, "locked": { - "lastModified": 1742690494, - "narHash": "sha256-SFacEbSRMoTyWG5VXh4ieofJGge+cLq9lH8ifB+zjBg=", - "owner": "nvmd", + "lastModified": 1755519972, + "narHash": "sha256-bU4nqi3IpsUZJeyS8Jk85ytlX61i4b0KCxXX9YcOgVc=", + "owner": "nix-community", "repo": "disko", - "rev": "9dc58d4d49c9f74623a06e2fc20cdfd8bb3cbe8b", + "rev": "4073ff2f481f9ef3501678ff479ed81402caae6d", "type": "github" }, "original": { - "owner": "nvmd", - "ref": "gpt-attrs", + "owner": "nix-community", "repo": "disko", "type": "github" } diff --git a/flake.nix b/flake.nix index a4bc23b..60d4723 100644 --- a/flake.nix +++ b/flake.nix @@ -43,8 +43,8 @@ disko = { # the fork is needed for partition attributes support - url = "github:nvmd/disko/gpt-attrs"; - # url = "github:nix-community/disko"; + # url = "github:nvmd/disko/gpt-attrs"; + url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/modules/nixos/disko/x86_64-linux/default.nix b/modules/nixos/disko/x86_64-linux/default.nix index decf7ef..4daf1a6 100644 --- a/modules/nixos/disko/x86_64-linux/default.nix +++ b/modules/nixos/disko/x86_64-linux/default.nix @@ -1,95 +1,82 @@ { - config, lib, system, - namespace, ... }: let - cfg = config.${namespace}.hardware.disko; isArm = builtins.match "aarch64*" system != null; rootDisk = "/dev/nvme0n1"; in { imports = [ ../options.nix ]; - - config = lib.mkIf (cfg.enable && !isArm) { + config = lib.mkIf (!isArm) { disko.devices = { nodev."/" = { fsType = "tmpfs"; mountOptions = [ "mode=755" "defaults" - "size=25%" + "size=2G" ]; }; - # root disk setup - disk.main = { - type = "disk"; - device = rootDisk; - imageSize = "32G"; - content = { - type = "gpt"; - # specify partitions - partitions = { - # /boot - ESP = { - priority = 1; - name = "ESP"; - start = "1M"; - end = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - - root = { - name = "btrfs-root"; - size = "100%"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; # Override existing partition - # Subvolumes must set a mountpoint in order to be mounted, - # unless their parent is mounted - subvolumes = { - "home" = { - mountOptions = [ "compress=zstd" ]; - mountpoint = "/home"; - }; - "root" = { - mountOptions = [ - "compress=zstd" - "noatime" - ]; - mountpoint = "/root"; - }; - "nix" = { - mountOptions = [ - "compress=zstd" - "noatime" - ]; - mountpoint = "/nix"; - }; - "etc" = { - mountOptions = [ - "compress=zstd" - "noatime" - ]; - mountpoint = "/etc"; - }; - "log" = { - mountOptions = [ - "compress=zstd" - "noatime" - ]; - mountpoint = "/var/log"; - }; + disk = { + main = { + device = rootDisk; + type = "disk"; + imageSize = "15G"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "100M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; }; }; + + root = { + size = "100%"; + content = { + type = "bcachefs"; + # This refers to a filesystem in the `bcachefs_filesystems` attrset below. + filesystem = "mounted_subvolumes_in_multi"; + label = "ssd.ssd1"; + extraFormatArgs = [ + "--discard" + ]; + }; + }; + }; + }; + }; + }; + + bcachefs_filesystems = { + mounted_subvolumes_in_multi = { + type = "bcachefs_filesystem"; + # passwordFile = "/etc/nixos/pool.jwe"; + extraFormatArgs = [ + "--compression=zstd" + ]; + subvolumes = { + "subvolumes/root" = { + mountpoint = "/root"; + }; + "subvolumes/home" = { + mountpoint = "/home"; + }; + "subvolumes/nix" = { + mountpoint = "/nix"; + }; + "subvolumes/etc" = { + mountpoint = "/etc"; + }; + "subvolumes/log" = { + mountpoint = "/var/log"; }; }; };