!OqhvaDMJdKYUicLDiE:nixos.org

Nixpkgs Stdenv

225 Members
73 Servers

Load older messages


SenderMessageTime
20 Apr 2025
@rosscomputerguy:matrix.orgTristan RossSo what we can do is "fake-import" it15:48:03
@rosscomputerguy:matrix.orgTristan Ross

I tested in repl and got this:

nix-repl> builtins.attrNames (import ./pkgs/top-level/variants.nix { nixpkgsFun = import ./.; lib = pkgs.lib; stdenv = pkgs.stdenv; overlays = pkgs.overlays; makeMuslParsedPlatform = null; } pkgs pkgs)
[
  "pkgsArocc"
  "pkgsExtraHardening"
  "pkgsLLVM"
  "pkgsLLVMLibc"
  "pkgsMusl"
  "pkgsRocm"
  "pkgsZig"
]
15:48:46
@rosscomputerguy:matrix.orgTristan Ross With this, we can map the names and throw an error saying that config.allowVariants need to be enabled. 15:49:18
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) Can we use some = allow: builtins.mapAttrs (k: v: if allow then v else throw "not allowed") { a = 1; } 15:52:04
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)Will it fail too eagerly for this15:52:24
@rosscomputerguy:matrix.orgTristan RossYes, I'm working on that logic right now.15:52:27
@rosscomputerguy:matrix.orgTristan Ross
  mkOptionalOverlay =
    {
      configOption,
      type,
      overlay,
    }:
    self: super:
    let
      pkgs = overlay self super;
    in
    if config."${configOption}" then
      pkgs
    else
      lib.mapAttrs (
        name: _: throw "${name} ${type} is not available, please enable config.${configOption}"
      ) pkgs;
15:55:32
@rosscomputerguy:matrix.orgTristan Ross
nix-repl> pkgs.pkgsLLVM
error:
       … while calling the 'throw' builtin
         at /home/ross/nixpkgs/pkgs/top-level/stage.nix:206:18:
          205|       lib.mapAttrs (
          206|         name: _: throw "${name} ${type} is not available, please enable config.${configOption}"
             |                  ^
          207|       ) pkgs;

       error: pkgsLLVM nixpkgs variant is not available, please enable config.allowVariants
15:55:53
@rosscomputerguy:matrix.orgTristan RossAye, it integrates well with aliases.15:58:21
@rosscomputerguy:matrix.orgTristan Ross
nix-repl> pkgs.zig_0_9
error:
       … while calling the 'throw' builtin
         at /home/ross/nixpkgs/pkgs/top-level/stage.nix:206:18:
          205|       lib.mapAttrs (
          206|         name: _: throw "${name} ${type} is not available, please enable config.${configOption}"
             |                  ^
          207|       ) pkgs;

       error: zig_0_9 package is not available, please enable config.allowAliases
15:58:39
@rosscomputerguy:matrix.orgTristan RossThis was a good idea15:59:14
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @rosscomputerguy:matrix.org
  mkOptionalOverlay =
    {
      configOption,
      type,
      overlay,
    }:
    self: super:
    let
      pkgs = overlay self super;
    in
    if config."${configOption}" then
      pkgs
    else
      lib.mapAttrs (
        name: _: throw "${name} ${type} is not available, please enable config.${configOption}"
      ) pkgs;
Wow, just an overlay
16:15:42
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)Didn't think of this16:15:48
@rosscomputerguy:matrix.orgTristan RossYep and it works perfectly16:16:14
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @rosscomputerguy:matrix.org
nix-repl> pkgs.zig_0_9
error:
       … while calling the 'throw' builtin
         at /home/ross/nixpkgs/pkgs/top-level/stage.nix:206:18:
          205|       lib.mapAttrs (
          206|         name: _: throw "${name} ${type} is not available, please enable config.${configOption}"
             |                  ^
          207|       ) pkgs;

       error: zig_0_9 package is not available, please enable config.allowAliases
Does this override already existed throws?
16:17:09
@rosscomputerguy:matrix.orgTristan RossYep16:17:18
@rosscomputerguy:matrix.orgTristan Rosszig_0_9 is actually a throw16:17:28
@rosscomputerguy:matrix.orgTristan RossllvmPackages_latest isn't and it works16:17:42
@rosscomputerguy:matrix.orgTristan RossYou only get a throw when you consume the value16:17:51
@rosscomputerguy:matrix.orgTristan RossBut since we dump the value, we don't consume it16:18:06
@rosscomputerguy:matrix.orgTristan Ross* But since we drop the value, we don't consume it16:18:13
@rosscomputerguy:matrix.orgTristan RossThat also means it isn't going to eval it so it won't use much resources16:18:39
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @aleksana:mozilla.org
Does this override already existed throws?
Just realized this doesn't change the current behavior
16:27:04
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)The removed notice also isn't there when allowAliases = false16:27:34
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)So it would still be an easy win16:28:15
@rosscomputerguy:matrix.orgTristan RossYeah, it just basically makes it a "not available" error lol16:29:06
@rosscomputerguy:matrix.orgTristan Ross I wanted to move pkgsCross to variants but it seems necessary for a good chunk of nixpkgs lol 16:30:36
@qyliss:fairydust.spaceAlyssa RossUnfortunately :(16:31:01
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @rosscomputerguy:matrix.org
I wanted to move pkgsCross to variants but it seems necessary for a good chunk of nixpkgs lol
What is it used for?
16:31:11
@qyliss:fairydust.spaceAlyssa RosspkgsStatic should be easy to excise though, from having looked prevoously16:31:18

Show newer messages


Back to Room ListRoom Version: 9