pass nix binary explicitly rather than thru PATH

This commit is contained in:
Kiara Grouwstra 2025-03-20 09:44:24 +01:00
parent 3700b6e383
commit c98663ae71
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
3 changed files with 4 additions and 4 deletions

View file

@ -8,6 +8,7 @@
}, },
}: }:
let let
inherit (pkgs) lib;
manage = pkgs.writeScriptBin "manage" '' manage = pkgs.writeScriptBin "manage" ''
exec ${pkgs.lib.getExe pkgs.python3} ${toString ./src/manage.py} $@ exec ${pkgs.lib.getExe pkgs.python3} ${toString ./src/manage.py} $@
''; '';
@ -22,7 +23,7 @@ in
env = { env = {
NPINS_DIRECTORY = toString ../npins; NPINS_DIRECTORY = toString ../npins;
# explicitly use nix, as e.g. lix does not have configurable-impure-env # explicitly use nix, as e.g. lix does not have configurable-impure-env
NIX_DIR = pkgs.nix; NIX_BIN = lib.getExe pkgs.nix;
REPO_DIR = toString ../.; REPO_DIR = toString ../.;
CREDENTIALS_DIRECTORY = builtins.toString ./.credentials; CREDENTIALS_DIRECTORY = builtins.toString ./.credentials;
DATABASE_URL = "sqlite:///${toString ./src}/db.sqlite3"; DATABASE_URL = "sqlite:///${toString ./src}/db.sqlite3";

View file

@ -193,7 +193,7 @@ if user_settings_file is not None:
# Replacing the `USER_SETTINGS_FILE` mechanism following the comment there would probably be a good thing. # Replacing the `USER_SETTINGS_FILE` mechanism following the comment there would probably be a good thing.
# a dir of nix supporting experimental feature `configurable-impure-env`. # a dir of nix supporting experimental feature `configurable-impure-env`.
nix_bin_dir=f"{env['NIX_DIR']}/bin/" nix_bin=env['NIX_BIN']
# path of the root flake to trigger nixops from, see #94. # path of the root flake to trigger nixops from, see #94.
# to deploy this should be specified, for dev just use a relative path. # to deploy this should be specified, for dev just use a relative path.
repo_dir = env["REPO_DIR"] repo_dir = env["REPO_DIR"]

View file

@ -58,12 +58,11 @@ class ConfigurationForm(LoginRequiredMixin, FormView):
# serialize back and forth now we still need to manually inject the dummy user # serialize back and forth now we still need to manually inject the dummy user
deployment = json.dumps(dummy_user | json.loads(submission)) deployment = json.dumps(dummy_user | json.loads(submission))
env = { env = {
"PATH": settings.nix_bin_dir,
# pass in form info to our deployment # pass in form info to our deployment
"DEPLOYMENT": deployment, "DEPLOYMENT": deployment,
} }
cmd = [ cmd = [
"nix", settings.nix_bin,
"develop", "develop",
# workaround to pass in info to nixops4 thru env vars, tho impure :( # workaround to pass in info to nixops4 thru env vars, tho impure :(
"--extra-experimental-features", "--extra-experimental-features",