Skip to content

Commit 0b9174b

Browse files
committed
macos.yml: Home Manager after nixos-rebuild, use NIX_CONFIG too
1 parent 75408a6 commit 0b9174b

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

.github/workflows/macos.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,6 @@ jobs:
4545
set -eux
4646
limactl start --name=nixsample --set '.user.name = "${{ env.LIMA_USER }}"' nixos.yaml
4747
48-
- name: "Initialize Home Manager"
49-
if: false # Disable for now because this step is timing out
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
LIMA_NAME: "nixsample"
53-
GUEST_HOME: "/home/lima.linux"
54-
CONFIG_DIR: "/home/lima.linux/.config"
55-
HOME_CONFIG_REPO: "https://github.com/nixos-lima/nixos-lima-config-sample.git"
56-
run: |
57-
set -eux
58-
# Create ~/.config if it doesn't already exist
59-
limactl shell nixsample -- mkdir -p $CONFIG_DIR
60-
# Checkout HOME_CONFIG_REPO containing your Home Manager configuration flake
61-
limactl shell nixsample -- git clone $HOME_CONFIG_REPO $CONFIG_DIR/home-manager
62-
# Temporarily (it will be overwritten on the next nixos-rebuild) add a GitHub access token to nix.conf so
63-
# we can init Home Manager without getting rate limited by GitHub Actions
64-
limactl shell nixsample -- sudo sh -c "echo 'access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}' >> /etc/nix/nix2.conf"
65-
# Initialize Home Manager
66-
limactl shell nixsample -- nix run home-manager/master -- init --switch
67-
# Configure subuid/subgid support for running rootless Podman services
68-
limactl shell nixsample -- sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $LIMA_USER
6948
7049
- name: "Update and Rebuild NixOS"
7150
env:
@@ -83,7 +62,27 @@ jobs:
8362
limactl shell nixsample -- sudo git init --separate-git-dir=$CONFIG_DIR/nixos-config --shared=group /etc/nixos
8463
limactl shell nixsample -- sudo chown $LIMA_USER:wheel -R $CONFIG_DIR/nixos-config
8564
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"
65+
limactl shell nixsample -- sudo bash -c "NIX_CONFIG='access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}' nixos-rebuild boot --flake .#sample"
66+
limactl stop nixsample
67+
limactl start nixsample
68+
69+
- name: "Initialize Home Manager"
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
LIMA_NAME: "nixsample"
73+
GUEST_HOME: "/home/lima.linux"
74+
CONFIG_DIR: "/home/lima.linux/.config"
75+
HOME_CONFIG_REPO: "https://github.com/nixos-lima/nixos-lima-config-sample.git"
76+
run: |
77+
set -eux
78+
# Create ~/.config if it doesn't already exist
79+
limactl shell nixsample -- mkdir -p $CONFIG_DIR
80+
# Checkout HOME_CONFIG_REPO containing your Home Manager configuration flake
81+
limactl shell nixsample -- git clone $HOME_CONFIG_REPO $CONFIG_DIR/home-manager
82+
# Initialize Home Manager
83+
limactl shell nixsample -- bash -c "NIX_CONFIG='access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}' nix run home-manager/master -- init --switch"
84+
# Configure subuid/subgid support for running rootless Podman services
85+
#limactl shell nixsample -- sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $LIMA_USER
8786
8887
- name: Upload artifacts
8988
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)