···11+# SPDX-FileCopyrightText: 2025 FreshlyBakedCake
22+#
33+# SPDX-License-Identifier: MIT
44+55+when:
66+ - event: ["push", "pull_request"]
77+ branch: ["main"]
88+99+engine: nixery
1010+1111+dependencies:
1212+ nixpkgs:
1313+ - jq
1414+1515+steps:
1616+ - name: Check for duplicate npins keys
1717+ command: |
1818+ dupes=$(jq --stream 'select((.[0] | length == 3) and (.[0][2] == "type")) | .[0][1]' ./packetmix/npins/sources.json | sort | uniq -d)
1919+ # We have to use the stream parser else jq will get rid of the duplicates
2020+2121+ if [ ! -z "$dupes" ]; then
2222+ echo "The following keys are duplicated in your npins pins. By default, npins will take *the later definition*:"
2323+ echo "$dupes"
2424+ exit 1
2525+ fi
+63
.tangled/workflows/packetmix-treefmt.yaml
···11+# SPDX-FileCopyrightText: 2025 FreshlyBakedCake
22+#
33+# SPDX-License-Identifier: MIT
44+55+when:
66+ - event: ["push", "pull_request"]
77+ branch: ["main"]
88+99+engine: nixery
1010+1111+dependencies:
1212+ nixpkgs:
1313+ - lix
1414+ - openssh
1515+1616+steps:
1717+ - name: Get remote builds SSH key
1818+ command: |
1919+ echo "$KEY_SSH_REMOTE_BUILD" > /tmp/key-ssh-remote-build
2020+ chmod 600 /tmp/key-ssh-remote-build
2121+ - name: Add base system files
2222+ command: |
2323+ # Let us SSH to midnight by name
2424+ echo "192.168.0.6 midnight" >> /etc/hosts
2525+2626+ # Avoid missing user with UID 0 error on ssh...
2727+ echo "root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash" >> /etc/passwd
2828+2929+ # Turn off SSH host key checking
3030+ echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
3131+ echo "UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config
3232+3333+ echo "Host midnight" >> /etc/ssh/ssh_config
3434+ echo " User remoteBuilds" >> /etc/ssh/ssh_config
3535+ echo " IdentityFile /tmp/key-ssh-remote-build" >> /etc/ssh/ssh_config
3636+3737+ echo "extra-experimental-features = nix-command" >> /etc/nix/nix.conf
3838+ echo "sandbox = false" >> /etc/nix/nix.conf
3939+ echo "max-jobs = 0" >> /etc/nix/nix.conf
4040+ - name: Ensure files are formatted with treefmt
4141+ command: |
4242+ set -e
4343+4444+ treefmt=$(nix build \
4545+ -f ./packetmix/nilla.nix packages.treefmt.result.x86_64-linux \
4646+ --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \
4747+ --eval-store auto \
4848+ --show-trace --print-out-paths)
4949+ nix copy \
5050+ --from 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \
5151+ --no-check-sigs \
5252+ "$treefmt"
5353+5454+ set +e
5555+5656+ "${treefmt}/bin/treefmt" --ci -C packetmix
5757+ exitCode=$?
5858+5959+ if [ $exitCode -ne 0 ]; then
6060+ echo "Your code isn't formatted correctly, please run 'nilla fmt' and squash it into each commit"
6161+ fi
6262+6363+ exit $exitCode
···11-# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
22-# SPDX-FileCopyrightText: 2025 FreshlyBakedCake
33-#
44-# SPDX-License-Identifier: CC0-1.0
55-66-name: Check for npins duplicate keys
77-# As it's possible to specify duplicate keys in npins, we need to route them
88-# out... Duplicated npins keys cause the earlier definition of a pin to be
99-# silently ignored, potentially causing confusion about what version is being
1010-# used
1111-1212-on:
1313- push:
1414- branches: [ "main" ]
1515- pull_request:
1616- branches: [ "main" ]
1717- workflow_dispatch:
1818-1919-permissions:
2020- contents: read
2121-2222-jobs:
2323- npins-duplicate-checker:
2424- runs-on: ubuntu-latest
2525- steps:
2626- - name: Checkout
2727- uses: actions/checkout@v4
2828-2929- - name: Check for duplicate npins keys
3030- run: |
3131- dupes=$(jq --stream 'select((.[0] | length == 3) and (.[0][2] == "type")) | .[0][1]' $GITHUB_WORKSPACE/npins/sources.json | sort | uniq -d)
3232- # We have to use the stream parser else jq will get rid of the duplicates
3333-3434- if [ ! -z "$dupes" ]; then
3535- echo "The following keys are duplicated in your npins pins. By default, npins will take *the later definition*:"
3636- echo "$dupes"
3737- exit 1
3838- fi