1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-03-05 16:36:56 +00:00
flake-parts/modules/legacyPackages.nix

54 lines
1.2 KiB
Nix
Raw Normal View History

2021-10-27 11:05:52 +02:00
{ config, lib, flake-modules-core-lib, ... }:
let
inherit (lib)
filterAttrs
mapAttrs
mkOption
optionalAttrs
types
;
2021-11-21 15:47:11 +01:00
inherit (flake-modules-core-lib)
mkSubmoduleOptions
;
2021-10-27 11:05:52 +02:00
in
{
options = {
2021-11-21 15:47:11 +01:00
flake = mkSubmoduleOptions {
2021-10-27 11:05:52 +02:00
legacyPackages = mkOption {
type = types.lazyAttrsOf (types.lazyAttrsOf types.anything);
default = { };
2021-11-21 14:30:12 +01:00
description = ''
Per system, an attribute set of anything. This is also used by nix build .#<attrpath>.
'';
2021-10-27 11:05:52 +02:00
};
};
};
config = {
flake.legacyPackages =
mapAttrs
(k: v: v.legacyPackages)
(filterAttrs
(k: v: v.legacyPackages != null)
config.allSystems
2021-10-27 11:05:52 +02:00
);
perInput = system: flake:
optionalAttrs (flake?legacyPackages.${system}) {
legacyPackages = flake.legacyPackages.${system};
};
perSystem = system: { config, ... }: {
_file = ./legacyPackages.nix;
options = {
legacyPackages = mkOption {
type = types.lazyAttrsOf types.anything;
default = { };
2021-11-21 14:30:12 +01:00
description = ''
An attribute set of anything. This is also used by nix build .#<attrpath>.
'';
2021-10-27 11:05:52 +02:00
};
};
};
};
}