Git Product home page Git Product logo

direnv-nix-lorelei's People

Contributors

erikarvstedt avatar shajra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

direnv-nix-lorelei's Issues

"tail: cannot open '+6' for reading: No such file or directory" on mac

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))" \

| "${coreutils}/bin/tail" "+$(("$keep_last" + 1))" \

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

No handling of nix evaluation failures

When nix evaluation fails, no failure information is displayed. Instead, direnv-nix-lorelei fails with an internal error.

Reproduce

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.

direnv: error: attribute 'lorri-eval-patched' missing, at (string):1:2

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.

#4

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)

local auto_watch_eval=patched

--expr "((import ${buildSource} {}).lorri-eval-$auto_watch_eval)"

--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.

lorri-eval-patched

Implement a proper deep (Lorri-style) autodetection

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.

Ability to pass arguments to a shell file

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!

Add "installing with home-manager" to README

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
    '';
  };
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.