From 40b344843d32ea7437d1cae1015aaa1bfe44d4e1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 30 Oct 2022 06:53:32 -0400 Subject: [PATCH] apps: Use mkTransposedPerSystemModule --- modules/apps.nix | 58 +++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/modules/apps.nix b/modules/apps.nix index e411fd6..a3f8219 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,15 +1,11 @@ { config, lib, flake-parts-lib, ... }: let inherit (lib) - filterAttrs - mapAttrs mkOption - optionalAttrs types ; inherit (flake-parts-lib) - mkSubmoduleOptions - mkPerSystemOption + mkTransposedPerSystemModule ; programType = lib.types.coercedTo derivationType getExe lib.types.str; @@ -44,43 +40,19 @@ let }; }; in -{ - options = { - flake = mkSubmoduleOptions { - apps = mkOption { - type = types.lazyAttrsOf (types.lazyAttrsOf appType); - default = { }; - description = '' - Programs runnable with nix run .#<name>. - ''; - example = lib.literalExpression or lib.literalExample '' - { - x86_64-linux.default.program = "''${config.packages.hello}/bin/hello"; - } - ''; - }; - }; - - perSystem = mkPerSystemOption - ({ config, system, ... }: { - options = { - apps = mkOption { - type = types.lazyAttrsOf appType; - default = { }; - description = '' - Programs runnable with nix run .#<name>. - ''; - example = lib.literalExpression or lib.literalExample '' - { - default.program = "''${config.packages.hello}/bin/hello"; - } - ''; - }; - }; - }); - - }; - config = { - transposition.apps = { }; +mkTransposedPerSystemModule { + name = "apps"; + option = mkOption { + type = types.lazyAttrsOf appType; + default = { }; + description = '' + Programs runnable with nix run .#<name>. + ''; + example = lib.literalExpression or lib.literalExample '' + { + default.program = "''${config.packages.hello}/bin/hello"; + } + ''; }; + file = ./apps.nix; }