!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

886 Members
179 Servers

Load older messages


SenderMessageTime
10 Oct 2023
@woobilicious:matrix.orgwoobilicious

Jez (he/him) ♾️: system looks correct, is it just impossible to switch out the global one to stable?

❯ nix registry list | grep flake:nixpkgs
system flake:nixpkgs path:/nix/store/splp4lqr6n115q125nhqk2qmg81hsk1r-source?lastModified=1694048570&narHash=sha256-PEQptwFCVaJ+jLFJgrZll2shQ9VI%2f7xVhrCYkJo8iIw=&rev=4f77ea639305f1de0a14d9d41eef83313360638c
global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable
08:54:16
@woobilicious:matrix.orgwoobiliciousI also can't figure out how to get nix-channel to follow the same commit, so I'm not randomly pulling pkgs in from a different version.08:57:09
@antifuchs:asf.computer@antifuchs:asf.computer

oh, hah, I have a snippet for this that I stole from somewhere (probably the flakes channel here or on discord):

globalNix = {
      nixpkgs,
      hostName,
      inputs,
    }: let
      lib = nixpkgs.lib;
    in {
      # Setup the registry such that the entries are pinned to the versions we pull in here.
      # That should help with reproducability of disjoint projects & with compile times, too.
      nix.registry =
        (lib.mapAttrs' (name: _v: lib.nameValuePair name {flake = inputs.${name};}) inputs)
        // {
          ${hostName}.flake = self;
          nixpkgs.flake = nixpkgs;
        };
      # Also set the nix path such that pinned versions of stuff is available as channels.
      nix.nixPath =
        (lib.mapAttrsToList (name: _v: "${name}=${inputs.${name}}") inputs)
        ++ [
          "nixpkgs=${nixpkgs}"
          "$HOME/.nix-defexpr/channels"
        ];
    };
12:52:59
@antifuchs:asf.computer@antifuchs:asf.computer(that function takes a concrete nixpkgs, a host name and the attrset of flake inputs & munges them such that all the inputs are on the flake registry & registered as channels)12:53:39
@rick:matrix.ciphernetics.nl@rick:matrix.ciphernetics.nlOh heh, I should configure that too and remove the channels that are configured on my system now15:18:35
@2xsaiko:tchncs.de@2xsaiko:tchncs.de
In reply to @antifuchs:asf.computer

oh, hah, I have a snippet for this that I stole from somewhere (probably the flakes channel here or on discord):

globalNix = {
      nixpkgs,
      hostName,
      inputs,
    }: let
      lib = nixpkgs.lib;
    in {
      # Setup the registry such that the entries are pinned to the versions we pull in here.
      # That should help with reproducability of disjoint projects & with compile times, too.
      nix.registry =
        (lib.mapAttrs' (name: _v: lib.nameValuePair name {flake = inputs.${name};}) inputs)
        // {
          ${hostName}.flake = self;
          nixpkgs.flake = nixpkgs;
        };
      # Also set the nix path such that pinned versions of stuff is available as channels.
      nix.nixPath =
        (lib.mapAttrsToList (name: _v: "${name}=${inputs.${name}}") inputs)
        ++ [
          "nixpkgs=${nixpkgs}"
          "$HOME/.nix-defexpr/channels"
        ];
    };
it is better to set nixPath to be constant, since it's an environment variable that won't update in already open applications, so you might keep using old nixpkgs
15:51:58
@2xsaiko:tchncs.de@2xsaiko:tchncs.deI set it to a fixed path and link inputs there using environment.etc instead 15:52:45
@2xsaiko:tchncs.de@2xsaiko:tchncs.dehttps://git.dblsaiko.net/systems/tree/common/defaults/system-nix.nix#n6715:53:32
@rick:matrix.ciphernetics.nl@rick:matrix.ciphernetics.nlI should probably just delete the channel and only use the registry, actually 16:55:10
@antifuchs:asf.computer@antifuchs:asf.computer 2xsaiko: didn't realize that was the case - that seems like the better solution, thanks! 16:55:39
11 Oct 2023
@madouura:matrix.orgMadoura changed their profile picture.05:35:18
@woshilapin:matrix.org@woshilapin:matrix.org left the room.19:14:34
12 Oct 2023
@erremilia:matrix.org@erremilia:matrix.org set a profile picture.00:13:14
@erremilia:matrix.org@erremilia:matrix.org removed their profile picture.00:14:44
13 Oct 2023
@ThorHop:matrix.org@ThorHop:matrix.org changed their display name from hopland (glib gary) to hopland (flaky frank).10:27:26
14 Oct 2023
@twitchy0:matrix.orgtwitchy0How do I include the latest release here as a flake input? https://github.com/pftf/RPi4/releases00:34:45
@twitchy0:matrix.orgtwitchy0seeing the following error: error: file:// URL 'file+https://github.com/pftf/RPi4/releases/download/v1.35/RPi4_UEFI_Firmware_v1.35.zip' has unexpected authority 'github.com' 00:35:45
@antifuchs:asf.computer@antifuchs:asf.computer try github:pftf/RPi4/v1.35? That'll be the source tree with the tag v1.35 19:55:44
17 Oct 2023
@marillindie:matrix.orgMarillindië joined the room.07:51:29
18 Oct 2023
@petrichor:envs.net@petrichor:envs.net

i'm trying to make a flake that tangles most of its own source from a literate org-mode file at evaluation time, but to do that it needs emacs available so it needs to know what system it's being evaluated on, and builtins.currentSystem doesn't seem to be available at the point where outputs is being evaluated. hardcoding it as nixpkgs.legacyPackages.x86_64-linux.emacs works for now, but hard-coding the system there seems fragile.

is there a better way of doing this?

08:11:06
@petrichor:envs.net@petrichor:envs.net

this is what i have working:

    outputs = inputs:
      let
        pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
        emacs = pkgs.emacsWithPackages (epkgs: [ epkgs.s epkgs.f epkgs.dash ]);
        mkSource = src: pkgs.stdenvNoCC.mkDerivation {
          name = "boxen-source";
          inherit src;

          buildPhase = ''
            ${emacs}/bin/emacs --batch --quick \
                --eval "(require 'org)" \
                --eval "(let ((org-confirm-babel-evaluate nil)) (org-babel-tangle-file \"boxen.org\"))"
          '';
          installPhase = ''
            mkdir $out
            cp -r lib packages homes modules systems files $out/
            cp boxen.org $out/
          '';
        };
        src = mkSource ./.;
      in …
08:12:14
@dunxen:x0f.orgdunxen changed their profile picture.21:16:33
19 Oct 2023
@artturin:matrix.orgArtturin
In reply to @petrichor:envs.net

this is what i have working:

    outputs = inputs:
      let
        pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
        emacs = pkgs.emacsWithPackages (epkgs: [ epkgs.s epkgs.f epkgs.dash ]);
        mkSource = src: pkgs.stdenvNoCC.mkDerivation {
          name = "boxen-source";
          inherit src;

          buildPhase = ''
            ${emacs}/bin/emacs --batch --quick \
                --eval "(require 'org)" \
                --eval "(let ((org-confirm-babel-evaluate nil)) (org-babel-tangle-file \"boxen.org\"))"
          '';
          installPhase = ''
            mkdir $out
            cp -r lib packages homes modules systems files $out/
            cp boxen.org $out/
          '';
        };
        src = mkSource ./.;
      in …
https://github.com/numtide/flake-utils the eachX functions
09:37:18
@petrichor:envs.net@petrichor:envs.net Artturin: thanks, i'm aware of this, but i still need to then instantiate this derivation while defining the flake's outputs, which requires a specific system rather than mapping over a range of possible systems 09:52:33
@petrichor:envs.net@petrichor:envs.net i've also tried pkgs = import inputs.nixpkgs { }; for line 3, but that also errors out because builtins.currentSystem isn't available 09:54:11
@petrichor:envs.net@petrichor:envs.net i think this is because currentSystem is considered impure, and flake evaluation is pure by default: i can build this by passing --impure 09:54:47
@petrichor:envs.net@petrichor:envs.net it may be that i just can't do what i want to do without --impure because it makes the flake's outputs dependent on whichever instantiation of emacs is used 09:57:44
@petrichor:envs.net@petrichor:envs.net just trying to avoid the situation where i update the literate config and forget to regenerate the actual nix files 09:58:08
@artturin:matrix.orgArtturin
In reply to @petrichor:envs.net
Artturin: thanks, i'm aware of this, but i still need to then instantiate this derivation while defining the flake's outputs, which requires a specific system rather than mapping over a range of possible systems
https://github.com/NixOS/nix/issues/3843
10:01:24
@petrichor:envs.net@petrichor:envs.netah, this has been rumbling on for years!10:15:49

Show newer messages


Back to Room ListRoom Version: 6