!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

909 Members
For people hacking on the Nix package manager itself190 Servers

Load older messages


SenderMessageTime
6 Mar 2025
@maikelfrias:matrix.org@maikelfrias:matrix.org left the room.02:36:01
@elvishjerricco:matrix.orgElvishJerriccoI'm going to make this comment here because I think it is one of the most important things I've said in the world of NixOS. Please read this comment: https://discourse.nixos.org/t/determinate-nix-3-0/61202/5721:33:50
7 Mar 2025
@qyriad:katesiria.orgQyriad changed their display name from Qyriad to qyriad.16:03:20
8 Mar 2025
@colgrave34:pendora.ioColgrave joined the room.03:22:45
@fzakaria:one.ems.hostfzakariaTrying to figure out dynamic derivations; I'd appreciate some tips06:07:58
@fzakaria:one.ems.hostfzakariaHitting some weird road blocks with what I think would work.06:08:14
@fzakaria:one.ems.hostfzakaria

Like:

warning: Ignoring dynamic derivation /nix/store/8apg4x2xbcx83xc0p1jk1qdiihkmhjyg-hello-2.12.1.drv.drv^out while querying missing paths; not yet implemented
error: Building dynamic derivations in one shot is not yet implemented.
06:08:22
@tomberek:matrix.orgtomberekYou might need a wrapping drv for now. 06:20:45
@fzakaria:one.ems.hostfzakariaHere is my strawman https://pastebin.com/wnHmj4pW06:46:30
@fzakaria:one.ems.hostfzakariai think it's a wrapping drv?06:46:36
@adeci:matrix.org. joined the room.07:01:28
@ncfavier:matrix.orgncfavier changed their profile picture.10:43:32
@jacek:poz.petdeprecated, moved to @poz:poz.pet joined the room.12:27:30
@jacek:poz.petdeprecated, moved to @poz:poz.pethey, I added the modulo operator to nix: https://github.com/NixOS/nix/pull/12617 I'd be grateful for any reviews, likes under the PR or advice on how to get it merged quick (I've seen a lot of PRs be untouched for a long time and I'm not hopeful for mine)12:36:10
@TuXic:matrix.orgTuXic joined the room.13:49:09
@colgrave34:pendora.ioColgrave left the room.16:46:35
@weethet:catgirl.cloudWeetHet

https://discourse.nixos.org/t/determinate-nix-3-0/61202/80

Pure eval doesn’t exist outside of flakes (unfortunately), that flag is more or less a broken promise.

I wonder what was meant by that? Does it mean that nix-build --pure-eval doesn't actually perform evaluation purely?

17:55:04
@weethet:catgirl.cloudWeetHet I don't think you can break evaluation purity with pure-eval 17:55:47
@weethet:catgirl.cloudWeetHet

And it's not like it's that difficult to use, I've ran nix darwin using this script for a couple of months just fine

{ pkgs ? import <nixpkgs> { }
, writeShellScriptBin ? pkgs.writeScriptBin
, directory
, ...
}:
writeShellScriptBin "darwin-rebuild-npins" ''
  set -eo pipefail

  pushd ${directory} > /dev/null

  echo "building the system configuration..."
  system=$(nix-instantiate --eval --expr builtins.currentSystem | tr -d \")
  systemConfig=$(nix-build --pure-eval --no-out-link --argstr system $system --argstr name $(hostname) --expr "import (
    builtins.path {
      path = \"$(pwd)\";
      sha256 = \"$(nix-hash --type sha256 --base32 .)\";
    }
  )" | tee /dev/tty)

  profile=/nix/var/nix/profiles/system

  if [ "$USER" != root ] && [ ! -w $(dirname "$profile") ]; then
    sudo nix-env -p "$profile" --set "$systemConfig"
  else
    nix-env -p "$profile" --set "$systemConfig"
  fi

  "$systemConfig/activate-user"
  if [ "$USER" != root ]; then
    sudo "$systemConfig/activate"
  else
    "$systemConfig/activate"
  fi

  popd > /dev/null
''
17:57:44
@emilazy:matrix.orgemilya lot of things that user posts are wrong. you do have to copy your sources with pure eval though, which sort of reduces to being flakes in many ways people care about17:57:56
@weethet:catgirl.cloudWeetHet
In reply to @emilazy:matrix.org
a lot of things that user posts are wrong. you do have to copy your sources with pure eval though, which sort of reduces to being flakes in many ways people care about

Needing to copy sources is unfortunate, sure, but seeing as flakes also do that anyways, shouldn't matter much

And this approach doesn't require any changes to be done to the cppnix source code

18:00:43
@raitobezarius:matrix.orgraitobezarius"needing to copy sources" is not an absolute need, I think, no?18:01:30
@raitobezarius:matrix.orgraitobezariuslazy trees is exactly about removing that requirement18:01:35
@raitobezarius:matrix.orgraitobezariusmore generally, the problem of purity in presence of sources is the one of installing a virtual filesystem layer18:01:55
@emilazy:matrix.orgemilyI think "you have to write your own deployment thing and it has to have the main thing people hate about the flakes UX" is not insignificant18:02:43
@raitobezarius:matrix.orgraitobezariusi'm gonna steal this, thank you18:02:47
@weethet:catgirl.cloudWeetHet
In reply to @raitobezarius:matrix.org
lazy trees is exactly about removing that requirement
Absolutely, but again, that's kinda detached from the flakes as builtins.path can also absolutely be made lazy
18:02:51
@raitobezarius:matrix.orgraitobezarius
In reply to @weethet:catgirl.cloud

And it's not like it's that difficult to use, I've ran nix darwin using this script for a couple of months just fine

{ pkgs ? import <nixpkgs> { }
, writeShellScriptBin ? pkgs.writeScriptBin
, directory
, ...
}:
writeShellScriptBin "darwin-rebuild-npins" ''
  set -eo pipefail

  pushd ${directory} > /dev/null

  echo "building the system configuration..."
  system=$(nix-instantiate --eval --expr builtins.currentSystem | tr -d \")
  systemConfig=$(nix-build --pure-eval --no-out-link --argstr system $system --argstr name $(hostname) --expr "import (
    builtins.path {
      path = \"$(pwd)\";
      sha256 = \"$(nix-hash --type sha256 --base32 .)\";
    }
  )" | tee /dev/tty)

  profile=/nix/var/nix/profiles/system

  if [ "$USER" != root ] && [ ! -w $(dirname "$profile") ]; then
    sudo nix-env -p "$profile" --set "$systemConfig"
  else
    nix-env -p "$profile" --set "$systemConfig"
  fi

  "$systemConfig/activate-user"
  if [ "$USER" != root ]; then
    sudo "$systemConfig/activate"
  else
    "$systemConfig/activate"
  fi

  popd > /dev/null
''
this I meant ^
18:02:55
@emilazy:matrix.orgemilythere's also some talk that maybe some eval perf improvements only apply to flakes but not non-flakes pure eval, though I find that claim dubious without substantiation18:03:00
@weethet:catgirl.cloudWeetHet
In reply to @emilazy:matrix.org
there's also some talk that maybe some eval perf improvements only apply to flakes but not non-flakes pure eval, though I find that claim dubious without substantiation
It's me saying that and I observed that directly
18:03:31

Show newer messages


Back to Room ListRoom Version: 6