dotfiles/modules/os/core/fs/luks.nix
eriedaberrie ef322634fe Initial commit
Note: not the actual initial commit.

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-09-08 15:51:41 -07:00

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;};
};
}