shajra / direnv-nix-lorelei Goto Github PK
View Code? Open in Web Editor NEWAlternative Nix extension of Direnv
License: GNU General Public License v3.0
Alternative Nix extension of Direnv
License: GNU General Public License v3.0
Even though lorelei is using coreutil version of tail, it fails to parse command only on mac.
On linux this line works as expected.
Adding -n to before '+6' fixes the issue.
| "${coreutils}/bin/tail" -n "$(("$keep_last" + 1))" \
direnv-nix-lorelei/nix/direnv-nix-lorelei.nix
Line 368 in f3d585f
Does this error cause other issues?
Older versions of nix-shell is kept forever unless you manually delete them from gc roots, perhaps?
direnv: loading ~/test-app/.envrc
direnv: initializing cache
direnv: rebuilding with Nix
direnv: ([/nix/store/sr5kzcdn142zm473svmiijc3gxd92gfg-direnv-2.28.0/bin/direnv export bash]) is taking a while to execute. Use CTRL-C to give up.
tail: cannot open '+6' for reading: No such file or directory
direnv: watching /Users/userName/test-app/.direnv/delete_to_rebuild
direnv: watching .envrc
direnv: watching /Users/userName/test-app/nix/sources.nix
direnv: watching /Users/userName/test-app/shell.nix
direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DETERMINISTIC_BUILD +HOST_PATH +IN_LORRI_SHELL +IN_NIX_SHELL +LD +LD_DYLD_PATH +MACOSX_DEPLOYMENT_TARGET +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin +NIX_CFLAGS_COMPILE +NIX_COREFOUNDATION_RPATH +NIX_DONT_SET_RPATH +NIX_DONT_SET_RPATH_FOR_BUILD +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_IGNORE_LD_THROUGH_GCC +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_LOG_FD +NIX_NO_SELF_RPATH +NIX_STORE +NM +PATH_LOCALE +PYTHONHASHSEED +PYTHONNOUSERSITE +PYTHONPATH +RANLIB +SDKROOT +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +__darwinAllowLocalNetworking +__impureHostDeps +__propagatedImpureHostDeps +__propagatedSandboxProfile +__sandboxProfile +allowSubstitutes +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +extraClosure +gl_cv_func_getcwd_abort_bug +name +nativeBuildInputs +nobuildPhase +origArgs +origBuilder +origExtraClosure +origOutputs +origPATH +origSystem +out +outputs +patches +phases +preHook +preferLocalBuild +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH
After the fix:
direnv: loading ~/test-app/.envrc
direnv: initializing cache
direnv: rebuilding with Nix
direnv: ([/nix/store/sr5kzcdn142zm473svmiijc3gxd92gfg-direnv-2.28.0/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
direnv: allowing GC (keeping last 5): /Users/userName/test-app/.direnv/env-r25ypc2kgn0jwgjb8wqprc3xwv3sqliy
direnv: watching /Users/userName/test-app/.direnv/delete_to_rebuild
direnv: watching .envrc
direnv: watching /Users/userName/test-app/nix/sources.nix
direnv: watching /Users/userName/test-app/shell.nix
direnv: export +IN_NIX_SHELL
When nix evaluation fails, no failure information is displayed. Instead, direnv-nix-lorelei
fails with an internal error.
tmpDir=/tmp/lorelei-bug
rm -rf $tmpDir
mkdir -p $tmpDir
# Set this to the direnv-nix-lorelei src
lorelei=$(nix-build --no-out-link /path/to/src -A direnv-nix-lorelei)
cat > $tmpDir/.envrc <<EOF
. $lorelei/share/direnv-nix-lorelei/nix-lorelei.sh
use_nix_gcrooted -a
EOF
cat > $tmpDir/shell.nix <<EOF
fail
EOF
(cd $tmpDir; direnv allow; direnv exec . true)
rm -rf $tmpDir
Output
direnv: loading /tmp/lorelei-bug/.envrc
direnv: not modified: /tmp/direnv-layouts/@tmp@lorelei-bug/delete_to_rebuild
direnv: hash check invalidated cache
direnv: rebuilding with Nix
/nix/store/z1qvlavy35wanw5k54fvvfffws5bvigj-coreutils-8.31/bin/ln: failed to create symbolic link '/tmp/direnv-layouts/@tmp@lorelei-bug/env-' -> '': No such file or directory
direnv: watching /tmp/direnv-layouts/@tmp@lorelei-bug/delete_to_rebuild
direnv: watching .envrc
direnv: watching /tmp/lorelei-bug/shell.nix
Proper error message propagation will be hard to handle in an efficient streaming manner with bash.
Maybe the best workaround would be to re-run nix-build
when a failure is detected in the first run.
Alternatively, I'd be happy to see nix-lorelei
rewritten in another, more adequate language.
Stopped working after updating direnv-nix-lorelei to ba5f664 on my mac. Last version that worked on my machine is f81a6e7
I deleted my own home-manager module in my home-manager config repo and switched to the one created by you, but I guess this change is not relevant to the issue.
direnv: loading ~/my-app/.envrc
direnv: initializing cache
direnv: rebuilding with Nix
direnv: error: attribute 'lorri-eval-patched' missing, at (string):1:2
direnv: ERROR: Nix build failed
I looked into generated shell scripts to see what's happening, and found the lines possibly caused build failure.
lorri-eval-patched
no longer exists in current version of the package. (confirmed with auto completion of nix repl
)
direnv-nix-lorelei/nix/direnv-nix-lorelei.nix
Line 421 in ba5f664
--expr "((import /nix/store/ra2fzvpx1il2qyx5lcxgwx5xw0l6lnn2-source {}).lorri-eval-$auto_watch_eval)"
nix-repl> lorelei = ((import /nix/store/ra2fzvpx1il2qyx5lcxgwx5xw0l6lnn2-source {}))
nix-repl> lorelei.
lorelei.distribution lorelei.nix-project lorelei.nixpkgs
Previous version did have lorri-eval-patched
.
direnv-nix-lorelei/nix/default.nix
Line 58 in f81a6e7
To address performance, I removed a trace that was slowing evaluation times down (by patching Lorri's code in a Nix expression). But now I realize that this affects the auto-detection of files to watch.
I kind of like the idea of having both a shallow and a deep auto-detection, letting the user chose which they prefer.
The documentation of Lorelei currently states that auto-detection misses some files. I think that's still right, but I need to implement the deep algorithm (not patch Lorri) to validate that statement. It's possible my documentation is wrong in that regard.
I use "stock" nix support in direnv like this:
use nix --arg buildAll false
(which is equivalent to nix-shell --arg buildAll false
)
it looks like its not possible to pass ARGs to use_nix_gcrooted
use_nix_gcrooted --arg buildAll false
direnv: too many positional arguments
It would be really helpful if this is supported, thanks!
I'm managing my home-manager package versions with niv, using the method described here:
https://github.com/ryantm/home-manager-template
It's worth noting that direnv-nix-lorelei can also be installed with home-manager.
I prefer this method over manual method mentioned in README, because niv allows pinning package versions in a simple manner.
niv add shajra/direnv-nix-lorelei -b master -n direnv-nix-lorelei
{ ... }:
let
sources = import ./nix/sources.nix;
direnv-nix-lorelei = import sources.direnv-nix-lorelei;
in
{
home.username = "yourUserName";
home.homeDirectory = "/home/yourUserName";
home.stateVersion = "21.05";
programs.bash = {
enable = true;
};
programs.direnv = {
enable = true;
stdlib = ''
source ${direnv-nix-lorelei.direnv-nix-lorelei}/share/direnv-nix-lorelei/nix-lorelei.sh
'';
};
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.