devshell: Accept flake config in build-n-switch

Pass `--accept-flake-config` explicitly because `doas` drops the
devshell configuration that enables it. This avoids prompts for the
flake’s binary cache settings when rebuilding as root.
This commit is contained in:
2026-10-31 15:19:14 +00:00
parent 967faad269
commit 20ac77d8a0
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ see its help, or browse `devshell/commands.nix` / `devshell/install.nix` / `devs
Common ones: Common ones:
- `fmt` — format Nix with `nixpkgs-fmt` (the canonical formatter here). - `fmt` — format Nix with `nixpkgs-fmt` (the canonical formatter here).
- `build-system <host> [nix args]` — build a NixOS system's `toplevel`. - `build-system <host> [nix args]` — build a NixOS system's `toplevel`.
- `build-n-switch <args>` — wraps `doas nixos-rebuild --flake .`. - `build-n-switch <args>` — wraps `doas nixos-rebuild --accept-flake-config --flake .`.
- `build-home <name>` / `home-switch` — build / switch a home-manager config. - `build-home <name>` / `home-switch` — build / switch a home-manager config.
- `run-vm <host>` — build & boot a system as a dev VM (installs `.keys/dev.key` into the VM). - `run-vm <host>` — build & boot a system as a dev VM (installs `.keys/dev.key` into the VM).
- `build-iso` / `build-kexec` / `build-netboot <host>` — alternate build outputs via `config.my.buildAs.*`. - `build-iso` / `build-kexec` / `build-netboot <host>` — alternate build outputs via `config.my.buildAs.*`.
+2 -1
View File
@@ -106,7 +106,8 @@ in
# HACK: Upstream changes in Git + Nix makes this necessary # HACK: Upstream changes in Git + Nix makes this necessary
# https://github.com/NixOS/nix/issues/10202 # https://github.com/NixOS/nix/issues/10202
doas git config --global --add safe.directory "$PWD" doas git config --global --add safe.directory "$PWD"
doas nixos-rebuild --flake . "$@" # doas drops the devshell's NIX_USER_CONF_FILES, including accept-flake-config.
doas nixos-rebuild --accept-flake-config --flake . "$@"
''; '';
} }
{ {
+1 -1
View File
@@ -82,7 +82,7 @@ command with no arguments for its help. From
|---|---| |---|---|
| `check-system <host> [nix args]` | Evaluates `.#nixosConfigurations."<host>".config.system.build.toplevel.drvPath` — catches module/option errors without building. Prefer this to validate a config change. | | `check-system <host> [nix args]` | Evaluates `.#nixosConfigurations."<host>".config.system.build.toplevel.drvPath` — catches module/option errors without building. Prefer this to validate a config change. |
| `build-system <host> [nix args]` | Builds the system's `toplevel` (extra args pass through to `nix build`). | | `build-system <host> [nix args]` | Builds the system's `toplevel` (extra args pass through to `nix build`). |
| `build-n-switch <args>` | `doas nixos-rebuild --flake .` (adds the repo as a git `safe.directory` for root first). | | `build-n-switch <args>` | `doas nixos-rebuild --accept-flake-config --flake .` (accepts the flake's cache settings and adds the repo as a git `safe.directory` for root first). |
| `build-home <name> [nix args]` | Builds `.#homeConfigurations."<name>".activationPackage`. | | `build-home <name> [nix args]` | Builds `.#homeConfigurations."<name>".activationPackage`. |
| `home-switch [args]` | `home-manager switch --flake .`. | | `home-switch [args]` | `home-manager switch --flake .`. |
| `deploy [args]` | `deploy-rs --skip-checks` (wrapper package in `devshell/default.nix`). | | `deploy [args]` | `deploy-rs --skip-checks` (wrapper package in `devshell/default.nix`). |