install: the template as one commit, without git's dirty warning

create_config locks the template as a path (not the git repository) and
commits everything once, with the user's git identity or, without one,
a fallback passed with -c for that commit only. The template switch no
longer warns that the tree is dirty; the marker and the one-commit rule
are unchanged.
This commit is contained in:
Pierre Kisters committed 2026-10-02 00:39:50 +02:00
1 parent 82545dfdbc
commit e597c6e34b
4 files changed
+25 -7

No files matched your search

+8 -3
View File
@@ -362,11 +362,16 @@ create_config() { # dir [question]
set_let "$dir/flake.nix" system "$system"
info "user $USER_NAME, home $HOME, system $system"
# Flakes in a git repository only see tracked files.
# Locked as a path (not the git repository: no "dirty" warning), then
# one commit, since flakes in a git repository only see tracked files.
nix flake lock "path:$dir"
git_any -C "$dir" init -q
git_any -C "$dir" add -A
nix flake lock "$dir"
git_any -C "$dir" add flake.lock
local id=() # the user's git identity, else one for this commit only
git_any -C "$dir" config user.name >/dev/null || id+=(-c "user.name=$USER_NAME")
git_any -C "$dir" config user.email >/dev/null || id+=(-c "user.email=$USER_NAME@localhost")
git_any -C "$dir" "${id[@]}" -c commit.gpgsign=false commit -q --no-verify \
-m "Configuration from the steam-frame-nix template"
config_hash "$dir" >"$dir/.git/$TEMPLATE_MARK"
link_config "$dir"