name paths for purity, preventing double-hash store paths

https://github.com/NixOS/nix/issues/10627
This commit is contained in:
Kiara Grouwstra 2025-05-30 16:58:41 +02:00
parent ee5c2b90b7
commit 196d4e1540
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
8 changed files with 41 additions and 13 deletions

View file

@ -18,7 +18,10 @@ let
}; };
}).run }).run
{ {
src = ./.; src = builtins.path {
path = ./.;
name = "root";
};
hooks = hooks =
let let
## Add a directory here if pre-commit hooks shouldn't apply to it. ## Add a directory here if pre-commit hooks shouldn't apply to it.

View file

@ -13,7 +13,10 @@ let
"cowsay" "cowsay"
]; ];
pathToRoot = /. + (builtins.unsafeDiscardStringContext self); pathToRoot = /. + (builtins.unsafeDiscardStringContext self);
pathFromRoot = ./.; pathFromRoot = builtins.path {
path = ./.;
name = "basic";
};
in in
{ {

View file

@ -15,7 +15,10 @@ let
"pixelfed" "pixelfed"
]; ];
pathToRoot = /. + (builtins.unsafeDiscardStringContext self); pathToRoot = /. + (builtins.unsafeDiscardStringContext self);
pathFromRoot = ./.; pathFromRoot = builtins.path {
path = ./.;
name = "cli";
};
enableAcme = true; enableAcme = true;
in in
@ -57,7 +60,12 @@ in
## function calls. ## function calls.
makeTestDeployment = makeTestDeployment =
args: args:
(import ../..) (import (
builtins.path {
path = ../..;
name = "deployment";
}
))
{ {
inherit lib; inherit lib;
inherit (inputs) nixops4 nixops4-nixos; inherit (inputs) nixops4 nixops4-nixos;

View file

@ -3,11 +3,11 @@
pkgs, pkgs,
... ...
}: }:
let
inherit (builtins) toString;
in
{ {
REPO_DIR = toString ../.; REPO_DIR = builtins.path {
path = ../.;
name = "root";
};
# 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
BIN_PATH = lib.makeBinPath [ BIN_PATH = lib.makeBinPath [
# 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

View file

@ -12,9 +12,14 @@ let
with lib.fileset; with lib.fileset;
toSource { toSource {
root = ../src; root = ../src;
fileset = intersection (gitTracked ../../.) ../src; fileset = intersection (gitTracked (
builtins.path {
path = ../../.;
name = "root";
}
)) ../src;
}; };
pyproject = with lib; fromTOML pyproject-toml; pyproject = fromTOML pyproject-toml;
# TODO: define this globally # TODO: define this globally
name = "panel"; name = "panel";
# TODO: we may want this in a file so it's easier to read statically # TODO: we may want this in a file so it's easier to read statically

View file

@ -19,7 +19,10 @@ let
extraPython3Packages = extraPython3Packages =
let let
dir = toString ./.; dir = builtins.path {
path = ./.;
name = "python-packages";
};
in in
with builtins; with builtins;
listToAttrs ( listToAttrs (

View file

@ -1 +1,4 @@
(import ./. { }).shell (import (builtins.path {
path = ./.;
name = "panel";
}) { }).shell

View file

@ -1 +1,4 @@
(import ./. { }).shell (import (builtins.path {
path = ./.;
name = "root";
}) { }).shell