packages: improve per-system filtering

This commit is contained in:
Max Headroom 2022-05-23 10:58:42 +02:00
parent 54116aafea
commit e5918d019b
5 changed files with 18 additions and 11 deletions

View file

@ -78,7 +78,7 @@
(host: mkDeploy host // (overrides.${host} or {}) ); (host: mkDeploy host // (overrides.${host} or {}) );
depot = forSystems (system: import ./packages { depot = forSystems (system: import ./packages {
inherit inputs; inherit inputs system;
pkgs = nixpkgsFor system; pkgs = nixpkgsFor system;
}); });

View file

@ -1,4 +1,4 @@
{ pkgs, inputs }@args: { pkgs, inputs, system }@args:
let let
patched-derivations = import ./patched-derivations.nix (pkgs // { flakePackages = all; }); patched-derivations = import ./patched-derivations.nix (pkgs // { flakePackages = all; });
patched-inputs = import ./patched-inputs.nix args; patched-inputs = import ./patched-inputs.nix args;
@ -6,8 +6,11 @@ let
all = patched-derivations all = patched-derivations
// patched-inputs // patched-inputs
// projects.packages; // projects.packages;
filters = import ./system-filter.nix;
in { in {
packages = pkgs.lib.filterAttrs (_: pkg: pkg ? meta.platforms -> builtins.elem pkgs.system pkg.meta.platforms) all; packages = pkgs.lib.filterAttrs (name: _:
filters ? "${name}" -> builtins.elem system filters."${name}"
) all;
inherit (projects) devShells; inherit (projects) devShells;
} }

View file

@ -1,9 +1,9 @@
let tools = import ./lib/tools.nix; let tools = import ./lib/tools.nix;
in with tools; in with tools;
{ inputs, pkgs, ... }: rec { { inputs, pkgs, system, ... }: rec {
inherit (inputs.deploy-rs.packages.${pkgs.system}) deploy-rs; inherit (inputs.deploy-rs.packages.${system}) deploy-rs;
nix-super = inputs.nix-super.defaultPackage.${pkgs.system}; nix-super = inputs.nix-super.defaultPackage.${system};
agenix = inputs.agenix.packages.${pkgs.system}.agenix.override { nix = nix-super; }; agenix = inputs.agenix.packages.${system}.agenix.override { nix = nix-super; };
} }

View file

@ -1,6 +1,6 @@
{ pkgs, inputs, ... }@args: { pkgs, inputs, system, ... }@args:
let let
inherit (pkgs) lib system; inherit (pkgs) lib;
dream2nix = inputs.dream2nix.lib2.init { dream2nix = inputs.dream2nix.lib2.init {
systems = [ system ]; systems = [ system ];
config = { config = {
@ -27,7 +27,7 @@ in
}; };
inherit (dream.packages.${system}) ghost; inherit (dream.packages.${system}) ghost;
in in
lib.recursiveUpdate ghost { meta.platforms = [ "x86_64-linux" ]; }; ghost;
uptime-kuma = let uptime-kuma = let
dream = dream2nix.makeFlakeOutputs { dream = dream2nix.makeFlakeOutputs {
@ -40,7 +40,7 @@ in
}; };
inherit (dream.packages.${system}) uptime-kuma; inherit (dream.packages.${system}) uptime-kuma;
in in
lib.recursiveUpdate uptime-kuma { meta.platforms = [ "x86_64-linux" ]; }; uptime-kuma;
hyprspace = pkgs.callPackage ./networking/hyprspace { iproute2mac = null; }; hyprspace = pkgs.callPackage ./networking/hyprspace { iproute2mac = null; };

View file

@ -0,0 +1,4 @@
{
ghost = [ "x86_64-linux" ];
uptime-kuma = [ "x86_64-linux" ];
}