NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor
git clone https://git.daemon-sec.xyz/NixDaemon.git
Log | Files | Refs | README

git.nix (2685B)


      1 # modules/home/git.nix — git, from the flake (was ~/.gitconfig written by the
      2 # bootstrap script plus the dotfiles' .config/git, which is not linked).
      3 #
      4 # Identity: name, email and signing key come from modules/hosts/laptop/_identity.nix;
      5 # every commit and tag is signed with the GPG main key (modules/home/gpg.nix).
      6 # Credentials for https remotes come from gh / glab; clones use ssh anyway.
      7 # delta paints diffs (Rosé Pine, from the dotfiles' git config).
      8 { ... }:
      9 {
     10   flake.homeModules.git =
     11   { identity, ... }:
     12   {
     13     programs.git = {
     14       enable = true;
     15       signing = {
     16         key = identity.gpgFingerprint;
     17         format = "openpgp";
     18         signByDefault = true; # commit.gpgSign and tag.gpgSign
     19       };
     20       settings = {
     21         user = {
     22           inherit (identity) name email;
     23         };
     24         alias = {
     25           co = "checkout";
     26           br = "branch";
     27           ci = "commit";
     28           st = "status";
     29           lg = "log --oneline --graph --decorate -20";
     30         };
     31         init.defaultBranch = "main";
     32         pull.rebase = true;
     33         push.autoSetupRemote = true;
     34         diff = {
     35           algorithm = "histogram";
     36           colorMoved = "default";
     37           mnemonicPrefix = true;
     38         };
     39         commit.verbose = true;
     40         column.ui = "auto";
     41         branch.sort = "-committerdate";
     42         tag.sort = "-version:refname";
     43         rerere = {
     44           enabled = true;
     45           autoupdate = true;
     46         };
     47         merge.conflictstyle = "zdiff3";
     48         core = {
     49           autocrlf = "input";
     50           safecrlf = "warn";
     51         };
     52         credential = {
     53           "https://github.com".helper = "!gh auth git-credential";
     54           "https://gist.github.com".helper = "!gh auth git-credential";
     55           "https://gitlab.com".helper = "!glab auth git-credential";
     56         };
     57       };
     58     };
     59 
     60     programs.delta = {
     61       enable = true;
     62       enableGitIntegration = true;
     63       options = {
     64         navigate = true;
     65         light = false;
     66         line-numbers = true;
     67         side-by-side = false;
     68         hyperlinks = true;
     69         syntax-theme = "none";
     70         minus-style = "\"#eb6f92\" \"#26233a\"";
     71         minus-emph-style = "bold \"#eb6f92\" \"#403d52\"";
     72         plus-style = "\"#9ccfd8\" \"#26233a\"";
     73         plus-emph-style = "bold \"#31748f\" \"#403d52\"";
     74         line-numbers-minus-style = "\"#eb6f92\"";
     75         line-numbers-plus-style = "\"#31748f\"";
     76         line-numbers-zero-style = "\"#6e6a86\"";
     77         file-style = "\"#31748f\" bold";
     78         file-decoration-style = "\"#c4a7e7\" ul";
     79         hunk-header-style = "\"#eb6f92\" bold";
     80         hunk-header-decoration-style = "\"#6e6a86\" box";
     81       };
     82     };
     83   }
     84   ;
     85 }