gitSetupHook: init (#402320)

authored by Pol Dellaiera and committed by GitHub d7546e3a 2c451107

+29
+5
nixos/doc/manual/release-notes/rl-2505.section.md
··· 665 666 - A toggle has been added under `users.users.<name>.enable` to allow toggling individual users conditionally. If set to false, the user account will not be created. 667 668 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> 669 670 ## NixOS Wiki {#sec-release-25.05-wiki}
··· 665 666 - A toggle has been added under `users.users.<name>.enable` to allow toggling individual users conditionally. If set to false, the user account will not be created. 667 668 + - New hooks were added: 669 + - `writableTmpDirAsHomeHook`: This setup hook ensures that the directory specified by the `HOME` environment variable is writable. 670 + - `addBinToPathHook`: This setup hook checks if the `bin/` directory exists in the `$out` output path and, if so, adds it to the `PATH` environment variable. 671 + - `gitSetupHook`: This setup hook sets up a valid Git configuration, including the `user.name` and `user.email` fields. 672 + 673 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> 674 675 ## NixOS Wiki {#sec-release-25.05-wiki}
+10
pkgs/by-name/gi/gitSetupHook/gitSetupHook.sh
···
··· 1 + # shellcheck shell=bash 2 + 3 + gitSetup () { 4 + GIT_CONFIG_GLOBAL=$(mktemp -t gitconfig.XXXXXX) 5 + export GIT_CONFIG_GLOBAL 6 + @gitMinimal@ config --global user.name GitSetupHook 7 + @gitMinimal@ config --global user.email GitSetupHook@nixpkgs.invalid 8 + } 9 + 10 + postHooks+=(gitSetup)
+14
pkgs/by-name/gi/gitSetupHook/package.nix
···
··· 1 + { 2 + lib, 3 + gitMinimal, 4 + makeSetupHook, 5 + }: 6 + 7 + makeSetupHook { 8 + name = "gitSetupHook"; 9 + 10 + substitutions = { 11 + gitMinimal = lib.getExe gitMinimal; 12 + }; 13 + 14 + } ./gitSetupHook.sh