From f2543047969d2bbac5669325c459638661518525 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 18 Apr 2021 21:00:45 -0600 Subject: [PATCH] mv `nix/ci.nix` directly to `default.nix` --- default.nix | 31 +++++++++++++++++++++++++++---- doc/integrations/hercules.md | 2 +- lib/compat/default.nix | 2 +- nix/ci.nix | 31 ------------------------------- 4 files changed, 29 insertions(+), 37 deletions(-) delete mode 100644 nix/ci.nix diff --git a/default.nix b/default.nix index e3c4ca1f..5d437c7d 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,31 @@ let inherit (default.inputs.nixos) lib; - default = (import ./lib/compat).defaultNix; + default = (import "${./lib}/compat").defaultNix; + + ciSystems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + ]; + + filterSystems = lib.filterAttrs + (system: _: lib.elem system ciSystems); + + recurseIntoAttrsRecursive = lib.mapAttrs (_: v: + if lib.isAttrs v + then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) + else v + ); + + systemOutputs = lib.filterAttrs + (name: set: lib.isAttrs set + && lib.any + (system: set ? ${system} && name != "legacyPackages") + ciSystems + ) + default.outputs; + + ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs; in -builtins.mapAttrs (_: v: lib.recurseIntoAttrs v) default.packages // { - shell = import ./shell.nix; -} +(recurseIntoAttrsRecursive ciDrvs) // { shell = import ./shell.nix; } diff --git a/doc/integrations/hercules.md b/doc/integrations/hercules.md index f50443a9..aa0185e4 100644 --- a/doc/integrations/hercules.md +++ b/doc/integrations/hercules.md @@ -15,7 +15,7 @@ binary cache (and of course you do), be sure _not_ to skip the [binary-caches.json][cache]. ## Ready to Use -The repo is already set up with the proper _nix/ci.nix_ file, building all +The repo is already set up with the proper _default.nix_ file, building all declared packages, checks, profiles and shells. So you can see if something breaks, and never build the same package twice! diff --git a/lib/compat/default.nix b/lib/compat/default.nix index 9ed54a7e..0a63b0bc 100644 --- a/lib/compat/default.nix +++ b/lib/compat/default.nix @@ -1,7 +1,7 @@ let inherit (lock.nodes.flake-compat.locked) rev narHash; - lock = builtins.fromJSON (builtins.readFile ../../flake.lock); + lock = builtins.fromJSON (builtins.readFile "${../..}/flake.lock"); flake = (import ( fetchTarball { diff --git a/nix/ci.nix b/nix/ci.nix deleted file mode 100644 index f36d2b20..00000000 --- a/nix/ci.nix +++ /dev/null @@ -1,31 +0,0 @@ -let - inherit (default.inputs.nixos) lib; - - default = (import "${../lib}/compat").defaultNix; - - ciSystems = [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - ]; - - filterSystems = lib.filterAttrs - (system: _: lib.elem system ciSystems); - - recurseIntoAttrsRecursive = lib.mapAttrs (_: v: - if lib.isAttrs v - then recurseIntoAttrsRecursive (lib.recurseIntoAttrs v) - else v - ); - - systemOutputs = lib.filterAttrs - (name: set: lib.isAttrs set - && lib.any - (system: set ? ${system} && name != "legacyPackages") - ciSystems - ) - default.outputs; - - ciDrvs = lib.mapAttrs (_: system: filterSystems system) systemOutputs; -in -recurseIntoAttrsRecursive ciDrvs