diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 27074eacf38a..dbc62a4edb36 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -665,6 +665,11 @@ Alongside many enhancements to NixOS modules and general system improvements, th - A toggle has been added under `users.users..enable` to allow toggling individual users conditionally. If set to false, the user account will not be created. +- New hooks were added: + - `writableTmpDirAsHomeHook`: This setup hook ensures that the directory specified by the `HOME` environment variable is writable. + - `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. + - `gitSetupHook`: This setup hook sets up a valid Git configuration, including the `user.name` and `user.email` fields. + ## NixOS Wiki {#sec-release-25.05-wiki} diff --git a/pkgs/by-name/gi/gitSetupHook/gitSetupHook.sh b/pkgs/by-name/gi/gitSetupHook/gitSetupHook.sh new file mode 100644 index 000000000000..92f56afd4970 --- /dev/null +++ b/pkgs/by-name/gi/gitSetupHook/gitSetupHook.sh @@ -0,0 +1,10 @@ +# shellcheck shell=bash + +gitSetup () { + GIT_CONFIG_GLOBAL=$(mktemp -t gitconfig.XXXXXX) + export GIT_CONFIG_GLOBAL + @gitMinimal@ config --global user.name GitSetupHook + @gitMinimal@ config --global user.email GitSetupHook@nixpkgs.invalid +} + +postHooks+=(gitSetup) diff --git a/pkgs/by-name/gi/gitSetupHook/package.nix b/pkgs/by-name/gi/gitSetupHook/package.nix new file mode 100644 index 000000000000..b03b6490366d --- /dev/null +++ b/pkgs/by-name/gi/gitSetupHook/package.nix @@ -0,0 +1,14 @@ +{ + lib, + gitMinimal, + makeSetupHook, +}: + +makeSetupHook { + name = "gitSetupHook"; + + substitutions = { + gitMinimal = lib.getExe gitMinimal; + }; + +} ./gitSetupHook.sh