feat(nix): Filter projects that should be built by CI
Instead of specifying CI projects manually, this filters them to move the CI configuration into the derivations `meta` attributes.
This commit is contained in:
parent
c1c379848a
commit
45d63bce17
4 changed files with 25 additions and 15 deletions
33
default.nix
33
default.nix
|
@ -16,7 +16,16 @@ let
|
||||||
};
|
};
|
||||||
readTree = import ./read-tree.nix;
|
readTree = import ./read-tree.nix;
|
||||||
|
|
||||||
localPkgs = self: super:
|
# Derivations that have `meta.enableCI` set to `true` should be
|
||||||
|
# built by the CI system on every commit. This code implements
|
||||||
|
# filtering of all derivations in the local sets against this
|
||||||
|
# condition.
|
||||||
|
filterCI = lib: pkgs: let
|
||||||
|
inherit (lib) collect isDerivation filterAttrsRecursive;
|
||||||
|
ciCondition = _: x: (!isDerivation x) || ((x ? meta.enableCI) && (x.meta.enableCI));
|
||||||
|
in collect isDerivation (filterAttrsRecursive ciCondition pkgs);
|
||||||
|
|
||||||
|
repoPkgs = self: super:
|
||||||
let config = {
|
let config = {
|
||||||
pkgs = self;
|
pkgs = self;
|
||||||
upstream = super;
|
upstream = super;
|
||||||
|
@ -32,19 +41,17 @@ let
|
||||||
services = readTree ./services config;
|
services = readTree ./services config;
|
||||||
tools = readTree ./tools config;
|
tools = readTree ./tools config;
|
||||||
third_party = readTree ./third_party config;
|
third_party = readTree ./third_party config;
|
||||||
} // (readTree ./overrides config);
|
}
|
||||||
|
# Load overrides into the top-level:
|
||||||
# # All projects that should be built by CI should be added here:
|
// (readTree ./overrides config)
|
||||||
# ciProjects = [
|
# Collect all projects that should be built by CI
|
||||||
# self.kontemplate
|
// {
|
||||||
# self.nixery
|
ciProjects = (filterCI super.lib self.services)
|
||||||
# self.ormolu
|
++ (filterCI super.lib self.tools)
|
||||||
# self.terraform-gcp
|
++ (filterCI super.lib self.third_party);
|
||||||
# ] ++ filter (d: d ? meta.broken && !d.meta.broken) (attrValues self.tazjin);
|
};
|
||||||
# };
|
|
||||||
|
|
||||||
in { ... } @ args: import stableSrc (args // {
|
in { ... } @ args: import stableSrc (args // {
|
||||||
overlays = [ localPkgs ];
|
overlays = [ repoPkgs ];
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
config.allowBroken = true;
|
config.allowBroken = true;
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,4 +14,5 @@ let
|
||||||
'';
|
'';
|
||||||
in wrapper.overrideAttrs(_: {
|
in wrapper.overrideAttrs(_: {
|
||||||
allowSubstitutes = true;
|
allowSubstitutes = true;
|
||||||
|
meta.enableCI = true;
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,4 +5,6 @@ pkgs.buildGoPackage {
|
||||||
goPackagePath = "github.com/tazjin/personal/blog_cli";
|
goPackagePath = "github.com/tazjin/personal/blog_cli";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
goDeps = ./deps.nix;
|
goDeps = ./deps.nix;
|
||||||
|
|
||||||
|
meta.enableCI = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{ pkgs, kms, ... }:
|
{ pkgs, kms, ... }:
|
||||||
|
|
||||||
let inherit (pkgs) google-cloud-sdk tree writeShellScriptBin;
|
let inherit (pkgs) google-cloud-sdk tree writeShellScriptBin;
|
||||||
in writeShellScriptBin "pass" ''
|
in (writeShellScriptBin "pass" ''
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
CMD="$1"
|
CMD="$1"
|
||||||
|
@ -57,4 +57,4 @@ in writeShellScriptBin "pass" ''
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
''
|
'') // { meta.enableCI = true; }
|
Loading…
Reference in a new issue