2020-03-28 15:24:17 +01:00
|
|
|
name: "Test"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
2024-10-22 14:07:25 +11:00
|
|
|
branches:
|
|
|
|
- master
|
2023-04-28 13:26:11 +02:00
|
|
|
|
2023-05-19 13:33:38 +02:00
|
|
|
env:
|
2024-09-10 16:17:57 +01:00
|
|
|
CURRENT_STABLE_CHANNEL: nixpkgs-24.05-darwin
|
2023-05-19 13:33:38 +02:00
|
|
|
|
2020-03-28 15:24:17 +01:00
|
|
|
jobs:
|
2023-05-19 13:33:38 +02:00
|
|
|
test-stable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2020-11-04 21:05:19 +01:00
|
|
|
timeout-minutes: 30
|
2020-03-28 15:24:17 +01:00
|
|
|
steps:
|
2023-04-26 23:00:58 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix corresponding to latest stable channel
|
2024-10-22 14:48:39 +11:00
|
|
|
uses: cachix/install-nix-action@v30
|
2023-04-28 13:26:11 +02:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
2023-05-19 13:33:38 +02:00
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A tests
|
2024-11-03 21:52:58 +11:00
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A docs
|
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A examples
|
2023-05-19 13:33:38 +02:00
|
|
|
|
|
|
|
test-unstable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2020-11-04 21:05:19 +01:00
|
|
|
timeout-minutes: 30
|
2020-03-28 15:24:17 +01:00
|
|
|
steps:
|
2023-05-19 13:33:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 14:48:39 +11:00
|
|
|
uses: cachix/install-nix-action@v30
|
2024-09-10 21:14:05 +01:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2023-05-19 13:33:38 +02:00
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A tests
|
2024-11-03 21:52:58 +11:00
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A docs
|
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A examples
|
2023-04-28 13:26:11 +02:00
|
|
|
|
2023-05-19 13:33:38 +02:00
|
|
|
install-against-stable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2020-11-04 21:05:19 +01:00
|
|
|
timeout-minutes: 30
|
2020-03-28 15:24:17 +01:00
|
|
|
steps:
|
2023-04-26 23:00:58 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix corresponding to latest stable channel
|
2024-10-22 14:48:39 +11:00
|
|
|
uses: cachix/install-nix-action@v30
|
2023-04-28 13:26:11 +02:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
|
|
|
nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
|
2023-05-19 13:33:38 +02:00
|
|
|
- name: Install ${{ env.CURRENT_STABLE_CHANNEL }} channel
|
|
|
|
run: |
|
|
|
|
nix-channel --add https://nixos.org/channels/${{ env.CURRENT_STABLE_CHANNEL }} nixpkgs
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-channel --update
|
2023-05-19 13:33:38 +02:00
|
|
|
- name: Install nix-darwin and test
|
|
|
|
run: |
|
2024-10-22 14:48:39 +11:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2023-06-24 13:58:56 +10:00
|
|
|
|
|
|
|
# We run nix-darwin twice to test that it can create darwin-configuration correctly for us
|
|
|
|
# but we expect it to fail setting up /etc/nix/nix.conf
|
|
|
|
nix-shell -A installer || true
|
|
|
|
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/# nix.package = pkgs.nix;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
|
|
|
~/.nixpkgs/darwin-configuration.nix
|
|
|
|
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-shell -A installer
|
|
|
|
nix-shell -A installer.check
|
2023-05-19 13:33:38 +02:00
|
|
|
- name: Build and activate default derivation
|
|
|
|
run: |
|
2020-03-28 15:24:17 +01:00
|
|
|
. /etc/static/bashrc
|
|
|
|
darwin-rebuild switch -I darwin=.
|
2023-05-19 13:33:38 +02:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
2020-11-04 21:05:19 +01:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-shell -A uninstaller
|
|
|
|
nix-shell -A uninstaller.check
|
2021-12-21 14:23:21 +01:00
|
|
|
- name: Debugging tmate session
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: mxschmitt/action-tmate@v3
|
|
|
|
timeout-minutes: 15
|
|
|
|
with:
|
|
|
|
limit-access-to-actor: true
|
2023-05-19 13:33:38 +02:00
|
|
|
|
|
|
|
install-against-unstable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2023-05-19 13:33:38 +02:00
|
|
|
timeout-minutes: 30
|
2020-10-18 14:36:51 +02:00
|
|
|
steps:
|
2023-05-19 13:33:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 14:48:39 +11:00
|
|
|
uses: cachix/install-nix-action@v30
|
2021-03-24 20:26:32 +01:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2023-05-19 13:33:38 +02:00
|
|
|
nix_path: nixpkgs=channel:nixpkgs-unstable
|
|
|
|
- name: Install nixpkgs-unstable channel
|
2023-04-28 13:26:11 +02:00
|
|
|
run: |
|
2023-05-19 13:33:38 +02:00
|
|
|
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-channel --update
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix-darwin and test
|
|
|
|
run: |
|
2020-11-04 21:05:19 +01:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2023-06-24 13:58:56 +10:00
|
|
|
|
|
|
|
# We run nix-darwin twice to test that it can create darwin-configuration correctly for us
|
|
|
|
# but we expect it to fail setting up /etc/nix/nix.conf
|
|
|
|
nix-shell -A installer || true
|
|
|
|
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/# nix.package = pkgs.nix;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
|
|
|
~/.nixpkgs/darwin-configuration.nix
|
|
|
|
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-shell -A installer
|
|
|
|
nix-shell -A installer.check
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Build and activate default derivation
|
|
|
|
run: |
|
2020-03-28 15:24:17 +01:00
|
|
|
. /etc/static/bashrc
|
|
|
|
darwin-rebuild switch -I darwin=.
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
2020-11-04 21:05:19 +01:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2020-03-28 15:24:17 +01:00
|
|
|
nix-shell -A uninstaller
|
|
|
|
nix-shell -A uninstaller.check
|
2021-12-21 14:23:21 +01:00
|
|
|
- name: Debugging tmate session
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: mxschmitt/action-tmate@v3
|
|
|
|
timeout-minutes: 15
|
2021-03-24 20:26:32 +01:00
|
|
|
with:
|
2021-12-21 14:23:21 +01:00
|
|
|
limit-access-to-actor: true
|
2023-04-28 13:26:11 +02:00
|
|
|
|
2023-05-19 13:33:38 +02:00
|
|
|
install-flake-against-stable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2023-04-28 13:26:11 +02:00
|
|
|
timeout-minutes: 30
|
2020-10-18 14:36:51 +02:00
|
|
|
steps:
|
2023-04-26 23:00:58 +02:00
|
|
|
- uses: actions/checkout@v3
|
2024-10-22 14:48:39 +11:00
|
|
|
- name: Install nix version corresponding to latest stable channel
|
|
|
|
uses: cachix/install-nix-action@v30
|
2021-03-24 20:26:32 +01:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
2023-06-20 22:54:31 +10:00
|
|
|
- name: Install nix-darwin
|
2023-05-19 13:33:38 +02:00
|
|
|
run: |
|
2023-06-24 13:58:56 +10:00
|
|
|
mkdir -p ~/.config/nix-darwin
|
|
|
|
darwin=$(pwd)
|
|
|
|
pushd ~/.config/nix-darwin
|
|
|
|
nix flake init -t $darwin
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/# nix.package = pkgs.nix;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
|
|
|
flake.nix
|
|
|
|
popd
|
2023-06-20 22:54:31 +10:00
|
|
|
nix run .#darwin-rebuild -- \
|
2023-06-24 13:58:56 +10:00
|
|
|
switch --flake ~/.config/nix-darwin#simple \
|
2023-07-13 22:35:54 +10:00
|
|
|
--override-input nix-darwin . \
|
2023-06-20 22:54:31 +10:00
|
|
|
--override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
|
|
|
- name: Rebuild and activate simple flake, but this time using nix-darwin's flake interface
|
2023-05-19 13:33:38 +02:00
|
|
|
run: |
|
|
|
|
. /etc/static/bashrc
|
2023-07-13 22:35:54 +10:00
|
|
|
darwin-rebuild build --flake ./modules/examples/flake#simple --override-input nix-darwin . --override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2023-05-19 13:33:38 +02:00
|
|
|
|
|
|
|
install-flake-against-unstable:
|
2024-11-05 03:21:37 +11:00
|
|
|
runs-on: macos-13
|
2023-05-19 13:33:38 +02:00
|
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 14:48:39 +11:00
|
|
|
uses: cachix/install-nix-action@v30
|
2024-09-10 21:14:05 +01:00
|
|
|
with:
|
2024-10-22 14:48:39 +11:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2023-06-20 22:54:31 +10:00
|
|
|
- name: Install nix-darwin
|
2023-04-28 13:26:11 +02:00
|
|
|
run: |
|
2023-06-24 13:58:56 +10:00
|
|
|
mkdir -p ~/.config/nix-darwin
|
|
|
|
darwin=$(pwd)
|
|
|
|
pushd ~/.config/nix-darwin
|
|
|
|
nix flake init -t $darwin
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/# nix.package = pkgs.nix;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
|
|
|
flake.nix
|
|
|
|
popd
|
2023-06-20 22:54:31 +10:00
|
|
|
nix run .#darwin-rebuild -- \
|
2023-06-24 13:58:56 +10:00
|
|
|
switch --flake ~/.config/nix-darwin#simple \
|
2023-07-13 22:35:54 +10:00
|
|
|
--override-input nix-darwin . \
|
2023-06-20 22:54:31 +10:00
|
|
|
--override-input nixpkgs nixpkgs/nixpkgs-unstable
|
|
|
|
- name: Rebuild and activate simple flake, but this time using nix-darwin's flake interface
|
2023-04-28 13:26:11 +02:00
|
|
|
run: |
|
2020-10-18 14:36:51 +02:00
|
|
|
. /etc/static/bashrc
|
2023-07-13 22:35:54 +10:00
|
|
|
darwin-rebuild build --flake ./modules/examples/flake#simple --override-input nix-darwin . --override-input nixpkgs nixpkgs/nixpkgs-unstable
|