Skip to content

Commit

Permalink
💚 Move home-manager tests to own workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Snuggle committed Sep 16, 2024
1 parent cdf31fc commit 6c3c9fb
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 3 deletions.
34 changes: 32 additions & 2 deletions .github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ build_ci_system() {
build_cherry_system
elif [[ $1 == "pineapple" ]]; then
build_pineapple_system
elif [[ $1 == "snuggle@pineapple" ]]; then
build_pineapple_home
elif [[ $1 == "snuggle@cherry" ]]; then
build_cherry_home
else
echo "Unknown option!"
fi
Expand All @@ -27,7 +31,6 @@ build_cherry_system() {
# -I nixos-config=configuration.nix \
# -A system --dry-run
nix build --dry-run --experimental-features 'nix-command flakes' '.#nixosConfigurations.cherry.config.system.build.toplevel'
nix-shell -p home-manager home-manager build --flake .#snuggle@cherry
}

build_pineapple_system() {
Expand All @@ -42,7 +45,34 @@ build_pineapple_system() {
# -I nixos-config=configuration.nix \
# -A system --dry-run
nix build --dry-run --experimental-features 'nix-command flakes' '.#nixosConfigurations.pineapple.config.system.build.toplevel'
nix-shell -p home-manager home-manager build --flake .#snuggle@pineapple
}

build_pineapple_home() {
echo "🔨 Building snuggle@pineapple home-manager"
echo $NIX_PATH
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
sudo nix-channel --update

echo "🧪 Testing system configuration…"
#NIX_PATH=/home/$USER/.nix-defexpr/channels:nixpkgs=channel:nixos-unstable nix-build '<nixpkgs/nixos>' \
# -I nixos-config=configuration.nix \
# -A system --dry-run
nix-shell -p home-manager "home-manager build --flake .#snuggle@pineapple"
}

build_cherry_home() {
echo "🔨 Building snuggle@cherry home-manager"
echo $NIX_PATH
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
sudo nix-channel --update

echo "🧪 Testing system configuration…"
#NIX_PATH=/home/$USER/.nix-defexpr/channels:nixpkgs=channel:nixos-unstable nix-build '<nixpkgs/nixos>' \
# -I nixos-config=configuration.nix \
# -A system --dry-run
nix-shell -p home-manager "home-manager build --flake .#snuggle@cherry"
}

build_ci_system $@
2 changes: 1 addition & 1 deletion .github/workflows/pineapple.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Host: '🍍 pineapple'"
name: "Host: '🍍 pineapple' System"

on:
pull_request:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Host: '🍒 snuggle@cherry' Home"

on:
pull_request:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '.gitattributes'
- '.gitignore'
- 'outputs/home-conf.nix'
- 'outputs/installation.nix'
- 'build'
- 'switch'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: "Install Nix ❄️"
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: "experimental-features = nix-command"

- name: "Install Cachix ❄️"
uses: cachix/cachix-action@v12
with:
name: snuggle
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: "Build NixOS config ❄️"
run: chmod +x ./.github/build.sh && ./.github/build.sh snuggle@cherry
36 changes: 36 additions & 0 deletions .github/workflows/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Host: '🍍 snuggle@pineapple' Home"

on:
pull_request:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '.gitattributes'
- '.gitignore'
- 'outputs/home-conf.nix'
- 'outputs/installation.nix'
- 'build'
- 'switch'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: "Install Nix ❄️"
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: "experimental-features = nix-command"

- name: "Install Cachix ❄️"
uses: cachix/cachix-action@v12
with:
name: snuggle
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: "Build NixOS config ❄️"
run: chmod +x ./.github/build.sh && ./.github/build.sh snuggle@pineapple

0 comments on commit 6c3c9fb

Please sign in to comment.