Skip to content

Does the shell evaluation rely on NIX_PATH internally? #15

@mainrs

Description

@mainrs

I am using nilla on a non-nixos system. I followed the guidance posted in #5 to configure a standalone home-manager configuration under the output systems.home.username@host.result.config.home.activationPackage`.

I wanted to add a shell to my nilla.nix file to have npins and nilla-cli available:

# nilla.nix
let
  pins = import ./npins;

  nilla = import pins.nilla;
in
nilla.create ({ config }:
let
  loaders = {
    home-manager = "flake";
  };

  settings = {
    nixpkgs = {
      configuration = {
        allowUnfree = true;
      };
    };

    nixpkgs-unstable = settings.nixpkgs;
  };
in
{
  includes = [
    ./nilla
    "${pins.nilla-nixos}/modules/nixos.nix"
  ];

  config = {
    # Generate inputs from npins dependencies.
    inputs = builtins.mapAttrs
      (name: pin: {
        src = pin;

        loader = loaders.${name} or (config.lib.modules.never { });
        settings = settings.${name} or (config.lib.modules.never { });
      })
      pins;

    # Generate home-manager configurations.
    generators.home = {
      username = "me";
      folder = ./homes;
      args.inputs = config.inputs;
      modules = [
        ./nilla/modules/home
      ];
    };

    # Default shell for config development.
    shells.default = {
      systems = [ "x86_64-linux" ];

      shell = {
        mkShell,
        npins,
        ...
      }:
        mkShell {
          packages = [
            npins
          ];
      };
    };
  };
})

I get the following error when running nix run github:nilla-nix/cli shell -- -v --show-eval-commands:

🍦 Nilla  INFO  Entering shell default
🍦 Nilla  DEBUG  Running nix-shell:
nix-shell /nix/store/yb8l5zf9r4x2qndjdr9bv57c6ngrs7v4-source/nilla.nix --system x86_64-linux -A shells."default".result."x86_64-linux"
🍦 Nilla  DEBUG  Replacing process with nix-shell shells."default".result."x86_64-linux"
warning: Ignoring the client-specified setting 'system', because it is a restricted setting and you are not a trusted user
fetching git input 'git+https://github.com/nilla-nix/nilla'
fetching git input 'git+https://git.auxolotl.org/auxolotl/lib.git'
fetching git input 'git+https://github.com/nilla-nix/nixos'
fetching git input 'git+https://git.lix.systems/lix-project/nixos-module.git'
fetching git input 'git+https://github.com/nilla-nix/cli'
fetching git input 'git+https://github.com/nixos/nixpkgs'
error:
       … while evaluating '(import (__findFile __nixPath "nixpkgs") { })' to select 'bashInteractive' on it
         at «string»:1:1:
            1| (import <nixpkgs> {}).bashInteractive
             | ^

       … while calling the 'import' builtin
         at «string»:1:2:
            1| (import <nixpkgs> {}).bashInteractive
             |  ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
will use bash from your environment
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

The problem is that the npins binary is also not available inside the new shell. I am entering the shell though:

$ echo $IN_NIX_SHELL
impure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions