I showed you my source code, pls respond
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

3 years ago
  1. # This file is controlled by /etc/dotfiles/README.org
  2. # This module MUST be included within home manager
  3. { config, options, lib, pkgs, ... }:
  4. with lib;
  5. with lib.types;
  6. let
  7. cfg = config.modules.git;
  8. # Fix any corruptions in the local copy.
  9. myGitFix = pkgs.writeShellScriptBin "git-fix" ''
  10. if [ -d .git/objects/ ]; then
  11. find .git/objects/ -type f -empty | xargs rm -f
  12. git fetch -p
  13. git fsck --full
  14. fi
  15. exit 1
  16. '';
  17. in {
  18. options.modules.git = {
  19. enable = mkOption {
  20. type = bool;
  21. default = false;
  22. };
  23. name = mkOption {
  24. type = str;
  25. default = "Anon";
  26. };
  27. email = mkOption {
  28. type = str;
  29. default = "anon@devnull.com";
  30. };
  31. key = mkOption {
  32. type = str;
  33. default = "ABCD1234";
  34. };
  35. };
  36. config = mkIf cfg.enable {
  37. home.packages = [ myGitFix ];
  38. programs.git = {
  39. enable = true;
  40. userName = cfg.name;
  41. userEmail = cfg.email;
  42. signing = {
  43. key = cfg.key;
  44. signByDefault = true;
  45. };
  46. };
  47. };
  48. }