You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.0 KiB
57 lines
1.0 KiB
# This file is controlled by /etc/dotfiles/README.org
|
|
# This module MUST be included within home manager
|
|
{ config, options, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
with lib.types;
|
|
let
|
|
cfg = config.modules.git;
|
|
|
|
# Fix any corruptions in the local copy.
|
|
myGitFix = pkgs.writeShellScriptBin "git-fix" ''
|
|
if [ -d .git/objects/ ]; then
|
|
find .git/objects/ -type f -empty | xargs rm -f
|
|
git fetch -p
|
|
git fsck --full
|
|
fi
|
|
exit 1
|
|
'';
|
|
|
|
in {
|
|
options.modules.git = {
|
|
enable = mkOption {
|
|
type = bool;
|
|
default = false;
|
|
};
|
|
|
|
name = mkOption {
|
|
type = str;
|
|
default = "Anon";
|
|
};
|
|
|
|
email = mkOption {
|
|
type = str;
|
|
default = "anon@devnull.com";
|
|
};
|
|
|
|
key = mkOption {
|
|
type = str;
|
|
default = "ABCD1234";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ myGitFix ];
|
|
|
|
programs.git = {
|
|
enable = true;
|
|
userName = cfg.name;
|
|
userEmail = cfg.email;
|
|
|
|
signing = {
|
|
key = cfg.key;
|
|
signByDefault = true;
|
|
};
|
|
};
|
|
};
|
|
}
|