Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read
actions: read
pull-requests: write

jobs:
e2e:
name: End-to-end
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Run the action on its own repo (dogfooding). This installs Nix,
# sets up caching, and picks up the repo's .envrc via direnv.
- uses: ./

- name: Assert Nix is installed
shell: bash
run: nix --version

- name: Assert direnv is on PATH
shell: bash
run: |
command -v direnv
direnv --version

- name: Assert .envrc env was exported
shell: bash
run: |
echo "NIX_MAGIC_SETUP_E2E=${NIX_MAGIC_SETUP_E2E:-<unset>}"
if [ "${NIX_MAGIC_SETUP_E2E:-}" != "ok" ]; then
echo "::error::marker env var from .envrc was not exported into the job environment"
exit 1
fi

- name: Assert flake evaluates
shell: bash
run: nix flake check
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "nix-magic-setup CI fixture flake (used to exercise the action end-to-end)";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
# Marker variable the E2E workflow asserts on, to prove the
# .envrc -> direnv -> $GITHUB_ENV export chain worked on a real runner.
NIX_MAGIC_SETUP_E2E = "ok";
};
});
};
}
Loading