Non stop entertainment! The wackiest NixOS configuration to-date. thevoid.cafe/projects/puzzlevision
nixos flake flake-parts dotfiles home-manager nix

🔧 Update git home module and automate more things through profile module

thevoid.cafe bd4c416b a90e6574

verified
+27 -9
+1 -6
homes/x86_64-linux/jo/default.nix
··· 29 29 30 30 ## CLI tools and apps 31 31 cli.direnv.enable = true; 32 - cli.git = { 33 - enable = true; 34 - enable-ssh = true; 35 - }; 32 + cli.git.enable = true; 36 33 }; 37 34 38 35 # Configuration of wakatime secret file ··· 54 51 55 52 ## RUNTIMES and CLIs for development 56 53 bun 57 - git 58 - git-credential-oauth 59 54 attic-client 60 55 61 56 ## PHP/Shopware
+26 -3
modules/home/cli/git/default.nix
··· 1 1 { 2 2 lib, 3 3 self, 4 + pkgs, 4 5 config, 5 6 ... 6 7 }: 7 8 let 8 9 inherit (lib) mkEnableOption mkIf; 9 10 inherit (self) namespace; 11 + inherit (self.lib) mkBool; 10 12 11 13 cfg = config.${namespace}.cli.git; 14 + profile = config.${namespace}.profile; 12 15 in 13 16 { 14 17 options.${namespace}.cli.git = { 15 18 enable = mkEnableOption "the git CLI."; 16 - enable-ssh = mkEnableOption "relevant git SSH features."; 19 + enableSshSigning = mkBool true "Sign commits with your configured SSH key by default."; 20 + enableCredentialOauth = mkBool true "Allow authentication via web OAuth for select git hosting providers, like GitHub, Gitea, Forgejo, Bitbucket and Gitlab."; 17 21 }; 18 22 19 23 config = mkIf cfg.enable { 20 24 programs.git = { 21 25 enable = true; 26 + package = pkgs.git; 22 27 23 - signing = mkIf cfg.enable-ssh { 28 + # Define git config file options 29 + settings = { 30 + # Set basic user information 31 + user = { 32 + name = profile.fullName; 33 + email = profile.email; 34 + }; 35 + }; 36 + 37 + # Enable signing through SSH keys 38 + signing = mkIf cfg.enableSshSigning { 24 39 format = "ssh"; 25 - key = "~/.ssh/id_ed25519"; 40 + key = profile.sshKeyFile; 26 41 signByDefault = true; 27 42 }; 28 43 }; 44 + 45 + # Add package for git OAuth support 46 + home.packages = mkIf cfg.enableCredentialOauth ( 47 + with pkgs; 48 + [ 49 + git-credential-oauth 50 + ] 51 + ); 29 52 }; 30 53 }