diff options
Diffstat (limited to 'sys/fs/layout.nix')
| -rw-r--r-- | sys/fs/layout.nix | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/sys/fs/layout.nix b/sys/fs/layout.nix deleted file mode 100644 index 7e1ac2e..0000000 --- a/sys/fs/layout.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ lib, config, ... }: -with lib; let - cfg = config.local; -in -{ - options.local.fs.layout = with lib.types; { - sysHddBtrfs = mkOption { - default = null; - - type = nullOr (submodule { - options = { - sys = { - device = mkOption { - type = str; - }; - - ssd = mkOption { - type = bool; - }; - - root = mkOption { - type = str; - }; - - toplevel = mkOption { - type = str; - }; - }; - - hdd = { - device = mkOption { - type = str; - }; - - home = mkOption { - type = str; - }; - }; - }; - }); - }; - }; - - config = { - local.fs.btrfs = - let - sysHddBtrfs = layout: { - "/" = { - inherit (layout.sys) device ssd; - subvol = layout.sys.root; - }; - - "/toplevel" = { - inherit (layout.sys) device ssd; - subvol = layout.sys.toplevel; - }; - - "/hdd" = { - inherit (layout.hdd) device; - subvol = "/"; - ssd = false; - }; - - "/home" = { - inherit (layout.hdd) device; - subvol = layout.hdd.home; - ssd = false; - snapper = "home"; - }; - }; - - inherit (cfg.fs) layout; - - layoutMaps = [ sysHddBtrfs ]; - layoutOpts = [ layout.sysHddBtrfs ]; - valid = filter ({ snd, ... }: snd != null) (zipLists layoutMaps layoutOpts); - in - optionalAttrs (valid != [ ]) ((head valid).fst (head valid).snd); - - assertions = [ - { - assertion = length (filter (layout: layout != null) (attrValues cfg.fs.layout)) <= 1; - message = "Cannot enable more than one filesystem layout"; - } - ]; - }; -} |
