!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

890 Members
179 Servers

Load older messages


SenderMessageTime
19 Feb 2024
@rhizomes:matrix.orgrhizomes joined the room.04:27:25
@mr-qubo:matrix.orgmr-qubo

I have a simple flake like this:

{
  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
    let
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      devShell = pkgs.mkShell {};
    });
}

When I do nix develop I get things like gcc, patchelf, file, etc. in my PATH. I don't want that, anyone knows where does that come from and how can I get rid of that?

16:32:17
@philiptaron:matrix.org@philiptaron:matrix.org mr-qubo: that is the nixpkgs stdenv. 16:34:27
@philiptaron:matrix.org@philiptaron:matrix.orghttps://nixos.org/manual/nixpkgs/stable/#part-stdenv16:35:06
@philiptaron:matrix.org@philiptaron:matrix.orgAre you looking for a shell with just... bash?16:35:20
@mr-qubo:matrix.orgmr-qubo
In reply to @philiptaron:matrix.org
Are you looking for a shell with just... bash?
That's just an example, I want some packages in this shell, but I don't want this stdenv. No idea why it's there in the first place.
16:37:38
@philiptaron:matrix.org@philiptaron:matrix.org

It's coming from pkgs.mkShell.

To read how that happens, open up pkgs/top-level/all-packages.nix, find mkShell. That gets you to pkgs/build-support/mkshell/default.nix.

Inside pkgs/build-support/mkshell/default.nix, note how the return value is stdenv.mkDerivation. (that stdenv is the key).

Consider also mkShellNoCC for your use case. Note how that definition in pkgs/top-level/all-packages.nix does this:

mkShellNoCC = mkShell.override { stdenv = stdenvNoCC; };

You can do similarly to override the stdenv with whatever's appropriate for your usecase.

16:50:23
@mr-qubo:matrix.orgmr-quboThanks, that's very helpful!16:54:12
@bitraten:matrix.orgbitraten joined the room.19:27:19
@mr-qubo:matrix.orgmr-qubo
In reply to @mr-qubo:matrix.org
When I do e.g. nix shell 'nixpkgs#htop' only htop is added to path. But if I create flake with devShell and htop in buildInputs, and use nix develop dependencies are added into the PATH as well, like with nix-shell -p htop. Is it possible to have this work as nix shell?
Also, as a second question, is it possible to group multiple packages and link all bins in one path, so only one entry in PATH is added instead of separate entry for each package?
I switched to https://devenv.sh/. It fixes my problem with unwanted packages in PATH and automatically uses buildEnv to create single PATH entry for all packages.
20:05:55
20 Feb 2024
@sofo:matrix.org@sofo:matrix.org changed their display name from Sofi to Sofie.07:39:15
@sofo:matrix.org@sofo:matrix.org changed their profile picture.14:39:08
@sofo:matrix.org@sofo:matrix.org changed their profile picture.14:41:41
@sofo:matrix.org@sofo:matrix.org changed their profile picture.14:42:46
@sofo:matrix.org@sofo:matrix.org changed their profile picture.14:44:03
@duffyduke:matrix.orgduffyduke joined the room.21:30:17
22 Feb 2024
@atakan:atkn.me@atakan:atkn.me joined the room.03:10:03
@hx-markus:matrix.orghx-markus joined the room.12:25:43
26 Feb 2024
@maribox:matrix.orgmaribox joined the room.14:34:09
@maribox:matrix.orgmariboximage.png
Download image.png
14:40:27
@maribox:matrix.orgmariboxHey! I added flakes as an experimental feature in my configuration.nix but I got the error in the image. After I removed the experimental-features line I still get the same error when running nixos-rebuild switch, even though there's no mention of flakes in the configuration.nix file. I'm a super noob, what am I missing here?14:41:58
@maribox:matrix.orgmariboxAlso when I load an older version of my OS, even the first one, the same Error appears, even though I just added the flakes line in the last rebuild...14:46:09
@2xsaiko:tchncs.de@2xsaiko:tchncs.de
In reply to @maribox:matrix.org
sent an image.
it loads /etc/nixos/flake.nix instead of configuration.nix if it exists
14:49:12
@2xsaiko:tchncs.de@2xsaiko:tchncs.derename/remove it14:49:23
@2xsaiko:tchncs.de@2xsaiko:tchncs.de(it has nothing to do with whether the experimental option is enabled, but purely with the existence of the file)14:50:22
@maribox:matrix.orgmariboxthanks!14:50:59
27 Feb 2024
@bryan.bennett:matrix.orgBryan

(We've been having a similar discussion on a nix-direnv issue lately, so if you're stessaris on github and this is a reiteration - I apologize :) )

This is due to the way you're entering the shell and what nix develop does vs nix shell. You'd also find that things like libraries are not always accessible in nix shell invocations, since it effectively brings in only certain environment variables like PATH and excludes bringing in others like OCAMLPATH or PKG_CONFIG_PATH. The environment gets "dirty" but it is because Nix is actually trying to help...

13:24:55
@hhefesto:matrix.orgDaniel Herrera Rendón joined the room.20:48:06
28 Feb 2024
@ethan2:matrix.orgethan2 joined the room.16:51:44
@atakan:atkn.me@atakan:atkn.me left the room.18:18:00

Show newer messages


Back to Room ListRoom Version: 6