2020-03-28 15:24:17 +01:00
|
|
|
name: "Test"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
2023-04-28 13:26:11 +02:00
|
|
|
|
2020-03-28 15:24:17 +01:00
|
|
|
jobs:
|
|
|
|
tests:
|
2023-04-28 13:26:11 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
|
2022-08-12 12:13:11 -04:00
|
|
|
runs-on: macos-12
|
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
|
|
|
|
uses: cachix/install-nix-action@v20
|
|
|
|
with:
|
|
|
|
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
|
|
|
|
- name: Install nix from current unstable channel
|
|
|
|
uses: cachix/install-nix-action@v20
|
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:${{ matrix.channel }}
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-unstable' }}
|
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A tests
|
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A manpages
|
|
|
|
- run: nix-build ./release.nix -I nixpkgs=channel:${{ matrix.channel }} -I darwin=. -A examples.simple
|
|
|
|
|
2020-03-28 15:24:17 +01:00
|
|
|
install:
|
2023-04-28 13:26:11 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
|
2022-08-12 12:13:11 -04:00
|
|
|
runs-on: macos-12
|
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
|
|
|
|
uses: cachix/install-nix-action@v20
|
|
|
|
with:
|
|
|
|
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
|
|
|
|
nix_path: nixpkgs=channel:${{ matrix.channel }}
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
|
|
|
|
- name: Install nix from current unstable channel
|
|
|
|
uses: cachix/install-nix-action@v20
|
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:${{ matrix.channel }}
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-unstable' }}
|
|
|
|
- name: Install ${{ matrix.channel }} channel
|
|
|
|
run: |
|
|
|
|
nix-channel --add https://nixos.org/channels/${{ matrix.channel }} 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
|
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
|
|
|
|
with:
|
|
|
|
limit-access-to-actor: true
|
2023-04-28 13:26:11 +02:00
|
|
|
|
2020-10-18 14:36:51 +02:00
|
|
|
install-flake:
|
2023-04-28 13:26:11 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
channel: [nixpkgs-22.11-darwin, nixpkgs-unstable]
|
2022-08-12 12:13:11 -04:00
|
|
|
runs-on: macos-12
|
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
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix version corresponding to latest stable channel
|
|
|
|
uses: cachix/install-nix-action@v20
|
2021-03-24 20:26:32 +01:00
|
|
|
with:
|
2023-04-28 13:26:11 +02:00
|
|
|
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
|
|
|
|
nix_path: nixpkgs=channel:${{ matrix.channel }}
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-22.11-darwin' }}
|
|
|
|
- name: Install nix from current unstable channel
|
|
|
|
uses: cachix/install-nix-action@v20
|
2021-03-24 20:26:32 +01:00
|
|
|
with:
|
2023-04-28 13:26:11 +02:00
|
|
|
nix_path: nixpkgs=channel:${{ matrix.channel }}
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ matrix.channel == 'nixpkgs-unstable' }}
|
|
|
|
- name: Install ${{ matrix.channel }} channel
|
|
|
|
run: |
|
|
|
|
nix-channel --add https://nixos.org/channels/${{ matrix.channel }} nixpkgs
|
2021-03-24 20:46:18 +01:00
|
|
|
nix-channel --update
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Install nix-darwin and test result
|
|
|
|
run: |
|
2021-03-24 20:46:18 +01:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
|
|
|
nix-shell -A installer
|
2023-04-28 13:26:11 +02:00
|
|
|
nix-shell -A installer.check
|
|
|
|
- name: Build simple flake configuration
|
|
|
|
run: |
|
2021-09-14 18:55:17 +02:00
|
|
|
nix build ./modules/examples#darwinConfigurations.simple.system --override-input darwin .
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Activate derivation of simple flake build
|
|
|
|
run: |
|
2021-09-14 18:55:17 +02:00
|
|
|
./result/sw/bin/darwin-rebuild switch --flake ./modules/examples#simple --override-input darwin .
|
2023-04-28 13:26:11 +02:00
|
|
|
- name: Rebuild and activate simple flake, but this time using nix-darwins flake interface
|
|
|
|
run: |
|
2020-10-18 14:36:51 +02:00
|
|
|
. /etc/static/bashrc
|
2021-09-14 18:55:17 +02:00
|
|
|
darwin-rebuild build --flake ./modules/examples#simple --override-input darwin .
|
2022-12-13 15:35:22 -07:00
|
|
|
- name: Test git submodules
|
|
|
|
run: |
|
|
|
|
. /etc/static/bashrc
|
|
|
|
|
|
|
|
mkdir -p /tmp/{test-nix-darwin-submodules,example-submodule}
|
|
|
|
|
|
|
|
pushd /tmp/example-submodule
|
|
|
|
echo '"hello"' > hello.nix
|
|
|
|
git init
|
|
|
|
git add .
|
|
|
|
git commit -m "add a submodule we will import"
|
|
|
|
popd
|
|
|
|
|
|
|
|
cp -a ./modules/examples/. /tmp/test-nix-darwin-submodules
|
|
|
|
|
|
|
|
pushd /tmp/test-nix-darwin-submodules
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
'\#modules = \[#s#darwin.darwinModules.simple#./simple.nix#' \
|
|
|
|
./flake.nix
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
's#pkgs.vim#pkgs."${import ./submodule-test/hello.nix}"#' \
|
|
|
|
./simple.nix
|
|
|
|
git init
|
|
|
|
git add flake.nix simple.nix
|
|
|
|
git \
|
|
|
|
-c protocol.file.allow=always \
|
|
|
|
submodule add /tmp/example-submodule submodule-test
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Should fail
|
|
|
|
darwin-rebuild build \
|
|
|
|
--flake /tmp/test-nix-darwin-submodules#simple \
|
|
|
|
--override-input darwin . \
|
|
|
|
&& {
|
|
|
|
printf 'succeeded while expecting failure due to submodule\n' >/dev/stderr
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
# Should also fail
|
|
|
|
darwin-rebuild build \
|
|
|
|
--flake /tmp/test-nix-darwin-submodules?submodules=0#simple \
|
|
|
|
--override-input darwin . \
|
|
|
|
&& {
|
|
|
|
printf 'succeeded while expecting failure due to submodule\n' >/dev/stderr
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Should succeed
|
|
|
|
darwin-rebuild build \
|
|
|
|
--flake /tmp/test-nix-darwin-submodules?submodules=1#simple \
|
|
|
|
--override-input darwin .
|