From 959722a50984a911597012d1dbab5c0ac8250efc Mon Sep 17 00:00:00 2001 From: chn Date: Sat, 13 Dec 2025 10:35:07 +0800 Subject: [PATCH] modules.user.chn: set git user name --- modules/user/chn/default.nix | 64 +++++++++++++++++------------------- modules/user/chn/git.nix | 1 + modules/user/default.nix | 2 +- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/modules/user/chn/default.nix b/modules/user/chn/default.nix index 43e3e750..195bae35 100644 --- a/modules/user/chn/default.nix +++ b/modules/user/chn/default.nix @@ -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" ] + )) + ) + ]; }; }; }; diff --git a/modules/user/chn/git.nix b/modules/user/chn/git.nix index 9d7b813d..83fc5d93 100644 --- a/modules/user/chn/git.nix +++ b/modules/user/chn/git.nix @@ -23,6 +23,7 @@ inputs: tlstimeout = 3600; transfer.maxretries = 1; }; + user = { name = "Haonan Chen"; email = "chn@chn.moe"; }; }; }; delta = diff --git a/modules/user/default.nix b/modules/user/default.nix index 10e34eb6..dcbb77ac 100644 --- a/modules/user/default.nix +++ b/modules/user/default.nix @@ -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 = "*"; };