Nix shell #13

Open
opened 2020-10-28 13:49:31 +00:00 by Kloenk · 5 comments
Kloenk commented 2020-10-28 13:49:31 +00:00 (Migrated from github.com)

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

Provide a way to create a shell.nix with the same behavior as nix develop
edolstra commented 2020-10-28 14:09:54 +00:00 (Migrated from github.com)

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

With `nix develop` behaviour, you mean setting the output environment variables to `outputs/<name>`?
Kloenk commented 2020-10-28 14:38:58 +00:00 (Migrated from github.com)

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)

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 commented 2020-10-28 15:27:26 +00:00 (Migrated from github.com)

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

{ system ? builtins.currentSystem }:
(import ./. { src = ./.; inherit system; }).shellNix
At the moment, an additional `shell.nix` file has to be added with the following content: ```nix { system ? builtins.currentSystem }: (import ./. { src = ./.; inherit system; }).shellNix ```
tobiasBora commented 2020-11-04 14:49:33 +00:00 (Migrated from github.com)

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).

In my case I needed to put: ```nix ( 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 commented 2023-07-20 15:27:59 +00:00 (Migrated from github.com)

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

Hey, I'm not finding `overrideAttrs` on the `.shellNix`. Any way around that?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/flake-compat#13
No description provided.