2020-03-28 14:24:17 +00:00
|
|
|
name: "Test"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
2024-10-22 03:07:25 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2023-04-28 11:26:11 +00:00
|
|
|
|
2023-05-19 11:33:38 +00:00
|
|
|
env:
|
2024-09-10 15:17:57 +00:00
|
|
|
CURRENT_STABLE_CHANNEL: nixpkgs-24.05-darwin
|
2023-05-19 11:33:38 +00:00
|
|
|
|
2020-03-28 14:24:17 +00:00
|
|
|
jobs:
|
2023-05-19 11:33:38 +00:00
|
|
|
test-stable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2020-03-28 14:24:17 +00:00
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Install nix corresponding to latest stable channel
|
2024-10-22 03:48:39 +00:00
|
|
|
uses: cachix/install-nix-action@v30
|
2023-04-28 11:26:11 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
2024-11-03 21:42:12 +00:00
|
|
|
- run: nix flake check --override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2023-05-19 11:33:38 +00:00
|
|
|
|
|
|
|
test-unstable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2020-03-28 14:24:17 +00:00
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 03:48:39 +00:00
|
|
|
uses: cachix/install-nix-action@v30
|
2024-09-10 20:14:05 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2024-11-03 21:42:12 +00:00
|
|
|
- run: nix flake check --override-input nixpkgs nixpkgs/nixpkgs-unstable
|
2023-04-28 11:26:11 +00:00
|
|
|
|
2023-05-19 11:33:38 +00:00
|
|
|
install-against-stable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2020-03-28 14:24:17 +00:00
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Install nix corresponding to latest stable channel
|
2024-10-22 03:48:39 +00:00
|
|
|
uses: cachix/install-nix-action@v30
|
2023-04-28 11:26:11 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
|
|
|
nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
|
2024-11-16 15:51:42 +00:00
|
|
|
- name: Install channels
|
2023-05-19 11:33:38 +00:00
|
|
|
run: |
|
2024-11-16 15:51:42 +00:00
|
|
|
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
|
2023-05-19 11:33:38 +00:00
|
|
|
nix-channel --add https://nixos.org/channels/${{ env.CURRENT_STABLE_CHANNEL }} nixpkgs
|
2020-03-28 14:24:17 +00:00
|
|
|
nix-channel --update
|
2024-11-16 15:14:06 +00:00
|
|
|
- name: Install nix-darwin
|
2023-05-19 11:33:38 +00:00
|
|
|
run: |
|
2024-10-22 03:48:39 +00:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2023-06-24 03:58:56 +00:00
|
|
|
|
2024-11-16 15:33:37 +00:00
|
|
|
mkdir -p ~/.config/nix-darwin
|
|
|
|
cp modules/examples/simple.nix ~/.config/nix-darwin/configuration.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
2024-11-11 11:30:42 +00:00
|
|
|
"s/# programs.fish.enable = true;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
2024-11-16 15:33:37 +00:00
|
|
|
~/.config/nix-darwin/configuration.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
|
2024-11-16 15:14:06 +00:00
|
|
|
nix run .#darwin-rebuild \
|
|
|
|
-- switch \
|
|
|
|
-I darwin-config=$HOME/.config/nix-darwin/configuration.nix
|
2024-11-17 05:16:32 +00:00
|
|
|
- name: Switch to new configuration
|
2023-05-19 11:33:38 +00:00
|
|
|
run: |
|
2024-11-19 01:50:32 +00:00
|
|
|
. /etc/bashrc
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/pkgs.vim/pkgs.hello/" \
|
|
|
|
~/.config/nix-darwin/configuration.nix
|
|
|
|
|
2020-03-28 14:24:17 +00:00
|
|
|
darwin-rebuild switch -I darwin=.
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
hello
|
2023-05-19 11:33:38 +00:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
2024-11-19 01:54:51 +00:00
|
|
|
# We need to specify `--extra-experimental-features` because `experimental-features` is set by
|
|
|
|
# `cachix/install-nix-action` but not by our default config above
|
2024-11-04 15:48:25 +00:00
|
|
|
nix run .#darwin-uninstaller \
|
2024-11-19 01:54:51 +00:00
|
|
|
--extra-experimental-features "nix-command flakes" \
|
|
|
|
--override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2024-11-04 15:48:25 +00:00
|
|
|
nix run .#darwin-uninstaller.tests.uninstaller \
|
2024-11-19 01:54:51 +00:00
|
|
|
--extra-experimental-features "nix-command flakes" \
|
|
|
|
--override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2023-05-19 11:33:38 +00:00
|
|
|
|
|
|
|
install-against-unstable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2023-05-19 11:33:38 +00:00
|
|
|
timeout-minutes: 30
|
2020-10-18 12:36:51 +00:00
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 03:48:39 +00:00
|
|
|
uses: cachix/install-nix-action@v30
|
2021-03-24 19:26:32 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2023-05-19 11:33:38 +00:00
|
|
|
nix_path: nixpkgs=channel:nixpkgs-unstable
|
2024-11-16 15:51:42 +00:00
|
|
|
- name: Install channels
|
2023-04-28 11:26:11 +00:00
|
|
|
run: |
|
2024-11-16 15:51:42 +00:00
|
|
|
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
|
2023-05-19 11:33:38 +00:00
|
|
|
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
|
2020-03-28 14:24:17 +00:00
|
|
|
nix-channel --update
|
2024-11-16 15:14:06 +00:00
|
|
|
- name: Install nix-darwin
|
2023-04-28 11:26:11 +00:00
|
|
|
run: |
|
2020-11-04 20:05:19 +00:00
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels
|
2023-06-24 03:58:56 +00:00
|
|
|
|
2024-11-16 15:33:37 +00:00
|
|
|
mkdir -p ~/.config/nix-darwin
|
|
|
|
cp modules/examples/simple.nix ~/.config/nix-darwin/configuration.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
|
|
|
|
nixConfHash=$(shasum -a 256 /etc/nix/nix.conf | cut -d ' ' -f 1)
|
|
|
|
/usr/bin/sed -i.bak \
|
2024-11-11 11:30:42 +00:00
|
|
|
"s/# programs.fish.enable = true;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
2024-11-16 15:33:37 +00:00
|
|
|
~/.config/nix-darwin/configuration.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
|
2024-11-16 15:14:06 +00:00
|
|
|
nix run .#darwin-rebuild \
|
|
|
|
-- switch \
|
|
|
|
-I darwin-config=$HOME/.config/nix-darwin/configuration.nix
|
2024-11-17 05:16:32 +00:00
|
|
|
- name: Switch to new configuration
|
2023-04-28 11:26:11 +00:00
|
|
|
run: |
|
2024-11-19 01:50:32 +00:00
|
|
|
. /etc/bashrc
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/pkgs.vim/pkgs.hello/" \
|
|
|
|
~/.config/nix-darwin/configuration.nix
|
|
|
|
|
2020-03-28 14:24:17 +00:00
|
|
|
darwin-rebuild switch -I darwin=.
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
hello
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
2024-11-19 01:54:51 +00:00
|
|
|
# We need to specify `--extra-experimental-features` because `experimental-features` is set by
|
|
|
|
# `cachix/install-nix-action` but not by our default config above
|
2024-11-04 15:48:25 +00:00
|
|
|
nix run .#darwin-uninstaller \
|
2024-11-07 05:47:15 +00:00
|
|
|
--extra-experimental-features "nix-command flakes" \
|
|
|
|
--override-input nixpkgs nixpkgs/nixpkgs-unstable
|
2024-11-04 15:48:25 +00:00
|
|
|
nix run .#darwin-uninstaller.tests.uninstaller \
|
2024-11-07 05:47:15 +00:00
|
|
|
--extra-experimental-features "nix-command flakes" \
|
|
|
|
--override-input nixpkgs nixpkgs/nixpkgs-unstable
|
2023-04-28 11:26:11 +00:00
|
|
|
|
2023-05-19 11:33:38 +00:00
|
|
|
install-flake-against-stable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2020-10-18 12:36:51 +00:00
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-10-22 03:48:39 +00:00
|
|
|
- name: Install nix version corresponding to latest stable channel
|
|
|
|
uses: cachix/install-nix-action@v30
|
2021-03-24 19:26:32 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.18.8/install
|
2023-06-20 12:54:31 +00:00
|
|
|
- name: Install nix-darwin
|
2023-05-19 11:33:38 +00:00
|
|
|
run: |
|
2023-06-24 03:58:56 +00: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 \
|
2024-11-11 11:30:42 +00:00
|
|
|
"s/# programs.fish.enable = true;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
2023-06-24 03:58:56 +00:00
|
|
|
flake.nix
|
2024-11-17 02:11:30 +00:00
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
's/nixpkgs.hostPlatform = "aarch64-darwin";/nixpkgs.hostPlatform = "'$(nix eval --expr builtins.currentSystem --impure --raw)'";/' \
|
|
|
|
flake.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
popd
|
2023-06-20 12:54:31 +00:00
|
|
|
nix run .#darwin-rebuild -- \
|
2023-06-24 03:58:56 +00:00
|
|
|
switch --flake ~/.config/nix-darwin#simple \
|
2023-07-13 12:35:54 +00:00
|
|
|
--override-input nix-darwin . \
|
2023-06-20 12:54:31 +00:00
|
|
|
--override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2024-11-17 05:16:32 +00:00
|
|
|
- name: Switch to new configuration
|
2023-05-19 11:33:38 +00:00
|
|
|
run: |
|
2024-11-19 01:50:32 +00:00
|
|
|
. /etc/bashrc
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/pkgs.vim/pkgs.hello/" \
|
|
|
|
~/.config/nix-darwin/flake.nix
|
|
|
|
|
2024-11-17 02:11:30 +00:00
|
|
|
darwin-rebuild switch --flake ~/.config/nix-darwin#simple \
|
|
|
|
--override-input nix-darwin . \
|
|
|
|
--override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
hello
|
2024-11-04 00:55:15 +00:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
|
|
|
nix run .#darwin-uninstaller --override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
|
|
|
nix run .#darwin-uninstaller.tests.uninstaller --override-input nixpkgs nixpkgs/${{ env.CURRENT_STABLE_CHANNEL }}
|
2023-05-19 11:33:38 +00:00
|
|
|
|
|
|
|
install-flake-against-unstable:
|
2024-11-04 16:21:37 +00:00
|
|
|
runs-on: macos-13
|
2023-05-19 11:33:38 +00:00
|
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
2024-11-04 03:37:59 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:26:11 +00:00
|
|
|
- name: Install nix from current unstable channel
|
2024-10-22 03:48:39 +00:00
|
|
|
uses: cachix/install-nix-action@v30
|
2024-09-10 20:14:05 +00:00
|
|
|
with:
|
2024-10-22 03:48:39 +00:00
|
|
|
install_url: https://releases.nixos.org/nix/nix-2.24.9/install
|
2023-06-20 12:54:31 +00:00
|
|
|
- name: Install nix-darwin
|
2023-04-28 11:26:11 +00:00
|
|
|
run: |
|
2023-06-24 03:58:56 +00: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 \
|
2024-11-11 11:30:42 +00:00
|
|
|
"s/# programs.fish.enable = true;/nix.settings.access-tokens = [ \"github.com=\${{ secrets.GITHUB_TOKEN }}\" ]; environment.etc.\"nix\/nix.conf\".knownSha256Hashes = [ \"$nixConfHash\" ];/" \
|
2023-06-24 03:58:56 +00:00
|
|
|
flake.nix
|
2024-11-17 02:11:30 +00:00
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
's/nixpkgs.hostPlatform = "aarch64-darwin";/nixpkgs.hostPlatform = "'$(nix eval --expr builtins.currentSystem --impure --raw)'";/' \
|
|
|
|
flake.nix
|
2023-06-24 03:58:56 +00:00
|
|
|
popd
|
2023-06-20 12:54:31 +00:00
|
|
|
nix run .#darwin-rebuild -- \
|
2023-06-24 03:58:56 +00:00
|
|
|
switch --flake ~/.config/nix-darwin#simple \
|
2023-07-13 12:35:54 +00:00
|
|
|
--override-input nix-darwin . \
|
2023-06-20 12:54:31 +00:00
|
|
|
--override-input nixpkgs nixpkgs/nixpkgs-unstable
|
2024-11-17 05:16:32 +00:00
|
|
|
- name: Switch to new configuration
|
2023-04-28 11:26:11 +00:00
|
|
|
run: |
|
2024-11-19 01:50:32 +00:00
|
|
|
. /etc/bashrc
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
/usr/bin/sed -i.bak \
|
|
|
|
"s/pkgs.vim/pkgs.hello/" \
|
|
|
|
~/.config/nix-darwin/flake.nix
|
|
|
|
|
2024-11-17 02:11:30 +00:00
|
|
|
darwin-rebuild switch --flake ~/.config/nix-darwin#simple \
|
|
|
|
--override-input nix-darwin . \
|
|
|
|
--override-input nixpkgs nixpkgs/nixpkgs-unstable
|
2024-11-17 05:16:32 +00:00
|
|
|
|
|
|
|
hello
|
2024-11-04 00:55:15 +00:00
|
|
|
- name: Test uninstallation of nix-darwin
|
|
|
|
run: |
|
|
|
|
nix run .#darwin-uninstaller --override-input nixpkgs nixpkgs/nixpkgs-unstable
|
|
|
|
nix run .#darwin-uninstaller.tests.uninstaller --override-input nixpkgs nixpkgs/nixpkgs-unstable
|