global(fs): add f2fs and zfs
This commit is contained in:
parent
4c1cded852
commit
453acac7ec
3 changed files with 55 additions and 1 deletions
41
global/fs/zfs.nix
Normal file
41
global/fs/zfs.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ... }: with lib; let
|
||||
cfg = config.global.fs;
|
||||
in {
|
||||
options.global.fs.zfs = {
|
||||
persist = mkOption {
|
||||
type = with types; str;
|
||||
default = cfg.store;
|
||||
description = ''
|
||||
pool for persist dataset
|
||||
defaults to nix store dataset
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.type == "zfs") {
|
||||
fileSystems = {
|
||||
"/nix" =
|
||||
{ device = "${cfg.store}/nix";
|
||||
fsType = "zfs";
|
||||
};
|
||||
"/nix/persist" =
|
||||
{ device = "${cfg.zfs.persist}/persist";
|
||||
fsType = "zfs";
|
||||
neededForBoot = true;
|
||||
};
|
||||
} // (mapAttrs' (name: opts: nameValuePair
|
||||
"/nix/persist/home/${name}" {
|
||||
device = "${cfg.zfs.persist}/home/${name}";
|
||||
fsType = "zfs";
|
||||
neededForBoot = true;
|
||||
}) (filterAttrs (n: _: n != "root") config.users.profiles));
|
||||
|
||||
services.zfs.trim.enable = true;
|
||||
services.zfs.autoSnapshot.enable = true;
|
||||
services.zfs.autoScrub.enable = true;
|
||||
boot.zfs.devNodes = mkDefault "/dev/disk/by-partuuid";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue