-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
82 lines (76 loc) · 2.78 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
language: nix
nix: 2.3
sudo: false
env:
global:
- CACHIX_CACHE=nexromancers
- NUR_REPO=nexromancers
- BUILD_UNFREE=false
install:
- >
mkdir -p "${XDG_CONFIG_DIR:-$HOME/.config}/nixpkgs" &&
echo "{ allowUnfree = ${BUILD_UNFREE}; sandbox = true; }" > "${XDG_CONFIG_DIR:-$HOME/.config}/nixpkgs/config.nix"
- nix --version
- if [ -n "${CACHIX_CACHE}" ]; then travis_retry nix-channel --update; fi
- if [ -n "${CACHIX_CACHE}" ]; then nix-env -iA cachix -f https://cachix.org/api/v1/install; fi
- if [ -n "${CACHIX_CACHE}" ]; then cachix use "${CACHIX_CACHE}"; fi
- nix-channel --add "${NIX_CHANNEL}" nixpkgs
- travis_retry nix-channel --update
script:
- |
function sortDrvs() {
typeset IFS=$'\n' drvs='' drv=''
drvs=$( \
nix-instantiate --show-trace --arg buildUnfree "${BUILD_UNFREE}" \
"$@" | \
cut -d '!' -f 1 | uniq | sort \
)
for drv in $drvs; do
nix-store -q --graph -- "$drv" | \
sed -e '1d; $d' -e 's/ \[.*\];$//' \
-e 's/^"\(\([^"\\]\|\\"\)*\)"$/"\1" -> "\1"/' \
-e 's/^"\(\([^"\\]\|\\"\)*\)" -> "\(\([^"\\]\|\\"\)*\)"$/\3 \1/'
done | tsort | grep -xFf - <(printf '%s' "$drvs") || true
}
function nixBuildDrv() {
printf '\n%s\n' "building $1 (all outputs if possible)"
typeset paths='' s=''
paths=$(nix-build --show-trace -E \
'{drv}: let d = import drv; in d.all or d' --argstr drv "$@")
s=$?; if [[ "$s" != 0 ]]; then return "$s"; fi
if [[ -n "${CACHIX_CACHE}" ]]; then
<<< "$paths" cachix push "${CACHIX_CACHE}"
s=$?; if [[ "$s" != 0 ]]; then return "$s"; fi
fi
}
function nixBuildDrvs() {
typeset s=''
while IFS='' read -r drv; do
nixBuildDrv "$drv"
s=$?; if [[ "$s" != 0 ]]; then return "$s"; fi
done
}
- sortDrvs ./ci.nix --arg flattened true -A cacheOutputs | nixBuildDrvs
- sortDrvs ./ci.nix --arg flattened true -A buildOutputs | CACHIX_CACHE='' nixBuildDrvs
- nix eval -f ./default.nix 'lib'
- nix eval -f ./default.nix 'modules'
- nix eval -f ./default.nix 'overlays'
jobs:
include:
- name: 'nixpkgs-unstable'
env: NIX_CHANNEL=https://nixos.org/channels/nixpkgs-unstable
- name: 'nixos-unstable'
env: NIX_CHANNEL=https://nixos.org/channels/nixos-unstable
- name: 'nixos-unstable (pinned)'
env: NIX_CHANNEL=https://github.com/NixOS/nixpkgs/archive/3b00e78e63b6539369821660245cd579f6723b58.tar.gz
- name: 'nixos-20.03'
env: NIX_CHANNEL=https://nixos.org/channels/nixos-20.03
- name: 'nixos-20.03 (pinned)'
env: NIX_CHANNEL=https://github.com/NixOS/nixpkgs/archive/73e73c7d6b5f9aace09a2aa12beb8688b3d7b7c8.tar.gz
- stage: deploy
name: "Notify NUR"
if: 'type NOT IN (pull_request, cron) AND branch IN (master)'
install:
script:
- curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"
# vim:et:sw=2