From 96c27dbba0d07b584c0145f4c22dcdae7dcf6dda Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 30 Oct 2022 07:08:12 -0400 Subject: [PATCH] packages: Use mkTransposedPerSystemModule --- modules/packages.nix | 45 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/modules/packages.nix b/modules/packages.nix index 05fea46..a6a22c5 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,45 +1,22 @@ { config, lib, flake-parts-lib, ... }: let inherit (lib) - filterAttrs - mapAttrs mkOption - optionalAttrs types ; inherit (flake-parts-lib) - mkSubmoduleOptions - mkPerSystemOption + mkTransposedPerSystemModule ; in -{ - options = { - flake = mkSubmoduleOptions { - packages = mkOption { - type = types.lazyAttrsOf (types.lazyAttrsOf types.package); - default = { }; - description = '' - Per system an attribute set of packages. - nix build .#<name> will build packages.<system>.<name>. - ''; - }; - }; - - perSystem = mkPerSystemOption ({ config, ... }: { - _file = ./packages.nix; - options = { - packages = mkOption { - type = types.lazyAttrsOf types.package; - default = { }; - description = '' - An attribute set of packages to be built by nix build .#<name>. - nix build .#<name> will build packages.<name>. - ''; - }; - }; - }); - }; - config = { - transposition.packages = { }; +mkTransposedPerSystemModule { + name = "packages"; + option = mkOption { + type = types.lazyAttrsOf types.package; + default = { }; + description = '' + An attribute set of packages to be built by nix build .#<name>. + nix build .#<name> will build packages.<name>. + ''; }; + file = ./packages.nix; }