refactor: Move CI setup to separate Nix file
Instead of polluting the repository namespace with the list of CI projects, move that to a separate file. Currently the list of projects to be built by CI is still hardcoded, but this will be fixed soon.
This commit is contained in:
parent
a1ac598fa0
commit
e9431682b2
4 changed files with 21 additions and 26 deletions
|
@ -6,6 +6,4 @@ before_script:
|
||||||
- nix-env -f '<nixpkgs>' -iA third_party.cachix
|
- nix-env -f '<nixpkgs>' -iA third_party.cachix
|
||||||
- cachix use tazjin
|
- cachix use tazjin
|
||||||
script:
|
script:
|
||||||
# All of my own tools are under the top-level 'tazjin' attribute
|
- nix-build ci-builds.nix | cachix push tazjin
|
||||||
# set, this command will build all of them.
|
|
||||||
- nix-build -A ciProjects | cachix push tazjin
|
|
||||||
|
|
17
ci-builds.nix
Normal file
17
ci-builds.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# This file is invoked by the CI build and recursively filters the
|
||||||
|
# package set for attributes that should be built automatically.
|
||||||
|
#
|
||||||
|
# Packages can be opted-in to being built by CI by setting
|
||||||
|
# `meta.enableCI = true`.
|
||||||
|
#
|
||||||
|
# TODO(tazjin): Actually implement the above.
|
||||||
|
|
||||||
|
let
|
||||||
|
pkgs = import ./default.nix;
|
||||||
|
in with pkgs; [
|
||||||
|
services.tazblog
|
||||||
|
services.nixcon-demo
|
||||||
|
tools.kms_pass
|
||||||
|
tools.blog_cli
|
||||||
|
]
|
||||||
|
|
22
default.nix
22
default.nix
|
@ -12,15 +12,6 @@ let
|
||||||
# package set is not available here.
|
# package set is not available here.
|
||||||
fix = f: let x = f x; in x;
|
fix = f: let x = f x; in x;
|
||||||
|
|
||||||
# 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);
|
|
||||||
|
|
||||||
# Global configuration that all packages are called with.
|
# Global configuration that all packages are called with.
|
||||||
config = pkgs: {
|
config = pkgs: {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
@ -45,19 +36,6 @@ in fix(self: {
|
||||||
|
|
||||||
# Elevate 'lib' from nixpkgs
|
# Elevate 'lib' from nixpkgs
|
||||||
lib = import (self.third_party.nixpkgsSrc + "/lib");
|
lib = import (self.third_party.nixpkgsSrc + "/lib");
|
||||||
|
|
||||||
# Collect all projects that should be built by CI
|
|
||||||
# ciProjects = (filterCI self.lib self.services)
|
|
||||||
# ++ (filterCI super.lib self.tools)
|
|
||||||
# ++ (filterCI super.lib self.third_party);
|
|
||||||
# TODO(tazjin): re-enable automatic filtering for this, requires
|
|
||||||
# read-tree fixes
|
|
||||||
ciProjects = with self; [
|
|
||||||
services.tazblog
|
|
||||||
services.nixcon-demo
|
|
||||||
tools.kms_pass
|
|
||||||
tools.blog_cli
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add local packages as structured by readTree
|
# Add local packages as structured by readTree
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# TODO(tazjin): if there's a default.nix, keep traversing but don't import .nix files?
|
|
||||||
# TODO(tazjin): avoid {} by only calling functions *after* checking what they are
|
# TODO(tazjin): avoid {} by only calling functions *after* checking what they are
|
||||||
|
# TODO(tazjin): add an attribute to derivations that have children to
|
||||||
|
# indicate that traversal should continue for ... traversal use-cases
|
||||||
|
# (such as CI package filtering)
|
||||||
|
|
||||||
args: initPath:
|
args: initPath:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue