1
1
forked from extern/flakelight

Remove checking of meta.platforms

Previously, meta.platforms would be checked for each package when
generating package attributes for a system, so that unsupported packages
would not have an output attribute. This commit removes that behavior.

Now `nix flake show` will succeed even if packages fail to evaluate on
other platforms. `nix flake show --all-systems` will still fail though.
This commit is contained in:
Archit Gupta 2024-03-24 14:23:41 -07:00
parent fe5916eb40
commit 3a364f9cdd
3 changed files with 6 additions and 14 deletions

View File

@ -4,10 +4,9 @@
{ config, lib, flakelight, genSystems, moduleArgs, ... }: { config, lib, flakelight, genSystems, moduleArgs, ... }:
let let
inherit (lib) filterAttrs functionArgs mapAttrs mkIf mkMerge mkOption; inherit (lib) functionArgs mapAttrs mkIf mkMerge mkOption;
inherit (lib.types) coercedTo lazyAttrsOf lines listOf inherit (lib.types) coercedTo lazyAttrsOf lines listOf
package str submoduleWith; package str submoduleWith;
inherit (flakelight) supportedSystem;
inherit (flakelight.types) function nullable optCallWith optFunctionTo; inherit (flakelight.types) function nullable optCallWith optFunctionTo;
devShellModule.options = { devShellModule.options = {
@ -82,8 +81,7 @@ in
(mkIf (config.devShells != { }) { (mkIf (config.devShells != { }) {
outputs.devShells = genSystems (pkgs: outputs.devShells = genSystems (pkgs:
filterAttrs (_: supportedSystem pkgs) mapAttrs (_: v: genDevShell pkgs (v pkgs)) config.devShells);
(mapAttrs (_: v: genDevShell pkgs (v pkgs)) config.devShells));
}) })
]; ];
} }

View File

@ -5,10 +5,9 @@
{ config, lib, inputs, flakelight, genSystems, moduleArgs, ... }: { config, lib, inputs, flakelight, genSystems, moduleArgs, ... }:
let let
inherit (builtins) hasAttr parseDrvName tryEval; inherit (builtins) hasAttr parseDrvName tryEval;
inherit (lib) filterAttrs findFirst functionArgs mapAttrs' mapAttrs mkIf inherit (lib) findFirst functionArgs mapAttrs' mapAttrs mkIf mkMerge mkOption
mkMerge mkOption nameValuePair optionalAttrs; nameValuePair optionalAttrs;
inherit (lib.types) lazyAttrsOf str uniq; inherit (lib.types) lazyAttrsOf str uniq;
inherit (flakelight) supportedSystem;
inherit (flakelight.types) nullable optCallWith overlay packageDef; inherit (flakelight.types) nullable optCallWith overlay packageDef;
genPkg = final: prev: name: pkg: genPkg = final: prev: name: pkg:
@ -90,8 +89,7 @@ in
outputs = rec { outputs = rec {
packages = genSystems (pkgs: packages = genSystems (pkgs:
filterAttrs (_: supportedSystem pkgs) mapAttrs (k: _: pkgs.${k}) config.packages);
(mapAttrs (k: _: pkgs.${k}) config.packages));
checks = mapAttrs checks = mapAttrs
(_: mapAttrs' (n: nameValuePair ("packages-" + n))) (_: mapAttrs' (n: nameValuePair ("packages-" + n)))

View File

@ -37,8 +37,7 @@ let
}; };
flakelight = { flakelight = {
inherit autoImport autoImportArgs importDir mkFlake selectAttr inherit autoImport autoImportArgs importDir mkFlake selectAttr types;
supportedSystem types;
}; };
types = rec { types = rec {
@ -154,9 +153,6 @@ let
}; };
}; };
supportedSystem = { lib, stdenv, ... }:
lib.meta.availableOn stdenv.hostPlatform;
importDir = path: genAttrs importDir = path: genAttrs
(pipe (readDir path) [ (pipe (readDir path) [
attrNames attrNames