mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-15 17:50:53 +00:00
55 lines
1.3 KiB
Nix
55 lines
1.3 KiB
Nix
{ config, lib, flake-modules-core-lib, ... }:
|
|
let
|
|
inherit (lib)
|
|
filterAttrs
|
|
mapAttrs
|
|
mkOption
|
|
optionalAttrs
|
|
types
|
|
;
|
|
inherit (flake-modules-core-lib)
|
|
mkSubmoduleOptions
|
|
mkPerSystemOption
|
|
;
|
|
in
|
|
{
|
|
options = {
|
|
flake = mkSubmoduleOptions {
|
|
legacyPackages = mkOption {
|
|
type = types.lazyAttrsOf (types.lazyAttrsOf types.anything);
|
|
default = { };
|
|
description = ''
|
|
Per system, an attribute set of anything. This is also used by <literal>nix build .#<attrpath></literal>.
|
|
'';
|
|
};
|
|
};
|
|
|
|
perSystem = mkPerSystemOption ({ config, ... }: {
|
|
options = {
|
|
legacyPackages = mkOption {
|
|
type = types.lazyAttrsOf types.anything;
|
|
default = { };
|
|
description = ''
|
|
An attribute set of anything. This is also used by <literal>nix build .#<attrpath></literal>.
|
|
'';
|
|
};
|
|
};
|
|
});
|
|
};
|
|
|
|
config = {
|
|
flake.legacyPackages =
|
|
mapAttrs
|
|
(k: v: v.legacyPackages)
|
|
(filterAttrs
|
|
(k: v: v.legacyPackages != null)
|
|
config.allSystems
|
|
);
|
|
|
|
perInput = system: flake:
|
|
optionalAttrs (flake?legacyPackages.${system}) {
|
|
legacyPackages = flake.legacyPackages.${system};
|
|
};
|
|
|
|
};
|
|
}
|