Modules: Deprecate agenix module (replace with sops-nix)
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
mylib,
|
||||
pkgs,
|
||||
username,
|
||||
publicKeys,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules) agenix;
|
||||
in {
|
||||
options.modules.agenix = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
config = {
|
||||
# NOTE: Add below snippet to home/christoph/default.nix to generate the secrets.nix file
|
||||
|
||||
# The user will be able to decrypt .age files using agenix.
|
||||
# On each user/machine, this should generate a corresponding secrets.nix
|
||||
# "${config.paths.nixflake}/system/modules/agenix/secrets.nix".text = let
|
||||
# mkSecret = key: name: "\"${name}.age\".publicKeys = [\"${key}\"];";
|
||||
# in ''
|
||||
# # This file will contain keys depending on the host/by which user it was built on.
|
||||
# {
|
||||
# ${lib.optionalString
|
||||
# # If this user defined any secrets...
|
||||
# (builtins.hasAttr "${username}" nixosConfig.modules.agenix.secrets)
|
||||
# # ...we will add them to the current secrets.nix,
|
||||
# # s.t. agenix can be used to encrypt/access them.
|
||||
# (builtins.concatStringsSep "\n"
|
||||
# (builtins.map
|
||||
# (mkSecret publicKeys.${username}.ssh)
|
||||
# nixosConfig.modules.agenix.secrets.${username}))}
|
||||
# }
|
||||
# '';
|
||||
|
||||
# Register generated secrets to the age system module
|
||||
age.secrets = let
|
||||
mkSecretIfExists = name:
|
||||
# If this user has already encrypted the secret...
|
||||
if builtins.pathExists ./${name}.age
|
||||
# ...we will register it with age...
|
||||
then {${name}.file = ./${name}.age;}
|
||||
# ...otherwise we link to a bogus file.
|
||||
else {${name}.file = ./void.age;};
|
||||
in
|
||||
lib.mkIf
|
||||
# If this user defined any secrets...
|
||||
(builtins.hasAttr "${username}" agenix.secrets)
|
||||
# ...we will register all secrets files that have already been generated.
|
||||
(lib.mkMerge (builtins.map mkSecretIfExists agenix.secrets.${username}));
|
||||
};
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
mylib,
|
||||
pkgs,
|
||||
username,
|
||||
publicKeys,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules) agenix;
|
||||
in {
|
||||
options.modules.agenix = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
config = {
|
||||
# NOTE: See the generated secrets.nix file in home/christoph/default.nix
|
||||
|
||||
# Register generated secrets to the age system module
|
||||
age.secrets = let
|
||||
mkSecretIfExists = name:
|
||||
# If this user has already encrypted the secret...
|
||||
if builtins.pathExists ./${name}.age
|
||||
# ...we will register it with age...
|
||||
then {${name}.file = ./${name}.age;}
|
||||
# ...otherwise we link to a bogus file.
|
||||
else {${name}.file = ./void.age;};
|
||||
in
|
||||
lib.mkIf
|
||||
# If this user defined any secrets...
|
||||
(builtins.hasAttr "${username}" agenix.secrets)
|
||||
# ...we will register all secrets files that have already been generated.
|
||||
(lib.mkMerge (builtins.map mkSecretIfExists agenix.secrets.${username}));
|
||||
};
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 PW+5DQ z6Fm40D2nCJvvFsQdj9V4zcvVBpjFAvLZh17cEtLEx8
|
||||
hIyc+AUuEiIv6TobnNawdyEswAAQ4kQeh5n0yaVT/mY
|
||||
--- Yhxh9hnsPfHYcmmrpQm5Up0VzRh2ndoF3R3W+7ojW58
|
||||
b¸¶àñ?´‚ú Ì™WcÏÿú…æR•”<‰@þyŽ˜Ðþ1z%ê4EWuÕ7 Œ<¢”¸'ßàCg9!è`cv
|
||||
@@ -1,5 +0,0 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 PW+5DQ 2vardSYoPFvDEw4TiKSXntAJmChcVu9X+nD1+rCac1c
|
||||
mbx9xEy0vkQvl6HqLcFTk3qrsUpDAUuKD6GnJGa9elc
|
||||
--- vKkGWdp/anMV2VzwJEEHeWNUjv/SkzjYOIljRK6ExbI
|
||||
¹Ò¤Š�v®òLHôæl†|µ>ßïÇMcsoÏ{jÄSöÊÅ_à‰'—ÐŒÊWlÃ…£_iûM°Y×âÏÐý�VVûŒsÛ,D%�-&+�½ì¡ißÖTçP"�g
|
||||
@@ -1,6 +0,0 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 PW+5DQ Wm5RTSiZ/ndp6l6q2T43wrHiMnyP/FqDzUsl29TYoQc
|
||||
ti4Pc/+g+6618wOQAb+28bNt87A8f3gRFzCaMlNKpP4
|
||||
--- aRzLWmbnb7MqPVDSTYLqCIDHqaj0fu3JVp4ES93xZ9I
|
||||
B6Ï<ª
|
||||
I mjì–óñ½L‰¹N£í÷—-eØ![Ç'y_�aIë·
|
||||
@@ -1,6 +0,0 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 PW+5DQ ZeBpvImtTWyKOxlCh573CNitT2z1OX2PgHAzLB/RTzg
|
||||
jx7n2REzbCJ9zr2TQHSvEz7lUZap5J2mjHNx710L49w
|
||||
--- kdRUEg3IOfjUfAgPEMj7MdiGftxVptPeC/Mbh5qWf8c
|
||||
Ν
|
||||
™Ò#N'ß(:aì©aá]µÿgüPo©ý¡í²[�¯=nÜ
|
||||
@@ -1,5 +0,0 @@
|
||||
age-encryption.org/v1
|
||||
-> ssh-ed25519 PW+5DQ V2ejrKdFVeO7nNqkRqa3nSnz8MKlHyZcQ+T1NRfntSw
|
||||
t79YI5ZFtW0k6IZRB5VMjy7st+WlhONTFyVF/tvPaKk
|
||||
--- Cz4XV8J+oM6q6bVq6uXXUUvW/BqBL0agNzmobzcu2Kc
|
||||
á�{*$˜cøÐ̨&ZÅuthF¿ïþï¢[ÍTý%?ˆÙÞ?|*½`¾^OÉ
|
||||
@@ -1,6 +1,5 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./agenix
|
||||
./bootloader
|
||||
./desktopportal
|
||||
./docker
|
||||
|
||||
Reference in New Issue
Block a user