-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ok: nix run . -- .
-- broken NIX_UNSTABLE=1 m .
#585
Comments
I have to freeze for 2-3 days. @kamadorueda I hope you can figure it out. That might be the last missing bit for |
builtins.readDir is what's causing the problem This for instance solves the error you mention by making project-path-ls-dirs an import-from-derivation instead of the builtin: diff --git a/src/args/project-path-ls-dirs/builder.sh b/src/args/project-path-ls-dirs/builder.sh
new file mode 100644
index 0000000..a278cc5
--- /dev/null
+++ b/src/args/project-path-ls-dirs/builder.sh
@@ -0,0 +1,10 @@
+# shellcheck shell=bash
+
+function main {
+ find "${envRel}" -mindepth 1 -maxdepth 1 -type d \
+ | jq --raw-input . \
+ | jq --slurp . \
+ > "${out}"
+}
+
+main "${@}"
diff --git a/src/args/project-path-ls-dirs/default.nix b/src/args/project-path-ls-dirs/default.nix
index 0106d14..68021b6 100644
--- a/src/args/project-path-ls-dirs/default.nix
+++ b/src/args/project-path-ls-dirs/default.nix
@@ -1,13 +1,16 @@
{ __nixpkgs__
-, filterAttrs
+, makeDerivation
+, fromJsonFile
, projectPath
, ...
}:
rel:
-let
...skipping...
-let
- isDir = _: value: value == "directory";
- ls = builtins.readDir (projectPath rel);
- dirs = filterAttrs isDir ls;
- dirNames = builtins.attrNames dirs;
-in
-builtins.map builtins.unsafeDiscardStringContext dirNames
+fromJsonFile (makeDerivation {
+ builder = ./builder.sh;
+ name = "ls-dirs-${rel}";
+ env.envRel = projectPath rel;
+ searchPaths.bin = [
+ __nixpkgs__.findutils
+ __nixpkgs__.jq
+ ];
+}) but anyway after fixing this one, there is another builtins.readDir when "magically" loading the makes/ folder, as we need to list it recursively for loading each main.nix there should be easier to pass --impure to nix >= 2.4 ? I feel it too restrictive not being able to use nix the "natural" way (what you find in nix-pills/tutorials). |
I confirm with --impure all builtins.readDir work well and diff --git a/src/cli/main/__main__.py b/src/cli/main/__main__.py
index 340a0fc..d1ea014 100644
--- a/src/cli/main/__main__.py
+++ b/src/cli/main/__main__.py
@@ -153,6 +153,7 @@ def _nix_build(
*_if(NIX_STABLE and is_src_local(src), "--argstr"),
*_if(NIX_STABLE and is_src_local(src), "projectSrcMutable", src),
*_if(NIX_STABLE, "--attr", attr),
+ *_if(not NIX_STABLE, "--impure"),
*["--option", "cores", "0"],
*["--option", "narinfo-cache-negative-ttl", "1"],
*["--option", "narinfo-cache-positive-ttl", "1"], |
I don't really know what's causing this issue.
The text was updated successfully, but these errors were encountered: