!VRULIdgoKmKPzJZzjj:nixos.org

Nix Hackers

899 Members
For people hacking on the Nix package manager itself188 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
8 Mar 2025
@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
@emilazy:matrix.orgemily WeetHet: btw, I suggest you use darwin-rebuild activate from the built system 18:03:34
@emilazy:matrix.orgemily (and raitobezarius too if copying it) 18:03:39
@emilazy:matrix.orgemilyit will reduce churn down the line18:03:54
@raitobezarius:matrix.orgraitobezarius
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
I think there's one place where it's actually true
18:03:57
@weethet:catgirl.cloudWeetHet
In reply to @emilazy:matrix.org
WeetHet: btw, I suggest you use darwin-rebuild activate from the built system
I'm using flakes rn due to the above said performance issues
18:04:06
@raitobezarius:matrix.orgraitobezarius Flakes are not configurable (except with that new configurable flakes features) 18:04:06
@raitobezarius:matrix.orgraitobezarius Non-Flakes are by nature already configurable via --argstr 18:04:13
@emilazy:matrix.orgemilysorry then :D18:04:13
@weethet:catgirl.cloudWeetHet
In reply to @emilazy:matrix.org
WeetHet: btw, I suggest you use darwin-rebuild activate from the built system
*
18:04:18
@raitobezarius:matrix.orgraitobezariusNon-Flakes pure evaluation cannot avoid dealing with "how do you cache in presence of configuration"18:04:26
@raitobezarius:matrix.orgraitobezariusFlakes pure eval does not need to deal with this18:04:32
@raitobezarius:matrix.orgraitobezariusThus, there's scenarios with Flakes pure eval can always beat non-Flakes pure eval by the virtue of just not having one feature (configuration) that requires more work to make cacheable18:04:52
@raitobezarius:matrix.orgraitobezarius(I mean, saying this out loud makes me realize that well, making it cacheable trivial and hash consing all the exact same set of inputs used is a way to do it)18:05:21
@weethet:catgirl.cloudWeetHetYeah my system evaluation with flakes vs without has a sizable (a second or so) difference in evaluation times18:05:32
@weethet:catgirl.cloudWeetHet * 18:05:47
@emilazy:matrix.orgemilyare we just talking about installable eval caching?18:05:48
@emilazy:matrix.orgemily the thing where foo#bar gets an evaluation result cachd? 18:05:56
@raitobezarius:matrix.orgraitobezariusyeah, I'm mostly talking about this18:05:57
@emilazy:matrix.orgemily * the thing where foo#bar gets an evaluation result cached? 18:05:58
@emilazy:matrix.orgemily because if so, WeetHet, I'm not sure you're measuring something that worthwhile for system configs 18:06:13
@emilazy:matrix.orgemilya single byte change in the flake will throw away the entire eval cache18:06:22
@raitobezarius:matrix.orgraitobezariusI agree this is a cheat but this is user visible18:06:23
@emilazy:matrix.orgemily right. well it matters for nixpkgs# for sure 18:06:30
@emilazy:matrix.orgemilyfor system configs … meh18:06:37
@weethet:catgirl.cloudWeetHetI don't know why this happened, really. It's not even evaluation catching probably since --impure evaluation is still faster18:07:20

Show newer messages


Back to Room ListRoom Version: 6