Skip to content

Commit

Permalink
CI: clean up nix workflows; build default package
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed May 15, 2024
1 parent ff43125 commit bf26ec2
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 72 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/check.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/nix-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This is a re-usable workflow that is used by .github/workflows/check.yml to handle necessary setup
# before running Nix commands. E.g. this will install Nix and set up Magic Nix Cache
name: "Nix Setup"

on:
workflow_call:
inputs:
command:
required: false
type: string
platform:
default: "ubuntu"
required: false
type: string
secrets:
GH_TOKEN:
required: true

jobs:
nix:
runs-on: "${{ inputs.platform }}-latest"
steps:
- name: "Set default git branch (to reduce log spam)"
run: git config --global init.defaultBranch main

- name: "Checkout"
uses: actions/checkout@v4
with:
token: "${{ secrets.GH_TOKEN }}"

- name: "Set up QEMU support"
run: |
# This will allow for cross-compilation using Nix
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -q -y
sudo apt-get install -q -y binfmt-support qemu-efi qemu-system-aarch64 qemu-user-static
- name: "Install nix"
uses: cachix/install-nix-action@master
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
experimental-features = nix-command flakes fetch-tree
allow-import-from-derivation = false
extra-platforms = aarch64-linux
- name: "Cachix Setup"
uses: cachix/cachix-action@v14
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
name: hyprland-community

- name: "Nix Magic Cache"
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Run Input: ${{ inputs.command }}"
run: "${{ inputs.command }}"
79 changes: 31 additions & 48 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,36 @@
# This is a re-usable workflow that is used by .github/workflows/check.yml to handle necessary setup
# before running Nix commands. E.g. this will install Nix and set up Magic Nix Cache
name: "Nix Setup"
name: Check Flake Validity

on:
workflow_call:
inputs:
command:
required: false
type: string
platform:
default: "ubuntu"
required: false
type: string
secrets:
GH_TOKEN:
required: true
workflow_dispatch:
pull_request:
paths:
- "pyprland/**"
- "**.nix"
- "**.lock"
- ".github/workflows/check.yml"
push:
paths:
- "pyprland/**"
- "**.nix"
- "**.lock"
- ".github/workflows/check.yml"

jobs:
nix:
runs-on: "${{ inputs.platform }}-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
token: "${{ secrets.GH_TOKEN }}"

- name: "Set up QEMU support"
run: |
# This will allow for cross-compilation using Nix
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -q -y
sudo apt-get install -q -y binfmt-support qemu-efi qemu-system-aarch64 qemu-user-static
- name: "Install nix"
uses: cachix/install-nix-action@master
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
experimental-features = nix-command flakes fetch-tree
allow-import-from-derivation = false
extra-platforms = aarch64-linux
# extra substituters
# nix-community
extra-substituters = https://nix-community.cachix.org
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
- name: "Nix Magic Cache"
uses: DeterminateSystems/magic-nix-cache-action@main
check:
uses: ./.github/workflows/nix-setup.yml
secrets:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
command: nix flake check --accept-flake-config --print-build-logs

- name: "Run Input: ${{ inputs.command }}"
run: "${{ inputs.command }}"
build:
needs: [check]
uses: ./.github/workflows/nix-setup.yml
strategy:
matrix:
package:
- pyprland
secrets:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
command: nix build .#${{ matrix.package }} --print-build-logs

0 comments on commit bf26ec2

Please sign in to comment.