Merge pull request #49 from nrdxp/app-support
Add an `apps` output attribute set
This commit is contained in:
commit
69308e6e71
1 changed files with 48 additions and 34 deletions
82
flake.nix
82
flake.nix
|
@ -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,37 +51,50 @@
|
||||||
defaultTemplate = self.templates.flk;
|
defaultTemplate = self.templates.flk;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(eachDefaultSystem (system':
|
(eachDefaultSystem
|
||||||
let
|
(system':
|
||||||
pkgs' = pkgImport {
|
let
|
||||||
pkgs = nixos;
|
pkgs' = pkgImport {
|
||||||
system = system';
|
pkgs = master;
|
||||||
overlays = [ ];
|
system = system';
|
||||||
};
|
overlays = [ ];
|
||||||
in
|
};
|
||||||
{
|
|
||||||
devShell = import ./shell.nix {
|
|
||||||
pkgs = pkgs';
|
|
||||||
};
|
|
||||||
|
|
||||||
packages =
|
packages' = genPackages {
|
||||||
let
|
overlay = self.overlay;
|
||||||
packages' = genPackages {
|
overlays = self.overlays;
|
||||||
overlay = self.overlay;
|
pkgs = pkgs';
|
||||||
overlays = self.overlays;
|
};
|
||||||
pkgs = pkgs';
|
|
||||||
};
|
|
||||||
|
|
||||||
filtered = filterAttrs
|
filtered = filterAttrs
|
||||||
(_: v:
|
(_: v:
|
||||||
(v.meta ? platforms)
|
(v.meta ? platforms)
|
||||||
&& (elem system' v.meta.platforms)
|
&& (elem system' v.meta.platforms)
|
||||||
&& (
|
&& (
|
||||||
(all (dev: dev.meta ? platforms) v.buildInputs)
|
(all (dev: dev.meta ? platforms) v.buildInputs)
|
||||||
&& (all (dev: elem system' dev.meta.platforms) v.buildInputs)
|
&& (all (dev: elem system' dev.meta.platforms) v.buildInputs)
|
||||||
))
|
))
|
||||||
packages';
|
packages';
|
||||||
in
|
in
|
||||||
filtered;
|
{
|
||||||
})) // outputs;
|
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;
|
||||||
|
})) // outputs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue