!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1518 Members
Nix programming language267 Servers

Load older messages


SenderMessageTime
19 Aug 2024
@ity:itycodes.orgTranquil ItyHow's the IO purity of Nix ?17:41:18
@ity:itycodes.orgTranquil ItyLike, as a language17:41:29
@ity:itycodes.orgTranquil Ity * Like, as a language, from within the language17:41:34
@ity:itycodes.orgTranquil ItyIk that there's IO impls but unsure how they work17:41:48
@infinisil:matrix.orginfinisil Tranquil Ity: Not really what you're asking, but https://github.com/infinisil/nix-rts :P 17:56:00
@ity:itycodes.orgTranquil ItyYaa I think you linked that before, the question is how it works ig18:02:33
20 Aug 2024
@benjaminedwardwebb:envs.netbenwebb changed their display name from benjaminedwardwebb to benwebb.12:44:18
@lgmrszd:possum.citylgmrszd changed their profile picture.18:03:54
21 Aug 2024
@sigmanificient:matrix.orgSigmanificient joined the room.00:46:32
@mauerlaeufer:matrix.org@mauerlaeufer:matrix.org left the room.12:23:12
@luna:bddvlpr.comLuna changed their display name from Luna Simons to Luna.16:22:35
@shymega:one.ems.host@shymega:one.ems.host joined the room.16:36:42
22 Aug 2024
@asmundesen:matrix.orgArtur Manuel joined the room.12:32:13
@asmundesen:matrix.orgArtur Manuel moving an issue i have been having to this channel since its more on topic here than #Nix / NixOS But i 13:06:37
@asmundesen:matrix.orgArtur Manuel moving an issue i have been having to this channel since its more on topic here than #Nix / NixOS But I recently had an issue involving a library function with mkMerge that was a consequence of not using flake-parts. 13:08:26
@asmundesen:matrix.orgArtur ManuelMy issue is that I now dont know what function I can apply to hold the place of mkMerge, and I don't think Noogle is helping much13:14:14
@asmundesen:matrix.orgArtur Manuelmy current attempted solutions (map, listToAttrs, maybe more) have all not worked14:03:10
@asmundesen:matrix.orgArtur Manuelalmost considering rewriting li14:03:26
@asmundesen:matrix.orgArtur ManuelRedacted or Malformed Event14:03:32
@asmundesen:matrix.orgArtur Manuel* almost considering rewriting my mkHost function14:04:38
@matrix:03j.de@matrix:03j.de joined the room.14:21:30
@asmundesen:matrix.orgArtur Manuel changed their profile picture.14:53:03
@benwis:matrix.org@benwis:matrix.org left the room.16:48:21
@niko:puppygock.gaynyanbinary 🏳️‍⚧️ left the room.17:19:40
@mattsturg:matrix.orgMatt Sturgeon
In reply to @asmundesen:matrix.org
moving an issue i have been having to this channel since its more on topic here than #Nix / NixOS But I recently had an issue involving a library function with mkMerge that was a consequence of not using flake-parts.

What did your implementation using mkMerge look like? What is the purpose of the function, i.e. what are you trying to achieve?

I'm sure you've worked this out by now, but mkMerge is not a general use nix function; it is only useful when working with the nixos module system.

21:51:45
@adis:blad.is@adis:blad.is I really wish stuff like mkMerge wasn't in top-level lib. It's confusing as heck. 23:28:39
23 Aug 2024
@lcavalier:matrix.orgfpf3 joined the room.00:30:24
@mattsturg:matrix.orgMatt Sturgeon

Ok, found it: https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$0WVAvACN5DN8NLuPU7hmS2ZaGKNcCYMxB1jkhb99Lqk?via=nixos.org&via=matrix.org&via=tchncs.de

Artur Manuel

Looks like you are trying to convert a list of config-spec-attrsets into an attrset of nixos configurations. Currently you're passing a list of attrs to genAttrs, which won't work because genAttrs expects a list of string; the strings are also used as the attr names.

I'd recommend having an attrset of config-sepcs instead of a list, and then using mapAttrs to convert them to actual nixos-configurations.

e.g.

let
  mkHosts = builtins.mapAttrs (name: configSpec: inputs.nixpkgs.lib.nixosSystem {
    # TODO
  });
in
nixosConfigurations = mkHosts {
  "freguson" = {
    hostname = "freguson";
    username = "amadal";
    system = "x86_64-linux";
    # etc
  };
};

However, if you don't want to do that, you'll need to use listToAttrs, after maping the list such that the elements have the form { name = "attr_name"; value = "attr_value"; } (as extected by listToAttrs).

e.g.

  builtins.listToAttrs (
    builtins.map
    (configSpec: {
      name = configSpec.hostname;
      value = inputs.nixpkgs.lib.nixosSystem {
        # TODO
      };
    })
    configSpecList
  )
01:14:01
@mattsturg:matrix.orgMatt Sturgeon *

Ok, found it: https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$0WVAvACN5DN8NLuPU7hmS2ZaGKNcCYMxB1jkhb99Lqk?via=nixos.org&via=matrix.org&via=tchncs.de

Artur Manuel

Looks like you are trying to convert a list of config-spec-attrsets into an attrset of nixos configurations. Currently you're passing a list of attrs to genAttrs, which won't work because genAttrs expects a list of string; the strings are also used as the attr names.

I'd recommend having an attrset of config-sepcs instead of a list, and then using mapAttrs to convert them to actual nixos-configurations.

e.g.

let
  mkHosts = builtins.mapAttrs (name: configSpec: inputs.nixpkgs.lib.nixosSystem {
    # TODO
  });
in
nixosConfigurations = mkHosts {
  "freguson" = {
    hostname = "freguson";
    username = "amadal";
    system = "x86_64-linux";
    # etc
  };
};

However, if you don't want to do that, you'll need to use listToAttrs, after maping the list such that the elements have the form { name = "attr_name"; value = "attr_value"; } (as expected by listToAttrs).

e.g.

  builtins.listToAttrs (
    builtins.map
    (configSpec: {
      name = configSpec.hostname;
      value = inputs.nixpkgs.lib.nixosSystem {
        # TODO
      };
    })
    configSpecList
  )
01:15:32
@mattsturg:matrix.orgMatt Sturgeon *

Ok, found it: https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$0WVAvACN5DN8NLuPU7hmS2ZaGKNcCYMxB1jkhb99Lqk?via=nixos.org&via=matrix.org&via=tchncs.de

Artur Manuel

Looks like you are trying to convert a list of config-spec-attrsets into an attrset of nixos configurations. Currently you're passing a list of attrs to genAttrs, which won't work because genAttrs expects a list of string; the strings are also used as the attr names.

I'd recommend having an attrset of config-sepcs instead of a list, and then using mapAttrs to convert them to actual nixos-configurations.

e.g.

let
  mkHosts = builtins.mapAttrs (name: configSpec: inputs.nixpkgs.lib.nixosSystem {
    # TODO
  });
in
nixosConfigurations = mkHosts {
  "freguson" = {
    hostname = "freguson";
    username = "amadal";
    system = "x86_64-linux";
    # etc
  };
};

You could also have something like this if you don't want to define the hostname twice:

  mkHosts = builtins.mapAttrs (hostname: configSpec: mkHost ({ inherit hostname; } // configSpec));

However, if you don't want to do that, you'll need to use listToAttrs, after maping the list such that the elements have the form { name = "attr_name"; value = "attr_value"; } (as expected by listToAttrs).

e.g.

  builtins.listToAttrs (
    builtins.map
    (configSpec: {
      name = configSpec.hostname;
      value = inputs.nixpkgs.lib.nixosSystem {
        # TODO
      };
    })
    configSpecList
  )
01:17:56

Show newer messages


Back to Room ListRoom Version: 6