!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

887 Members
179 Servers

Load older messages


SenderMessageTime
2 Dec 2023
@mao_tse-tung:matrix.orgmao_tse-tung joined the room.03:43:40
@presto8:matrix.orgpresto8 joined the room.21:07:34
@presto8:matrix.orgpresto8I have a flakes-based configuration and upgraded from nixos-23.05 to nixos-23.11. Which caused gnupg to upgrade from 2.4.0 to 2.4.1. Unfortunately gnupg 2.4.1 is not compatible with my install of emacs 29.1 for some reason. What is the recommended flakes-based method to pin a specific package, such as gnupg, to a specific version? I guess I could set up a 23.05 input, overlay that into pkgs, and then set programs.gnupg.package = 23-05-pkgs.gnupg, but wondering if there is a more direct way? 21:11:22
@presto8:matrix.orgpresto8Update, the overlay method worked out perfectly. 21:42:54
3 Dec 2023
@zoechi:matrix.orgzoechi joined the room.09:46:37
@ThorHop:matrix.org@ThorHop:matrix.org changed their display name from hopland (valorent vicky) to hopland (meticulous montesquieu).14:09:06
@antifuchs:asf.computer@antifuchs:asf.computer
In reply to @flyx:klacker.eu
can I use Nix Flakes purely as a solution for remote compiling? like, my (otherwise Nix-less) project requires me to build it on a remote machine and I have some hacky rsync-up---compile---rsync-down script which I want to replace with something more sensible, and Nix provides remote building capabilities. so if I write an impure Flake that just calls the system compiler and doesn’t use any Nix features, would this be a feasible solution for remote compiling?
one thing I do is to use nix copy instead of that rsync step; I wrote a script that automates the copy & build steps, writing the build result store address, which you can then nix copy back. It's basically your setup, but using more nix-builtin methods
15:31:49
@antifuchs:asf.computer@antifuchs:asf.computer
    runBuildOnLinux = pkgs.writeShellApplication {
      name = "run-build-on-linux";
      runtimeInputs = [pkgs.jq];
      text = ''
        target="$1"; shift
        copy_result_back="''${2:-true}"
        flake=$(nix flake metadata --json | jq -r .path)
        if [ "$(uname -s)" = "Linux" ]; then
            # nothing to do, we're on linux already
            exec nix build --json --no-link "$@" -L "$flake#$target" | jq -r '.[0].outputs.out'
            exit 0
        fi

        remote_machine="''${REMOTE_MACHINE:-gloria.home}"
        nix copy --to "ssh-ng://$remote_machine" "$flake"
        out="$(ssh "$remote_machine" nix build --json --no-link -L "$@" "$flake#$target" | jq -r '.[0].outputs.out')"
        if [ "$copy_result_back" = "true" ]; then
            nix copy --no-check-sigs --from "ssh-ng://$remote_machine" "$out"
        fi
        echo "$out"
      '';
    };

is that script

15:31:58
@antifuchs:asf.computer@antifuchs:asf.computer
In reply to @flyx:klacker.eu
can I use Nix Flakes purely as a solution for remote compiling? like, my (otherwise Nix-less) project requires me to build it on a remote machine and I have some hacky rsync-up---compile---rsync-down script which I want to replace with something more sensible, and Nix provides remote building capabilities. so if I write an impure Flake that just calls the system compiler and doesn’t use any Nix features, would this be a feasible solution for remote compiling?
* one thing I do is to use nix copy instead of that rsync step; I wrote a script that automates the copy & build steps, writing the build result store address, which it optionally nix copy'd back. It's basically your setup, but using more nix-builtin methods
15:32:44
@sporesirius:matrix.orgSporesirius joined the room.22:33:36
4 Dec 2023
@patka_123:matrix.org@patka_123:matrix.org joined the room.11:23:33
5 Dec 2023
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.00:39:05
6 Dec 2023
@glepage:matrix.orgGaétan Lepage Hi !
It seems that you can use flake-parts without clearly adding it to the inputs.
Is it somehow "contained" in nixpkgs ? I tried to grep the nixpkgs repo for flake-parts but had no result.
12:55:36
@npc_projection:matrix.orgnpc_projectionWhat makes you think you can use flake-parts without adding to inputs?13:14:37
@glepage:matrix.orgGaétan LepageI tried ^^13:15:18
@glepage:matrix.orgGaétan LepageApparently it is because it is part of the global flake registry13:15:29
@glepage:matrix.orgGaétan LepageI was not aware of its existence13:15:39
@glepage:matrix.orgGaétan Lepagehttps://github.com/NixOS/flake-registry13:16:36
7 Dec 2023
@avaq:matrix.orgAldwin

Hi! I'm finally migrating my 6 years old nixos config to Flakes! It's mostly going well but I need some help. I used to have an overlay that added nixpkgs-unstable to the nixpkgs.unstable attribute (using fetchTarball to get it). Now, I want to use a flake input instead, and I used an inline module with an overlay to have it exposed in the same place again. I'm trying to make my existing modules compatible with the Flake, so I don't have to go in and change them all.

This all seems to work, except that Nix is refusing to evaluate Unfree packages from Unstable now. It appears as though the nixpkgs.config does not apply to the unstable input the way it used to. So my question is: How do I get this second nixpkgs input to adhere to the same config as my primary one? And by "primary" I guess I mean the one used to make the lib.nixosSystem call.

09:48:32
@avaq:matrix.orgAldwin Right now, the overlay basically does { unstable = inputs.unstable.legacyPackages.x86_64-linux; }. I'm guessing this is where I should do something to inject the parent config into the unstable nixpkgs. 09:52:49
@avaq:matrix.orgAldwin Oh. Wow. I just noticed my old approach did a similar thing: unstable = import (fetchTarball url) { config = config.nixpkgs.config; }; 09:55:45
@avaq:matrix.orgAldwin But I don't know the way to refer to the config inside a Flake 09:56:20
@petrichor:envs.net@petrichor:envs.net it's not obvious, but you can literally do unstable = import inputs.unstable { config = ... } 09:58:21
@avaq:matrix.orgAldwinOh? And then there's no need to mention the system architecture? :o09:59:03
@avaq:matrix.orgAldwin And what goes in the ...? :P Because right now I also don't know where to actually grab the parent config from 09:59:48
@avaq:matrix.orgAldwin I'm also curious about how import inputs.x works. I thought input.x is an attribute set referring to the outputs of the flake you've imported. But it's also an import path referring to the source of what you've imported?! 10:03:23
@petrichor:envs.net@petrichor:envs.net i guess if you just want to allow unfree packages you can do unstable = import inputs.unstable { config.allowUnfree = true; } 10:04:19
@petrichor:envs.net@petrichor:envs.net
In reply to @avaq:matrix.org
Oh? And then there's no need to mention the system architecture? :o
not sure, i'm still figuring out this stuff too, but i think it should work because by the time overlays are being evaluated the system is already known
10:05:09
@petrichor:envs.net@petrichor:envs.net i think your overlay could look like final: prev: { unstable = import inputs.unstable { inherit (prev) system config; } but you might get away with omitting system 10:06:59
@petrichor:envs.net@petrichor:envs.net
In reply to @avaq:matrix.org
I'm also curious about how import inputs.x works. I thought input.x is an attribute set referring to the outputs of the flake you've imported. But it's also an import path referring to the source of what you've imported?!
flakes are attribute sets with _type = "flake", but when coerced to a string (builtins.toString) or a path (builtins.toPath) they resolve to the flake's store path
10:08:18

Show newer messages


Back to Room ListRoom Version: 6