Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Lorri fails to setup FHS user environment #502

Open
dmayle opened this issue May 3, 2021 · 3 comments
Open

Lorri fails to setup FHS user environment #502

dmayle opened this issue May 3, 2021 · 3 comments

Comments

@dmayle
Copy link

dmayle commented May 3, 2021

Describe the bug
When using buildFHSUserEnv in shell.nix, nix-shell properly sets up an FHS user environment with /usr/lib, /lib/... etc. When using lorri with the shame shell.nix, however, it is not properly setup.

To Reproduce
Steps to reproduce the behavior:

  1. Install bazel
  2. Use git to checkout https://github.com/dmayle/nixos-bazel-userenv-example
  3. Change to the lorri subdirectory
  4. direnv allow
  5. bazel build proto/...

Expected behavior
The go library should build without errors

Metadata
lorri did not crash

$ lorri info --shell-file shell.nix
lorri version: 1.2
GC roots exist, shell_gc_root: "/home/douglas/.cache/lorri/gc_roots/081a257f0dbdd5f43a8cd34f7f43a626/gc_root/shell_gc_root"
$ uname -a
Linux nixos 5.10.22 #1-NixOS SMP Tue Mar 9 10:11:15 UTC 2021 x86_64 GNU/Linux

Additional context

@dmayle
Copy link
Author

dmayle commented May 5, 2021

It appears this is due to the architecture of direnv. buildFHSUserEnv depends on having a sub-shell in order to setup a chroot, but direnv just evaluates and updates environment variables.

@Profpatsch
Copy link
Collaborator

Profpatsch commented May 17, 2021 via email

@martsa1
Copy link

martsa1 commented Aug 19, 2022

I'm seeing this as well.

My shell.nix:

{ pkgs ? import <nixpkgs> { } }:
(pkgs.buildFHSUserEnv {
  name = "py310_fhs";
  targetPkgs = pkgs: (with pkgs; [
    gcc
    python3 
    python3Packages.pip
    python3Packages.virtualenv
    zsh
  ]);
  runScript = "zsh";
}).env

Works fine with nix-shell, seems to evaluate with lorri shell but not at all with direnv. Notably, the chroot doesn't seem active when instantiated with lorri shell but does with nix-shell.

lorri --version 
1.5.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants