Skip to content

Commit 75408a6

Browse files
committed
Try to pass GITHUB_TOKEN to guest in nixos-rebuild
1 parent b954e8f commit 75408a6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/macos.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
limactl start --name=nixsample --set '.user.name = "${{ env.LIMA_USER }}"' nixos.yaml
4747
4848
- name: "Initialize Home Manager"
49+
if: false # Disable for now because this step is timing out
4950
env:
5051
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5152
LIMA_NAME: "nixsample"
@@ -67,10 +68,22 @@ jobs:
6768
limactl shell nixsample -- sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $LIMA_USER
6869
6970
- name: "Update and Rebuild NixOS"
70-
if: false # Disable for now because this step is timing out
71+
env:
72+
LIMA_NAME: "nixsample"
73+
GUEST_HOME: "/home/lima.linux"
74+
CONFIG_DIR: "/home/lima.linux/.config"
75+
NIXOS_CONFIG_REPO: "https://github.com/nixos-lima/nixos-lima-config-sample.git"
7176
run: |
7277
set -eux
73-
./setup-rebuild-nixos.sh ${{ env.LIMA_USER }}
78+
# Create ~/.config if it doesn't already exist
79+
limactl shell nixsample -- mkdir -p $CONFIG_DIR
80+
# Checkout NIXOS_CONFIG_REPO containing your NixOS host configuration flake
81+
limactl shell nixsample -- git clone --bare $NIXOS_CONFIG_REPO $CONFIG_DIR/nixos-config
82+
# Setup NixOS system config in separate-git-dir owned by user, with working directory in /etc/nixos
83+
limactl shell nixsample -- sudo git init --separate-git-dir=$CONFIG_DIR/nixos-config --shared=group /etc/nixos
84+
limactl shell nixsample -- sudo chown $LIMA_USER:wheel -R $CONFIG_DIR/nixos-config
85+
limactl shell nixsample -- sudo bash -c "cd /etc/nixos ; git checkout master"
86+
limactl shell nixsample -- sudo bash -c "NIX_CONFIG='access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}' nixos-rebuild switch --flake .#sample"
7487
7588
- name: Upload artifacts
7689
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)