modules.user.chn: set git user name

This commit is contained in:
2025-12-13 10:35:07 +08:00
parent 2a39ec4c7f
commit 959722a509
3 changed files with 32 additions and 35 deletions

View File

@@ -22,41 +22,37 @@ inputs:
ssd = inputs.lib.mkOption { type = inputs.lib.types.bool; default = false; };
};}));
};
config =
config.home =
{
programs.git.settings.user = { name = "chn"; email = "chn@chn.moe"; };
home =
{
file.groupshare.enable = false;
packages =
[
(
let
servers = inputs.localLib.attrsToList hmInputs.config.nixos.decrypt;
cat = "${inputs.pkgs.coreutils}/bin/cat";
gpg = "${inputs.pkgs.gnupg}/bin/gpg";
ssh = "${inputs.pkgs.openssh}/bin/ssh";
# generate using echo -n key | gpg --encrypt --recipient chn > xxx.key
in inputs.pkgs.writeShellScriptBin "remote-decrypt" (builtins.concatStringsSep "\n"
(
(builtins.map (system: builtins.concatStringsSep "\n"
[
"decrypt-${system.name}() {"
" key=$(${cat} ${inputs.topInputs.self}/devices/cross/luks-manual/${system.name}.key \\"
" | ${gpg} --decrypt)"
(builtins.concatStringsSep "\n" (builtins.map
(device: " echo $key | ${ssh} root@initrd.${system.name}.chn.moe cryptsetup luksOpen "
+ (if device.value.ssd then "--allow-discards " else "")
+ "${device.name} ${device.value.mapper} -")
(inputs.localLib.attrsToList system.value)))
"}"
])
servers)
++ [ "decrypt-$1" ]
))
)
];
};
file.groupshare.enable = false;
packages =
[
(
let
servers = inputs.localLib.attrsToList hmInputs.config.nixos.decrypt;
cat = "${inputs.pkgs.coreutils}/bin/cat";
gpg = "${inputs.pkgs.gnupg}/bin/gpg";
ssh = "${inputs.pkgs.openssh}/bin/ssh";
# generate using echo -n key | gpg --encrypt --recipient chn > xxx.key
in inputs.pkgs.writeShellScriptBin "remote-decrypt" (builtins.concatStringsSep "\n"
(
(builtins.map (system: builtins.concatStringsSep "\n"
[
"decrypt-${system.name}() {"
" key=$(${cat} ${inputs.topInputs.self}/devices/cross/luks-manual/${system.name}.key \\"
" | ${gpg} --decrypt)"
(builtins.concatStringsSep "\n" (builtins.map
(device: " echo $key | ${ssh} root@initrd.${system.name}.chn.moe cryptsetup luksOpen "
+ (if device.value.ssd then "--allow-discards " else "")
+ "${device.name} ${device.value.mapper} -")
(inputs.localLib.attrsToList system.value)))
"}"
])
servers)
++ [ "decrypt-$1" ]
))
)
];
};
};
};

View File

@@ -23,6 +23,7 @@ inputs:
tlstimeout = 3600;
transfer.maxretries = 1;
};
user = { name = "Haonan Chen"; email = "chn@chn.moe"; };
};
};
delta =

View File

@@ -132,7 +132,7 @@ inputs:
{
programs.git.settings =
{
user = { name = "chn"; email = "chn@chn.moe"; };
user = { name = "Haonan Chen"; email = "chn@chn.moe"; };
# allow root operate on git repositories owned by others
safe.directory = "*";
};