!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

755 Members
149 Servers

Load older messages


SenderMessageTime
27 Apr 2025
@dramforever:matrix.orgdramforever

some packages have a hook like this or similar

preBuild = ''
  export XDG_CACHE_HOME="$(mktemp -d)"
'';
13:20:44
28 Apr 2025
@devalot:matrix.orgPeter Jones joined the room.12:43:08
@devalot:matrix.orgPeter Jones

I have a flake with a devShells.default that uses inputsFrom to create a development environment for a package. If I use nix develop it drops me into a shell with a correct phase functions (buildPhase, etc.). However, if I use nix develop --build I get unexpected errors about no makefiles and if I use nix develop --command bash -c buildPhase bash complains about no such command buildPhase.

What do I need to do in my devShells.default so that either nix develop --build or nix develop --command bash -c buildPhase works? Thanks!

12:48:32
@charlotte:vanpetegem.me@charlotte:vanpetegem.me left the room.14:31:08
@coolio:nope.chatcoolio joined the room.18:21:17
29 Apr 2025
@ortolanbunting3002:tchncs.de@ortolanbunting3002:tchncs.de left the room.01:27:50
@jethair:matrix.orgjethair (int32/i32) changed their display name from jethair to jethair (int32/i32).01:39:46
@nixx_sf:matrix.orgNixx joined the room.02:04:00
@dschodschiii_2:matrix.orgJohn hi dramforever thanks for the reply! Yes, I mean to use the sandboxing-property of nix-flakes as intended. Just to make sure, that I, as a newbie, understand correctly: sandbox=true does not have to specified anywhere for the flake to be in "sandbox-mode", right? 08:24:37
@dschodschiii_2:matrix.orgJohnokay, thanks for this hint in the right direction - it turns out that I was trying the right thing all along, only that the variable-name changed in one of the versions and therefore it did not work. Thanks ^^08:27:24
@jimalexberger:matrix.orgjimalexberger joined the room.14:05:00
@sleeves:envs.netsleeves joined the room.16:05:15
@fkouhai:matrix.orgfkouhai joined the room.16:35:34
@n8henrie:matrix.orgn8henrie joined the room.18:03:45
30 Apr 2025
@simon.brandner:envs.netŠimon Brandner Hi, how do I avoid nix develop rebuilding the environment each time? If the shell takes a lot of time to build it is super annoying for it to be done again and again... (atm I have a thing which takes about an hour - I am compiling for ARM 32bit...) 05:59:53
@simon.brandner:envs.netŠimon Brandner * Hi, how do I avoid nix develop rebuilding the environment each time? If the shell takes a lot of time to build it is super annoying for it to be done again and again... (atm I have a thing which takes about an hour - I am compiling for ARM 32bit and gcc for that takes quite a while to get built...) 06:00:16
@fkouhai:matrix.orgfkouhaiI found this https://discourse.nixos.org/t/why-is-my-nix-shell-rebuilding-every-day-solved/1552806:01:46
@simon.brandner:envs.netŠimon Brandner Should I add keep-outputs and keep-derivations into my system config or into the flake config? I am a bit confused by that... 06:14:18
@fkouhai:matrix.orgfkouhaiI'd try it out in the flake first06:38:46
@fkouhai:matrix.orgfkouhaialtho the user added it to their configuration.nix https://gitlab.com/engmark/root/-/commit/2d76e110f0e91dadcf376e8e8d7be01d14ab47cf06:40:15
@sheeldotme:matrix.orgsheeldotme yeah, thats for nixos. are you running nix develop manually Šimon Brandner ? or are you using direnv to trigger rebuilds? 14:32:37
@simon.brandner:envs.netŠimon BrandnerDo you mean I should set it system wide? I am using direnv14:33:20
@sheeldotme:matrix.orgsheeldotme nix develop --build is what you want, nix develop --command bash -c buildPhase launches a dev shell and tries to run the bash command buildPhase, it won't find it, since its an environment variable. What are the errors you get when you run --build? 14:36:16
@sheeldotme:matrix.orgsheeldotmeand you're just doing use flake in your .envrc? what does your flake look like?14:38:09
@sheeldotme:matrix.orgsheeldotme *

and you're just doing use flake in your .envrc?

what does your flake look like?

14:38:21
@simon.brandner:envs.netŠimon Brandner

Yes

Right now like so

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };
  outputs = {nixpkgs, ...}: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      crossSystem = {
        config = "armv7l-linux-gnueabihf";
      };
    };
  in {
    devShells.${system}.default = import ./nix/shell.nix {inherit pkgs;};
  };
  nixConfig = {
    extraOptions = ''
      keep-outputs = true
      keep-derivations = true
    '';
  };
}

14:38:57
@sheeldotme:matrix.orgsheeldotmeright so that nixConfig can be configured like this https://nix.dev/manual/nix/2.28/command-ref/conf-file.html or it can go in whatever flake is producing your configuration files. have you looked at caching? that might save some time. 14:42:11
@sheeldotme:matrix.orgsheeldotmeWhat are you currently doing that seems to trigger the build? I'm wondering if its in your devshell, or if something else is triggering the rebuild, without seeing the dependencies its hard to say what the issue may be.14:44:31
@simon.brandner:envs.netŠimon Brandner

The shell.nix looks like so

{pkgs, ...}:
pkgs.mkShell {
  buildInputs = [
    pkgs.glibc
    pkgs.glibc.static
  ];

  makeFlags = [
    "CC=${pkgs.stdenv.cc.targetPrefix}cc"
    "CXX=${pkgs.stdenv.cc.targetPrefix}g++"
  ];
}

14:47:49
@sheeldotme:matrix.orgsheeldotmeHmm, nothing jumping out to me What platform are you on? When exactly does the devshell rebuild? (On every activation, after specific commands, how frequently?) Are you updating flake inputs or the dependencies of your shell frequently? Is the flake lock stable?15:01:17

Show newer messages


Back to Room ListRoom Version: 6