@@ -17,47 +17,20 @@ jobs:
1717
1818 steps :
1919 - uses : actions/checkout@v4
20- - name : record files
20+ - uses : cachix/install-nix-action@v31
21+ - name : Evaluate Nix expressions
2122 run : |
22- find / -xdev -path /nix/store -prune -o -not -path ~/files-before-nix-installation -not -path ~/files-after-nix-installation -print | sort > ~/files-before-nix-installation
23- - name : Install Nix with cached packages
24- uses : ibbem/cache-install@351a9c03d8d6c28264e348d0df6b6e4b136a07ab
25- with :
26- key : nix-${{ hashFiles('.github/workflows/maven.yml', 'default.nix', 'nix/**', 'pom.xml', 'local-maven-repo') }}
27- nix_file : nix/github-workflow-dependencies.nix
28- - name : record files
29- run : |
30- find / -xdev -path /nix/store -prune -o -not -path ~/files-before-nix-installation -not -path ~/files-after-nix-installation -print | sort > ~/files-after-nix-installation
31- echo
32- echo "--------------------------------------- removed files ---------------------------------------"
33- comm -23 ~/files-before-nix-installation ~/files-after-nix-installation
34- echo
35- echo "--------------------------------------- added files ---------------------------------------"
36- comm -13 ~/files-before-nix-installation ~/files-after-nix-installation
37- echo "------------------------------------------------------------------------------"
38- - name : show new files
39- run : |
40- print() {
41- echo "------------------- start of $1 -------------------"
42- cat "$1" || true
43- echo "--------------------- end of $1 -------------------"
44- }
45-
46- print /etc/bash.bashrc.backup-before-nix
47- print /etc/bashrc
48- print /etc/nix/nix.conf
49- print /etc/profile.d/nix.sh
50- print /etc/zshrc
51- print /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
52-
53- echo "NIX_PATH=$NIX_PATH"
54- ls -ld "$NIX_PATH" || true
55- ls -l "$NIX_PATH" || true
56-
57- echo nix-info:
58- nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/6832d0d99649db3d65a0e15fa51471537b2c56a6.tar.gz -p nix-info --run 'nix-info --markdown'
23+ nix-instantiate --expr '[ (import ./nix/github-workflow-dependencies.nix) (import ./default.nix)]' 2>&1 | grep '^/nix/store/' | tee derivations
24+ echo 'dry build'
25+ nix-store --realize --dry-run $(< derivations) 2>&1 | tee dry-build
26+ echo 'to be fetched'
27+ sed '1,/^these .* will be fetched/ d; s/^ //' dry-build | tee fetch
28+ echo 'to be built'
29+ sed -n '2,/^these .* will be fetched/ p' dry-build | grep -v '^these' | sed 's/ //' | tee built
30+ - name : Fetch
31+ run : nix-store --realize $(< fetch)
5932 - name : Build
60- run : nix-build
33+ run : nix-store --realize $(< built)
6134 - name : Upload Javadoc artifact
6235 if : ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
6336 uses : actions/upload-pages-artifact@v3
0 commit comments