Merge pull request #49 from nrdxp/app-support

Add an `apps` output attribute set
This commit is contained in:
Timothy DeHerrera 2020-12-28 21:47:29 -07:00 committed by GitHub
commit 69308e6e71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,10 +11,11 @@
outputs = inputs@{ self, home, nixos, master, flake-utils, nur }: outputs = inputs@{ self, home, nixos, master, flake-utils, nur }:
let let
inherit (builtins) attrNames attrValues readDir elem; inherit (builtins) attrNames attrValues readDir elem pathExists filter;
inherit (flake-utils.lib) eachDefaultSystem; inherit (flake-utils.lib) eachDefaultSystem mkApp;
inherit (nixos) lib; inherit (nixos) lib;
inherit (lib) all removeSuffix recursiveUpdate genAttrs filterAttrs; inherit (lib) all removeSuffix recursiveUpdate genAttrs filterAttrs
mapAttrs;
inherit (utils) pathsToImportedAttrs genPkgset overlayPaths modules inherit (utils) pathsToImportedAttrs genPkgset overlayPaths modules
genPackages pkgImport; genPackages pkgImport;
@ -50,21 +51,15 @@
defaultTemplate = self.templates.flk; defaultTemplate = self.templates.flk;
}; };
in in
(eachDefaultSystem (system': (eachDefaultSystem
(system':
let let
pkgs' = pkgImport { pkgs' = pkgImport {
pkgs = nixos; pkgs = master;
system = system'; system = system';
overlays = [ ]; overlays = [ ];
}; };
in
{
devShell = import ./shell.nix {
pkgs = pkgs';
};
packages =
let
packages' = genPackages { packages' = genPackages {
overlay = self.overlay; overlay = self.overlay;
overlays = self.overlays; overlays = self.overlays;
@ -81,6 +76,25 @@
)) ))
packages'; packages';
in in
{
devShell = import ./shell.nix {
pkgs = pkgs';
};
apps =
let
validApps = attrNames (filterAttrs (_: drv: pathExists "${drv}/bin")
self.packages."${system}");
validSystems = attrNames filtered;
filterBins = filterAttrs
(n: _: elem n validSystems && elem n validApps)
filtered;
in
mapAttrs (_: drv: mkApp { inherit drv; }) filterBins;
packages =
filtered; filtered;
})) // outputs; })) // outputs;
} }