Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c67bdf688 |
@@ -29,6 +29,11 @@ jobs:
|
||||
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf
|
||||
sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true
|
||||
|
||||
- name: Set up nix-homebrew CI
|
||||
run: |
|
||||
sudo touch /etc/nix-homebrew-ci
|
||||
sudo mv /etc/nix/nix.conf{,.before-nix-darwin}
|
||||
|
||||
- name: Migrate existing Homebrew installation (imperative taps)
|
||||
run: |
|
||||
sudo rm /etc/bashrc
|
||||
|
||||
+11
-5
@@ -3,6 +3,11 @@ set -euo pipefail
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
real_nix="$(type -P nix)"
|
||||
nix() {
|
||||
"${real_nix}" --extra-experimental-features "nix-command flakes" "$@"
|
||||
}
|
||||
|
||||
if [[ "$#" != "1" ]]; then
|
||||
>&2 echo "Usage: $0 [example]"
|
||||
exit 1
|
||||
@@ -12,11 +17,12 @@ example="$1"
|
||||
system="$(nix eval --raw --impure --expr 'builtins.currentSystem')"
|
||||
>&2 echo "System: ${system}"
|
||||
|
||||
systemProfile="$(nix build "./${DIR}/..#ci.${system}.${example}.system" -L --no-link --print-out-paths)"
|
||||
>&2 echo "Built $systemProfile"
|
||||
flakeDarwinAttr="${system}.${example}"
|
||||
|
||||
sudo rm "/etc/nix/nix.conf"
|
||||
sudo "$systemProfile/activate"
|
||||
"$systemProfile/activate-user"
|
||||
darwinRebuild="$(nix build ".#darwinConfigurations.${flakeDarwinAttr}.config.system.build.darwin-rebuild" -L --no-link --print-out-paths)/bin/darwin-rebuild"
|
||||
>&2 echo "Built $darwinRebuild"
|
||||
|
||||
set -x
|
||||
"$darwinRebuild" switch --flake ".#${flakeDarwinAttr}" -L -v --option extra-experimental-features "nix-command flakes"
|
||||
|
||||
# vim: set et ts=2 sw=2:
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
|
||||
let
|
||||
inherit (pkgs) lib system;
|
||||
checkCIMarker = ''
|
||||
if [[ ! -e /etc/nix-homebrew-ci ]]; then
|
||||
>&2 echo "[!!] This configuration is only intended for nix-homebrew CI"
|
||||
>&2 echo "[!!] Refusing to activate since it will likely brick your machine"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
makeProfile = example: nix-darwin.lib.darwinSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
@@ -15,6 +22,9 @@ let
|
||||
nix-homebrew = {
|
||||
user = lib.mkForce "runner";
|
||||
};
|
||||
|
||||
system.activationScripts.preActivation.text = lib.mkBefore checkCIMarker;
|
||||
system.activationScripts.preUserActivation.text = lib.mkBefore checkCIMarker;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user