| 20 Apr 2025 |
aleksana 🏳️⚧️ (force me to bed after 18:00 UTC) | Will it fail too eagerly for this | 15:52:24 |
Tristan Ross | Yes, I'm working on that logic right now. | 15:52:27 |
Tristan 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 |
Tristan 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 |
Tristan Ross | Aye, it integrates well with aliases. | 15:58:21 |
Tristan 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 |
Tristan Ross | This was a good idea | 15:59:14 |
aleksana 🏳️⚧️ (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 🏳️⚧️ (force me to bed after 18:00 UTC) | Didn't think of this | 16:15:48 |
Tristan Ross | Yep and it works perfectly | 16:16:14 |
aleksana 🏳️⚧️ (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 |
Tristan Ross | Yep | 16:17:18 |
Tristan Ross | zig_0_9 is actually a throw | 16:17:28 |
Tristan Ross | llvmPackages_latest isn't and it works | 16:17:42 |
Tristan Ross | You only get a throw when you consume the value | 16:17:51 |
Tristan Ross | But since we dump the value, we don't consume it | 16:18:06 |
Tristan Ross | * But since we drop the value, we don't consume it | 16:18:13 |
Tristan Ross | That also means it isn't going to eval it so it won't use much resources | 16:18:39 |
aleksana 🏳️⚧️ (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 🏳️⚧️ (force me to bed after 18:00 UTC) | The removed notice also isn't there when allowAliases = false | 16:27:34 |
aleksana 🏳️⚧️ (force me to bed after 18:00 UTC) | So it would still be an easy win | 16:28:15 |
Tristan Ross | Yeah, it just basically makes it a "not available" error lol | 16:29:06 |
Tristan Ross | I wanted to move pkgsCross to variants but it seems necessary for a good chunk of nixpkgs lol | 16:30:36 |
Alyssa Ross | Unfortunately :( | 16:31:01 |
aleksana 🏳️⚧️ (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 |
Alyssa Ross | pkgsStatic should be easy to excise though, from having looked prevoously | 16:31:18 |
Tristan Ross | A bunch of packages use it for tests, others will pull things from pkgsCross of a different system and add it in | 16:31:45 |
Tristan Ross | Take a look at pkgs/servers/http/apache-httpd/2.4.nix lol | 16:32:11 |
aleksana 🏳️⚧️ (force me to bed after 18:00 UTC) | In reply to @rosscomputerguy:matrix.org A bunch of packages use it for tests, others will pull things from pkgsCross of a different system and add it in Oh, I made hello-go | 16:32:13 |
aleksana 🏳️⚧️ (force me to bed after 18:00 UTC) | It can cross compile without bothering the whole cross toolchain | 16:32:38 |