From 0e4d9404dde9c56ae346dfc531c8675da107e21c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 22 Aug 2022 19:41:08 -0700 Subject: [PATCH] don't create packages for targets that are null --- default.nix | 4 +++- flake.nix | 39 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/default.nix b/default.nix index a94f16a..9553e45 100644 --- a/default.nix +++ b/default.nix @@ -26,7 +26,9 @@ let # The packages that are tagged releases taggedPackages = lib.attrsets.mapAttrs (k: v: mkBinaryInstall { inherit (v.${system}) version url sha256; }) - (builtins.removeAttrs sources ["master"]); + (lib.attrsets.filterAttrs + (k: v: (builtins.hasAttr system v) && (v.${system}.url != null)) + (builtins.removeAttrs sources ["master"])); # The master packages masterPackages = lib.attrsets.mapAttrs' diff --git a/flake.nix b/flake.nix index b0e9192..9c7714d 100644 --- a/flake.nix +++ b/flake.nix @@ -10,27 +10,28 @@ # List of systems where binaries are provided. let systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; - in flake-utils.lib.eachSystem systems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in rec { - # The packages exported by the Flake: - # - default - latest /released/ version - # - - tagged version - # - master - latest nightly (updated daily) - # - master- - nightly by date - packages = import ./default.nix { inherit system pkgs; }; - - # "Apps" so that `nix run` works. If you run `nix run .` then - # this will use the latest default. - apps = rec { - default = apps.zig; - zig = flake-utils.lib.mkApp { drv = packages.default; }; - }; + outputs = flake-utils.lib.eachSystem systems (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in rec { + # The packages exported by the Flake: + # - default - latest /released/ version + # - - tagged version + # - master - latest nightly (updated daily) + # - master- - nightly by date + packages = import ./default.nix { inherit system pkgs; }; + # "Apps" so that `nix run` works. If you run `nix run .` then + # this will use the latest default. + apps = rec { + default = apps.zig; + zig = flake-utils.lib.mkApp { drv = packages.default; }; + }; + }); + in outputs // { # Overlay that can be imported so you can access the packages # using zigpkgs.master.latest or whatever you'd like. - overlay = final: prev: { - zigpkgs = packages.${prev.system}; + overlays.default = final: prev: { + zigpkgs = outputs.packages.${prev.system}; }; - }); + }; }