2020-10-15 20:46:37 +11:00
|
|
|
local Cache(name, settings) = {
|
|
|
|
name: name,
|
|
|
|
image: "meltwater/drone-cache",
|
|
|
|
pull: true,
|
|
|
|
settings: {
|
|
|
|
backend: "filesystem",
|
|
|
|
cache_key: "{{ .Repo.Name }}",
|
|
|
|
archive_format: "gzip",
|
|
|
|
mount: [
|
|
|
|
"/nix/store"
|
|
|
|
]
|
|
|
|
} + settings,
|
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: "cache",
|
|
|
|
path: "/tmp/cache"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2020-10-15 18:54:14 +11:00
|
|
|
local Pipeline(channel) = {
|
|
|
|
kind: "pipeline",
|
|
|
|
type: "docker",
|
|
|
|
name: channel,
|
2020-10-15 20:46:37 +11:00
|
|
|
// This is ignored by the drone-cli YAML translator, so unfortunately, it has
|
|
|
|
// to be copy-pasted into relevant steps.
|
|
|
|
environment: {
|
|
|
|
NIXPKGS_ALLOW_UNFREE: 1,
|
|
|
|
NUR_REPO: "xeals",
|
|
|
|
CACHIX_CACHE: "xeals",
|
|
|
|
CACHIX_SIGNING_KEY: { from_secret: "cachix_key" },
|
|
|
|
},
|
|
|
|
volumes: [
|
|
|
|
{
|
|
|
|
name: "cache",
|
|
|
|
temp: {}
|
|
|
|
}
|
|
|
|
],
|
2020-10-15 18:54:14 +11:00
|
|
|
steps: [
|
2020-10-15 20:46:37 +11:00
|
|
|
Cache("restore-nix-store", {
|
|
|
|
restore: true
|
|
|
|
}),
|
2020-10-15 18:54:14 +11:00
|
|
|
{
|
|
|
|
name: "build",
|
|
|
|
image: "nixos/nix",
|
|
|
|
commands: [
|
|
|
|
"nix-channel --add https://nixos.org/channels/" + channel + " nixos",
|
|
|
|
"nix-channel --update",
|
|
|
|
"nix-build ci.nix -A buildOutputs",
|
|
|
|
"nix eval -f default.nix 'lib'",
|
|
|
|
"nix eval -f default.nix 'modules'",
|
|
|
|
"nix eval -f default.nix 'overlays'"
|
2020-10-15 19:47:10 +11:00
|
|
|
],
|
|
|
|
environment: {
|
|
|
|
NIXPKGS_ALLOW_UNFREE: 1
|
|
|
|
}
|
2020-10-15 18:54:14 +11:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "deploy",
|
|
|
|
image: "nixpkgs/cachix",
|
|
|
|
commands: [
|
|
|
|
'nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}"'//,
|
|
|
|
// 'if [[ "cron" != "${DRONE_BUILD_EVENT}" && -z "${DRONE_PULL_REQUEST}" && "master" = "${DRONE_BRANCH}" ]]; then
|
|
|
|
// curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"; fi'
|
2020-10-15 19:19:49 +11:00
|
|
|
],
|
|
|
|
environment: {
|
2020-10-15 19:47:10 +11:00
|
|
|
NIXPKGS_ALLOW_UNFREE: 1,
|
2020-10-15 19:19:49 +11:00
|
|
|
NUR_REPO: "xeals",
|
|
|
|
CACHIX_CACHE: "xeals",
|
|
|
|
CACHIX_SIGNING_KEY: { from_secret: "cachix_key" },
|
|
|
|
},
|
2020-10-15 20:46:37 +11:00
|
|
|
},
|
|
|
|
Cache("save-nix-store", {
|
|
|
|
rebuild: true
|
|
|
|
}) + {
|
|
|
|
when: { status: [ "success", "failure" ] }
|
|
|
|
},
|
2020-10-15 18:54:14 +11:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
Pipeline("nixpkgs-unstable"),
|
|
|
|
Pipeline("nixos-unstable"),
|
|
|
|
Pipeline("nixos-20.03"),
|
|
|
|
]
|