sigil/nixos-modules/file-systems.nix

33 lines
794 B
Nix

{ config, lib, pkgs, ... }:
with lib; {
options.fileSystems = lib.mkOption {
type = types.attrsOf (types.submodule ({ name, config, ... }: {
options.block = {
device = lib.mkOption { type = types.int; };
driver = lib.mkOption { type = types.enum [ "ahci" "usb" ]; };
partition = lib.mkOption { type = types.ints.positive; };
};
}));
};
config = {
assertions = [{
assertion = config.fileSystems."/".fsType == "ext2";
message = "The only supported fsType is EXT2";
}];
hardware.genode.ahci.enable =
any (fs: fs.block.driver == "ahci") (attrValues config.fileSystems);
hardware.genode.usb.storage.enable = lib.mkDefault
(any (fs: fs.block.driver == "usb") (attrValues config.fileSystems));
};
}