home-manager: add signing option to git

This commit is contained in:
xinyangli 2024-01-08 15:30:02 +08:00
parent 29d7585e27
commit 45abb88221
No known key found for this signature in database
3 changed files with 52 additions and 30 deletions

View file

@ -84,11 +84,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703657526, "lastModified": 1704498488,
"narHash": "sha256-C3fQG/tasnhtfJb0cvXthMDUJ/OLgCKNLqfMuR/M+0k=", "narHash": "sha256-yINKdShHrtjdiJhov+q0s3Y3B830ujRoSbHduUNyKag=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d1d950841d230490f308f5fcf8c0d4f2bd3f24a7", "rev": "51e44a13acea71b36245e8bd8c7db53e0a3e61ee",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -104,11 +104,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703387252, "lastModified": 1704596958,
"narHash": "sha256-XKJqGj0BaEn/zyctEnkgVIh6Ba1rgTRc+UBi9EU8Y54=", "narHash": "sha256-BK3Ohsz7m8X6qVKFxDtr8KVcHipfr5hYE9PDIJevHbQ=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "f4340c1a42c38d79293ba69bfd839fbd6268a538", "rev": "f46800ac5a6e9f892fe36e50821c5d85794ecc62",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -128,11 +128,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703639874, "lastModified": 1704590722,
"narHash": "sha256-54bkJbvGRb9Wq4re5tbtbHaFSPg7wnQfgAjCvggEDZ4=", "narHash": "sha256-exh2bDwYYkdJgm5wLvpWht5bRuPigk8v4Z7l4RegX3Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-vscode-extensions", "repo": "nix-vscode-extensions",
"rev": "52061beda00305b26445dc84ca7ab8a6036685c4", "rev": "7d0eace387cf4fd2812d0791684f4befa0865512",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -166,11 +166,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1703545041, "lastModified": 1704632650,
"narHash": "sha256-nvQA+k1rSszrf4kA4eK2i/SGbzoXyoKHzzyzq/Jca1w=", "narHash": "sha256-83J/nd/NoLqo3vj0S0Ppqe8L+ijIFiGL6HNDfCCUD/Q=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "a15b6e525f5737a47b4ce28445c836996fb2ea8c", "rev": "c478b3d56969006e015e55aaece4931f3600c1b2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -182,11 +182,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1703438236, "lastModified": 1704194953,
"narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -198,11 +198,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1703351344, "lastModified": 1704290814,
"narHash": "sha256-9FEelzftkE9UaJ5nqxidaJJPEhe9TPhbypLHmc2Mysc=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7790e078f8979a9fcd543f9a47427eeaba38f268", "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -214,11 +214,11 @@
}, },
"nixpkgs-stable_2": { "nixpkgs-stable_2": {
"locked": { "locked": {
"lastModified": 1703351344, "lastModified": 1704290814,
"narHash": "sha256-9FEelzftkE9UaJ5nqxidaJJPEhe9TPhbypLHmc2Mysc=", "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7790e078f8979a9fcd543f9a47427eeaba38f268", "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -230,11 +230,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1703663873, "lastModified": 1704645857,
"narHash": "sha256-WHt475cqqOZp8+2FSZf3L6xVTQlIN8eAAVJzCeo8ydU=", "narHash": "sha256-YRFry+uleoeDKs0kr039eVCN5XSCOuUbgbyKMJRXeFY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "e65636be64a336e7110fc82cf7aab577f1ed8233", "rev": "e72bc8a4fff841c6a131fe40471e4ae401f31096",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -266,11 +266,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1703387502, "lastModified": 1704596510,
"narHash": "sha256-JnWuQmyanPtF8c5yAEFXVWzaIlMxA3EAZCh8XNvnVqE=", "narHash": "sha256-tupdwwg1WeX2hNMOQrvtyafTaTVty0QC/gQp7yaYJic=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "e523e89763ff45f0a6cf15bcb1092636b1da9ed3", "rev": "f5fbcc0f50e7fc60c4f806fa7a09abccf0826d8a",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -36,7 +36,7 @@
alacritty = { enable = true; }; alacritty = { enable = true; };
direnv = { enable = true; }; direnv = { enable = true; };
fish = { enable = true; }; fish = { enable = true; };
git = { enable = true; }; git = { enable = true; signing.enable = true; };
neovim = { enable = true; }; neovim = { enable = true; };
vscode = { enable = true; }; vscode = { enable = true; };
zellij = { enable = true; }; zellij = { enable = true; };

View file

@ -8,9 +8,20 @@ in
{ {
options.custom-hm.git = { options.custom-hm.git = {
enable = mkEnableOption "Enable git configuration"; enable = mkEnableOption "Enable git configuration";
signing = mkOption {
type = types.submodule {
options = {
enable = mkEnableOption "Git ssh signing";
keyFile = mkOption {
type = types.str;
default = "~/.ssh/id_ed25519_sk";
};
};
};
};
}; };
config = { config = {
programs.git = { programs.git = mkIf cfg.enable {
enable = true; enable = true;
delta.enable = true; delta.enable = true;
userName = "Xinyang Li"; userName = "Xinyang Li";
@ -21,6 +32,17 @@ in
d = "diff"; d = "diff";
s = "status"; s = "status";
}; };
signing = mkIf cfg.signing.enable {
signByDefault = true;
key = cfg.signing.keyFile;
};
extraConfig.user = mkIf cfg.signing.enable {
signingkey = cfg.signing.keyFile;
};
extraConfig.gpg = mkIf cfg.signing.enable {
format = "ssh";
};
}; };
}; };
} }