blob: 97971d6058e3dd10d1b2c067a6bc5f1d0d5bd87b (
plain) (
blame)
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
|
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl xmlstarlet nix coreutils
set -euxo pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd $SCRIPTPATH
function update_repo() {
owner=$1
repo=$2
echo $repo
# Get relevant data (commit id and timestamp) for the latest commit
commit_data=$(curl "https://github.com/$owner/$repo/commits/master.atom" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
# Extract commit sha and build a version number based on date: YYYYMMDD.0
commit_sha=$(echo $commit_data | cut -d '/' -f 2)
version_number=$(echo $commit_data | cut -d '/' -f 3 | cut -d 'T' -f 1 | sed 's/-//g').0
digest=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/${commit_sha}.tar.gz")
echo "{\"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > $repo.json
}
update_repo ch11ng exwm
update_repo ch11ng xelb
nix-build --no-out-link --show-trace ./test.nix
|