5a4d076d84
Note: not the actual initial commit. I swear I will stop repeatedly force pushing to this single commit eventually ok.
24 lines
497 B
Nix
24 lines
497 B
Nix
{ config, lib, ... }:
|
|
|
|
let
|
|
cfg = config.my.fs.luks;
|
|
in {
|
|
options.my.fs.luks = {
|
|
enable = lib.mkEnableOption null;
|
|
device = lib.mkOption {
|
|
type = lib.types.path;
|
|
default = "/dev/disk/by-label/nixos-crypt";
|
|
};
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "nixos";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
my.fs.device = lib.mkDefault "/dev/mapper/${cfg.name}";
|
|
|
|
boot.initrd.luks.devices.${cfg.name} = {inherit (cfg) device;};
|
|
};
|
|
}
|