Skip to content

Commit

Permalink
ci: hakishly have subflake use superflake as input
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Jun 22, 2023
1 parent 0d91ec5 commit 04422b7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh

# first time
if [[ ! -d $(nix store add-path --name source --dry-run .) ]]; then
nix store add-path --name source .
(cd ./src/local && nix flake lock --update-input std)
(cd ./src/tests && nix flake lock --update-input std)
fi

# shellcheck disable=SC1090
. "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/main/lib" "sha256-R3K8Flvbovj4IOvdlWNtQKLMMSQV464WjG9eU29ixHk=")"

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/std.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,36 @@ permissions:

jobs:
discover:
env:
# use local flake so we can dirty the tree
flake_file: "./flake.nix"
flake_url: "."
outputs:
hits: ${{ steps.discovery.outputs.hits }}
nix_conf: ${{ steps.discovery.outputs.nix_conf }}

runs-on: ${{ inputs.runs-on }}
steps:
- name: Install Nix Early (to update subflake references)
uses: nixbuild/nix-quick-install-action@v22
with:
nix_conf: |
experimental-features = nix-command flakes
accept-flake-config = true
- uses: actions/checkout@v3
- name: Update subflake references
run: |
# create the store path of
nix store add-path --name source .
# update the subflake lockfile to the (now existing) store path
# set lastModified to 1 because unknown issues in the GH action environment
(cd ./src/local && nix flake lock --update-input std && (
jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock
) && git add -f flake.lock)
(cd ./src/tests && nix flake lock --update-input std && (
jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock
) &&git add -f flake.lock)
# continue normally ...
- name: Standard Discovery
uses: divnix/std-action/discover@v0.23.0
id: discovery
Expand Down

0 comments on commit 04422b7

Please sign in to comment.