From c19b9738f21319d8aafeeaa93365aa0f4f3e5b0d Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 1 Aug 2024 09:01:49 +0800 Subject: [PATCH] bahaghari/flake: remove all inputs as a design constraint --- subprojects/bahaghari/flake.nix | 43 +++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/subprojects/bahaghari/flake.nix b/subprojects/bahaghari/flake.nix index 2e3c710a..f9033037 100644 --- a/subprojects/bahaghari/flake.nix +++ b/subprojects/bahaghari/flake.nix @@ -1,15 +1,44 @@ +# For now, it has { description = "Specialized set of Nix modules for generating and applying themes."; - inputs = { - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = inputs@{ self, ... }: + outputs = { ... }: let - systems = inputs.flake-utils.lib.defaultSystems; sources = import ./npins; - in inputs.flake-utils.lib.eachSystem systems + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + eachSystem = + systems: f: + let + # Merge together the outputs for all systems. + op = + attrs: system: + let + ret = f system; + op = + attrs: key: + attrs + // { + ${key} = (attrs.${key} or { }) // { + ${system} = ret.${key}; + }; + }; + in + builtins.foldl' op attrs (builtins.attrNames ret); + in + builtins.foldl' op { } ( + systems + # add the current system if --impure is used + ++ ( + if builtins ? currentSystem then + if builtins.elem builtins.currentSystem systems then [ ] else [ builtins.currentSystem ] + else + [ ] + ) + ); + in eachSystem systems (system: { devShells.default = import ./shell.nix { pkgs = import sources.nixos-stable { inherit system; }; };