ci.nix: Add 19.09 for Nix 2.3

This commit is contained in:
Robert Hensing 2019-09-17 13:22:17 +02:00
parent 206787537e
commit eb24b3cced
5 changed files with 155 additions and 3 deletions

1
ci.nix
View file

@ -1 +0,0 @@
import ./tests/default.nix { pkgs = import ./nix {}; }

14
nix/ci.nix Normal file
View file

@ -0,0 +1,14 @@
let
sources = import ./sources.nix;
inherit (import ./dimension.nix { lib = import (sources.nixpkgs + "/lib"); })
dimension
;
in
dimension "Nixpkgs" {
"nixpkgs-19_03" = sources."nixos-19.03";
"nixpkgs-19_09" = sources."nixos-19.09";
} (_key: nixpkgs:
import ../tests/default.nix { pkgs = import ./default.nix { inherit nixpkgs; }; }
)
#import ./tests/default.nix { pkgs = import ./nix {}; }

View file

@ -1,9 +1,9 @@
{ sources ? import ./sources.nix }:
{ sources ? import ./sources.nix, nixpkgs ? sources.nixpkgs }:
let
config = {};
overlays = [(super: self: {
inherit (import sources.niv {}) niv;
})];
pkgs = import sources.nixpkgs { inherit overlays config; };
pkgs = import nixpkgs { inherit overlays config; };
in
pkgs

115
nix/dimension.nix Normal file
View file

@ -0,0 +1,115 @@
{ lib }:
{
/*
dimension: name -> attrs -> function -> attrs
where
function: keyText -> value -> attrsOf package
WARNING: Attribute names must not contain periods (".").
See https://github.com/NixOS/nix/issues/3088
NOTE: The dimension name will be picked up by agent and web ui soon.
Specifies a dimension of the build matrix. For example
dimension "Example" {
withP = { p = true; }
withoutP = { p = false; }
} (key: # either "withP" or "withoutP"
{ p }: # either p = true or p = false
myProject p
)
evaluates roughly to
{
withP = myProject true;
withoutP = myProject false;
}
Use nested calls for multiple dimensions.
Example:
dimension "System" {
"x86_64-linux" = {};
# ...
}: (system: {}:
dimension "Nixpkgs release" (
{
"nixpkgs-19_03".nixpkgs = someSource
} // optionalAttrs (system != "...") {
"nixpkgs-unstable".nixpkgs = someOtherSource
}
) (_key: { nixpkgs }:
myProject system nixpkgs
)
)
evaluates roughly to
{
x86_64-linux.nixpkgs-19_03 = myProject "x86_64-linux" someSource;
x86_64-linux.nixpkgs-unstable = myProject "x86_64-linux" someOtherSource;
...
}
If you need to make references across attributes, you can do so by binding
the result. Wherever you write
dimension "My dimension" {} (key: value: f1 key value)
You can also write
let
myDimension = dimension "My dimension" {} (key: value: f2 key value myDimension)
in
myDimension
This example builds a single test runner to reuse across releases:
let
overlay =
testRunnerPkgs: self: super: {
# ...
};
myProject =
{ nixpkgs,
pkgs ? import nixpkgs { overlays = [ overlay ]; },
testRunnerPkgs ? pkgs
}: pkgs;
in
let
latest = "nixpkgs-19_03";
releases =
dimension "Nixpkgs release"
{
nixpkgs-18_09.nixpkgs = someSource
nixpkgs-19_03.nixpkgs = someOtherSource
}
(_key: { nixpkgs }:
myProject {
inherit nixpkgs;
testRunnerPkgs = releases."${latest}";
}
);
in releases;
*/
dimension = name: attrs: f:
lib.mapAttrs
(k: v:
let o = f k v;
in o // { recurseForDerivations = o.recurseForDerivations or true; }
)
attrs
// { meta.dimension.name = name; };
# TODO: move this file somewhere (a flake?)
}

View file

@ -10,6 +10,30 @@
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",
"rev": "312a059bef8b29b4db4e73dc02ff441cab7bb26d"
},
"nixos-19.03": {
"homepage": "https://github.com/NixOS/nixpkgs",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/2dfae8e22fde5032419c3027964c406508332974.tar.gz",
"owner": "NixOS",
"branch": "nixos-19.03",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"repo": "nixpkgs-channels",
"type": "tarball",
"sha256": "0293j9wib78n5nspywrmd9qkvcqq2vcrclrryxqnaxvj3bs1c0vj",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"rev": "2dfae8e22fde5032419c3027964c406508332974"
},
"nixos-19.09": {
"homepage": "https://github.com/NixOS/nixpkgs",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/e6b068cd952e4640d416c2ccd62587d8a35cd774.tar.gz",
"owner": "NixOS",
"branch": "nixos-19.09",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"repo": "nixpkgs-channels",
"type": "tarball",
"sha256": "1ngac24cmdms1g37cpi6xs666bz1pf0fhw52zxa91i7bj30x9vw5",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"rev": "e6b068cd952e4640d416c2ccd62587d8a35cd774"
},
"niv": {
"homepage": "https://github.com/nmattia/niv",
"url": "https://github.com/nmattia/niv/archive/5d9e3a5f7d51765f0369a4682770ec57d863f19f.tar.gz",