fix: migrate secrets from /run/agenix(deleted after reboot) to /etc/agenix

This commit is contained in:
Ryan Yin
2023-07-15 12:31:18 +08:00
parent 5ed0ece058
commit c90d1c0208
2 changed files with 18 additions and 13 deletions
+2 -2
View File
@@ -3,14 +3,14 @@
programs.bash = { programs.bash = {
# load the alias file for work # load the alias file for work
bashrcExtra = '' bashrcExtra = ''
source /run/agenix/alias-for-work.bash source /etc/agenix/alias-for-work.bash
''; '';
}; };
programs.nushell = { programs.nushell = {
# load the alias file for work # load the alias file for work
extraConfig = '' extraConfig = ''
source /run/agenix/alias-for-work.nushell source /etc/agenix/alias-for-work.nushell
''; '';
}; };
+16 -11
View File
@@ -1,4 +1,4 @@
{ pkgs, agenix, mysecrets, ... }: { config, pkgs, agenix, mysecrets, ... }:
{ {
imports = [ imports = [
@@ -12,8 +12,6 @@
# if you changed this key, you need to regenerate all encrypt files from the decrypt contents! # if you changed this key, you need to regenerate all encrypt files from the decrypt contents!
age.identityPaths = [ "/home/ryan/.ssh/juliet-age" ]; age.identityPaths = [ "/home/ryan/.ssh/juliet-age" ];
age.secretsDir = "/run/agenix/";
############################################################################ ############################################################################
# #
# The following secrets are used by NixOS Modules # The following secrets are used by NixOS Modules
@@ -47,17 +45,24 @@
############################################################################ ############################################################################
age.secrets."alias-for-work.nushell" = { age.secrets."alias-for-work.nushell" = {
# path = "/etc/agenix/";
file = "${mysecrets}/alias-for-work.nushell.age"; file = "${mysecrets}/alias-for-work.nushell.age";
mode = "0600";
owner = "ryan";
group = "ryan";
}; };
age.secrets."alias-for-work.bash" = { age.secrets."alias-for-work.bash" = {
# path = "/etc/agenix/";
file = "${mysecrets}/alias-for-work.bash.age"; file = "${mysecrets}/alias-for-work.bash.age";
mode = "0600"; };
owner = "ryan";
group = "ryan"; environment.etc = {
"agenix/alias-for-work.nushell" = {
source = config.age.secrets."alias-for-work.nushell".path;
mode = "0600";
uid = 1000;
gid = 1000;
};
"agenix/alias-for-work.bash" = {
source = config.age.secrets."alias-for-work.bash".path;
mode = "0600";
uid = 1000;
gid = 1000;
};
}; };
} }