refactor(buildClan): simplify pkgs overriding logic

This commit is contained in:
Johannes Kirschbauer
2025-04-15 16:05:57 +02:00
parent 2ceefcd44d
commit 256194575d
3 changed files with 35 additions and 85 deletions

View File

@@ -1,26 +0,0 @@
{
pkgs,
pkgsForSystem,
system,
}:
{
lib,
...
}:
{
imports = [
(
{
# For vars we need to override the system so we run vars
# generators on the machine that runs `clan vars generate`. If a
# users is using the `pkgsForSystem`, we don't set
# nixpkgs.hostPlatform it would conflict with the `nixpkgs.pkgs`
# option.
nixpkgs.hostPlatform = lib.mkIf (system != null && (pkgsForSystem system) != null) (
lib.mkForce system
);
}
// lib.optionalAttrs (pkgs != null) { nixpkgs.pkgs = lib.mkForce pkgs; }
)
];
}

View File

@@ -0,0 +1,17 @@
{
pkgs,
}:
{
lib,
...
}:
{
imports = [
({
# For vars we need to ensure that the system so we run vars generate on
# is in sync with the pkgs of the system
nixpkgs.hostPlatform = lib.mkForce pkgs.system;
nixpkgs.pkgs = lib.mkForce pkgs;
})
];
}