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 #13

Open
kloenk opened this issue Oct 28, 2020 · 5 comments
Open

Nix shell #13

kloenk opened this issue Oct 28, 2020 · 5 comments

Comments

@kloenk
Copy link

kloenk commented Oct 28, 2020

Provide a way to create a shell.nix with the same behavior as nix develop

@edolstra
Copy link
Owner

With nix develop behaviour, you mean setting the output environment variables to outputs/<name>?

@kloenk
Copy link
Author

kloenk commented Oct 28, 2020

I mostly mean installing all dependencies, and setting env variables, so make for example can build the local project via the makefile in the same folder (if it's a make project)

@zimbatm
Copy link
Contributor

zimbatm commented Oct 28, 2020

At the moment, an additional shell.nix file has to be added with the following content:

{ system ? builtins.currentSystem }:
(import ./. { src = ./.; inherit system; }).shellNix

@tobiasBora
Copy link

tobiasBora commented Nov 4, 2020

In my case I needed to put:

(
  import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
    src = builtins.fetchGit ./.;
  }
).shellNix

(the solution proposed by zimbatm gave me some errors)

However, while now I can use both nix develop and nix shell, direnv is not really successful to load my environment fully. Indeed, it does export the shell variables given in shellHook, but it does not run the echo commands (useful to provide some documentation), nor the alias command. I tried both use nix and use flake, and both fail to load the alias/echo commands (note however that alias can be replaced with a script, and that this is more portable across shells, so it is not too much of a problem for now).

@mightyiam
Copy link

Hey, I'm not finding overrideAttrs on the .shellNix. Any way around that?

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

5 participants