Migrate to Snowfall (#1)
Reviewed-on: #1 Co-authored-by: Evan Reichard <evan@reichard.io> Co-committed-by: Evan Reichard <evan@reichard.io>
This commit was merged in pull request #1.
This commit is contained in:
41
modules/home/services/sops/default.nix
Normal file
41
modules/home/services/sops/default.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{ config, lib, namespace, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) mkIf types;
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
cfg = config.${namespace}.services.sops;
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.sops = with types; {
|
||||
enable = lib.mkEnableOption "sops";
|
||||
defaultSopsFile = mkOpt path null "Default sops file.";
|
||||
sshKeyPaths = mkOpt (listOf path) [ ] "SSH Key paths to use.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
age
|
||||
sops
|
||||
ssh-to-age
|
||||
];
|
||||
|
||||
sops = {
|
||||
inherit (cfg) defaultSopsFile;
|
||||
defaultSopsFormat = "yaml";
|
||||
|
||||
age = {
|
||||
generateKey = true;
|
||||
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
||||
sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ] ++ cfg.sshKeyPaths;
|
||||
};
|
||||
|
||||
# TODO
|
||||
# secrets = {
|
||||
# nix = {
|
||||
# sopsFile = lib.snowfall.fs.get-file "secrets/default.yaml";
|
||||
# path = "${config.home.homeDirectory}/.config/nix/nix.conf";
|
||||
# };
|
||||
# };
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user