Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-shell cannot handle src path with spaces #842

Closed
gilligan opened this issue Mar 10, 2016 · 1 comment
Closed

nix-shell cannot handle src path with spaces #842

gilligan opened this issue Mar 10, 2016 · 1 comment

Comments

@gilligan
Copy link
Contributor

with import <nixpkgs> {}; {
  testCase = stdenv.mkDerivation {
    src = ./.;
    name = "test";
  };
}

If you put this in a directory containing spaces like test case and run nix-shell:

% nix-shell
error: invalid character ‘ ’ in name ‘test case’

As a workaround I apply the following function to src

p: builtins.toPath (pkgs.stdenv.lib.escapeShellArg (toString p))

This might be related to NixOS/nixpkgs#8123

@edolstra
Copy link
Member

Yes, the base name of src must be a store-compatible name, so no spaces or other "special" characters. This is not specific to nix-shell. For nix-shell, however, you may be able to work around this by doing:

src = if lib.inNixShell then null else ./.;

But nix-build will still barf.

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

No branches or pull requests

2 participants