From 55933ccfb3c6c5bc30ea3f15b588cec9529c68f5 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 20 Jul 2025 03:27:19 +0900 Subject: [PATCH] cmd/nix-tool: pass --store via extraArgs Sleepy me forgot about passing extraArgs :c --- cmd/nix-tool/chroot.go | 17 ----------------- cmd/nix-tool/main.go | 13 +++++++------ 2 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 cmd/nix-tool/chroot.go diff --git a/cmd/nix-tool/chroot.go b/cmd/nix-tool/chroot.go deleted file mode 100644 index 79d8f60..0000000 --- a/cmd/nix-tool/chroot.go +++ /dev/null @@ -1,17 +0,0 @@ -package main - -import ( - "context" - "os/exec" - - "gensokyo.uk/nix" -) - -type chrootStoreContext struct { - store string - nix.Context -} - -func (c *chrootStoreContext) Nix(ctx context.Context, arg ...string) *exec.Cmd { - return c.Context.Nix(ctx, append([]string{"--store", c.store}, arg...)...) -} diff --git a/cmd/nix-tool/main.go b/cmd/nix-tool/main.go index c313402..0c7b2a5 100644 --- a/cmd/nix-tool/main.go +++ b/cmd/nix-tool/main.go @@ -36,16 +36,17 @@ func main() { c := command.New(os.Stderr, log.Printf, "nix-tool", func(args []string) error { log.SetFlags(0) + var extraArgs []string + flagStore = strings.TrimSpace(flagStore) + if flagStore != string(os.PathSeparator) { + extraArgs = append(extraArgs, "--store", flagStore) + } + var stderr io.Writer if flagVerbose { stderr = os.Stderr } - ctx = nix.New(nixCtx, nil, os.Stdout, stderr) - - flagStore = strings.TrimSpace(flagStore) - if flagStore != string(os.PathSeparator) { - ctx = &chrootStoreContext{flagStore, ctx} - } + ctx = nix.New(nixCtx, extraArgs, os.Stdout, stderr) return nil }).