From e5918d019b99d8824bb6009cb95a544d4d49f289 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 23 May 2022 10:58:42 +0200 Subject: [PATCH] packages: improve per-system filtering --- flake.nix | 2 +- packages/default.nix | 7 +++++-- packages/patched-inputs.nix | 8 ++++---- packages/projects.nix | 8 ++++---- packages/system-filter.nix | 4 ++++ 5 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 packages/system-filter.nix diff --git a/flake.nix b/flake.nix index 476c513..9a7fb17 100644 --- a/flake.nix +++ b/flake.nix @@ -78,7 +78,7 @@ (host: mkDeploy host // (overrides.${host} or {}) ); depot = forSystems (system: import ./packages { - inherit inputs; + inherit inputs system; pkgs = nixpkgsFor system; }); diff --git a/packages/default.nix b/packages/default.nix index 270c723..4f56f38 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs }@args: +{ pkgs, inputs, system }@args: let patched-derivations = import ./patched-derivations.nix (pkgs // { flakePackages = all; }); patched-inputs = import ./patched-inputs.nix args; @@ -6,8 +6,11 @@ let all = patched-derivations // patched-inputs // projects.packages; + filters = import ./system-filter.nix; 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; } diff --git a/packages/patched-inputs.nix b/packages/patched-inputs.nix index 82d1f69..6be3e4f 100644 --- a/packages/patched-inputs.nix +++ b/packages/patched-inputs.nix @@ -1,9 +1,9 @@ let tools = import ./lib/tools.nix; in with tools; -{ inputs, pkgs, ... }: rec { - inherit (inputs.deploy-rs.packages.${pkgs.system}) deploy-rs; +{ inputs, pkgs, system, ... }: rec { + 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; }; } diff --git a/packages/projects.nix b/packages/projects.nix index 40e16e5..1041fce 100644 --- a/packages/projects.nix +++ b/packages/projects.nix @@ -1,6 +1,6 @@ -{ pkgs, inputs, ... }@args: +{ pkgs, inputs, system, ... }@args: let - inherit (pkgs) lib system; + inherit (pkgs) lib; dream2nix = inputs.dream2nix.lib2.init { systems = [ system ]; config = { @@ -27,7 +27,7 @@ in }; inherit (dream.packages.${system}) ghost; in - lib.recursiveUpdate ghost { meta.platforms = [ "x86_64-linux" ]; }; + ghost; uptime-kuma = let dream = dream2nix.makeFlakeOutputs { @@ -40,7 +40,7 @@ in }; inherit (dream.packages.${system}) uptime-kuma; in - lib.recursiveUpdate uptime-kuma { meta.platforms = [ "x86_64-linux" ]; }; + uptime-kuma; hyprspace = pkgs.callPackage ./networking/hyprspace { iproute2mac = null; }; diff --git a/packages/system-filter.nix b/packages/system-filter.nix new file mode 100644 index 0000000..6b5b61b --- /dev/null +++ b/packages/system-filter.nix @@ -0,0 +1,4 @@ +{ + ghost = [ "x86_64-linux" ]; + uptime-kuma = [ "x86_64-linux" ]; +}