Skip to content

Commit

Permalink
splice.nix: Handle maybe throw sets
Browse files Browse the repository at this point in the history
The [mash](https://www.github.com/NixOS/nixpkgs/blob/86fcbea3f26cf17e4d6560ec722f3ca893053a89/pkgs/top-level/splice.nix#L32)
will trigger the throw in `pkgsBuildX` in the [recursive `spliceReal`](https://www.github.com/NixOS/nixpkgs/blob/a4b5e0bb8f309fb1623d8e619c1610df75761c12/pkgs/top-level/splice.nix#L82).

Fixes

```sh
$ nix eval --impure --expr '(import ./. { localSystem.system = "aarch64-linux"; crossSystem.system = "x86_64-linux"; config.allowUnfree = true; }).steam'
«error: i686 Linux package set can only be used with the x86 family.»
```

```
$ nix repl --file . --system aarch64-linux
nix-repl> :p pkgsCross.gnu64.__splicedPackages.pkgsi686Linux.bash.__spliced
{
  hostHost = «derivation /nix/store/0w1mahsn6biqmasm5vg85a9lh5rvyr9j-bash-i686-unknown-linux-gnu-5.2p37.drv»;
  hostTarget = «repeated»;
}
```

Alternatively `pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix` could change all `pkgsi686Linux` to `pkgsHostTarget.pkgsi686Linux`.
  • Loading branch information
Artturin committed Nov 30, 2024
1 parent 5342960 commit 0278d4d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkgs/top-level/splice.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,21 @@ let
, pkgsHostHost
, pkgsHostTarget
, pkgsTargetTarget
}:
}@args:
let
tryGetAttrs = value0:
let
inherit (builtins.tryEval value0) success value;
in
lib.optionalAttrs success value;

pkgsBuildBuild = tryGetAttrs args.pkgsBuildBuild;
pkgsBuildHost = tryGetAttrs args.pkgsBuildHost;
pkgsBuildTarget = tryGetAttrs args.pkgsBuildTarget;
pkgsHostHost = tryGetAttrs args.pkgsHostHost;
pkgsHostTarget = tryGetAttrs args.pkgsHostTarget;
pkgsTargetTarget = tryGetAttrs args.pkgsTargetTarget;

mash =
# Other pkgs sets
pkgsBuildBuild // pkgsBuildTarget // pkgsHostHost // pkgsTargetTarget
Expand Down

0 comments on commit 0278d4d

Please sign in to comment.