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

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-09-28 00:10:52 -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;};
};
}