mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 01:55:22 +08:00
modules.user.chn: set git user name
This commit is contained in:
@@ -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" ]
|
||||
))
|
||||
)
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@ inputs:
|
||||
tlstimeout = 3600;
|
||||
transfer.maxretries = 1;
|
||||
};
|
||||
user = { name = "Haonan Chen"; email = "chn@chn.moe"; };
|
||||
};
|
||||
};
|
||||
delta =
|
||||
|
||||
@@ -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 = "*";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user