Skip to content

Hyphen in paths behaves strangely #89

Closed

Description

@rickynils

If the path nixos-config is set with the just the -I option, it is not picked up by nix. However, if you remove the hyphen (and adjust accordingly in nixos/default.nix), the path is picked up correctly. Look here:

$ echo '(import <nixos> {}).system' | NIX_PATH= NIXOS_CONFIG= nix-instantiate -I ~/nixos -I nixos-config=~/nixos/configuration.nix -
error: user-thrown exception: file `nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
(use `--show-trace' to show detailed location information)

$ sed -i 's/nixos-config/nixosconfig/' ~/nixos/nixos/default.nix 

$ echo '(import <nixos> {}).system' | NIX_PATH= NIXOS_CONFIG= nix-instantiate -I ~/nixos -I nixosconfig=~/nixos/configuration.nix -
warning: you did not specify `--add-root'; the result might be removed by the garbage collector
/nix/store/c6gid7rpcfb5mm68qjaj2phd5llvwb2q-nixos-0.2pre-7d59a15-999480a.drv

I have not been able to reproduce this with a simpler example, so I guess there is some additional magic in the NixOS evaluation that triggers this.

Activity

  1. edolstra commented on Jan 24, 2013

    @edolstra
    Member

    Are you sure the second one isn't using /etc/nixos/configuration.nix?

  2. rickynils commented on Jan 24, 2013

    @rickynils
    MemberAuthor

    Yes. I have no such file. And in the example above, I clear NIXOS_CONFIG. And just to be sure that the correct file is imported, I added an abort statement to ~/nixos/configuration.nix. Then I get:

    $ echo '(import <nixos> {}).system' | NIX_PATH= NIXOS_CONFIG= nix-instantiate -I ~/nixos -I nixosconfig=~/nixos/configuration.nix -
    error: evaluation aborted with the following error message: `ABORTING HERE'
    
  3. edolstra commented on Jan 24, 2013

    @edolstra
    Member

    Oh wait, I didn't see the sed command...

  4. edolstra commented on Feb 26, 2013

    @edolstra
    Member

    Hm, I'm unable to reproduce this...

  5. rickynils commented on Feb 26, 2013

    @rickynils
    MemberAuthor

    Neither can I, anymore. I'll close this issue.

  6. added a commit that references this issue on Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions