nixos-generators/.included.yml
Matt Schreiber 70b4350553
CI: add nixos-generate logging output assertions
Namely, assert that the last line of output refers to a store path that
is a file or symlink to a file.
2022-05-13 11:45:22 -04:00

33 lines
1021 B
YAML

stages:
- build
.tar_option:
after_script:
- tar -cvhf $uploadPath.tar ./$uploadPath
artifacts:
name: "$uploadPath"
paths:
- $uploadPath.tar
.template:
only:
- web
stage: build
image: lnl7/nix:latest
before_script:
- nix --version
- chmod +w /etc/nix/nix.conf
- echo "system-features = kvm" >> /etc/nix/nix.conf
- sed -i -e 's/ --no-out-link//g' nixos-generate
- mkdir $uploadPath
script:
- nix-shell --command './nixos-generate -f $formats -I nixpkgs=channel:nixos-$nixpkgs_ver' |& tee $uploadPath/build.log
# Last line of output should be the path of a regular file (or symlink
# to a regular file) in the Nix store.
- storePath=$(tail -n 1 $uploadPath/build.log) && test -f "$storePath" && test "/nix/store/${storePath#/nix/store/}" = "$storePath"
- mv $(realpath result) $uploadPath
artifacts:
name: "$uploadPath"
paths:
- $uploadPath