Skip to content

Commit

Permalink
Merge pull request #3 from ok-nick/ci
Browse files Browse the repository at this point in the history
add CI checking flake
  • Loading branch information
ok-nick authored Mar 31, 2024
2 parents 173fffe + 97cc0c5 commit d0f513c
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 21 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: check
on:
workflow_dispatch:
push:
paths:
- "src/**/*.nix"
- "flake.lock"
- "flake.nix"
- ".sops.yml"
- ".github/workflows/build.yml"
pull_request:
paths:
- "src/**/*.nix"
- "flake.lock"
- "flake.nix"
- ".sops.yml"
- ".github/workflows/build.yml"

jobs:
check:
strategy:
# always run all platforms disregarding failure
fail-fast: false
matrix:
# macos-14 is aarch64-darwin (silicone)
os: [ubuntu-latest, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

# install nix
- uses: DeterminateSystems/nix-installer-action@main
# cache packages
- uses: DeterminateSystems/magic-nix-cache-action@main
# info on flake dependencies
- uses: DeterminateSystems/flake-checker-action@main
env:
FLAKE_CHECKER_NO_TELEMETRY: true
# validate all outputs
- name: Validate flake outputs
# Building uses too much storage (more than available on GitHub runners) and passing --not-build
# causes a lot of errors. So, for now comment out the home-manager derivations in the flake checks
# and only test system configs. Not sure what else can be done besides somehow fixing all the
# upstream errors caused by packages when passing --no-build.
run: nix flake check --show-trace
28 changes: 28 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: update
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # Sunday at midnight

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# install nix
- uses: DeterminateSystems/nix-installer-action@main
# cache packages
- uses: DeterminateSystems/magic-nix-cache-action@main
# info on flake dependencies beforehand
- uses: DeterminateSystems/flake-checker-action@main
env:
FLAKE_CHECKER_NO_TELEMETRY: true
# TODO: run `nix flake check` on all platforms and if it works after update, submit PR
# update flake and send PR
- uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Update flake.lock"
pr-labels: bot
# https://github.com/DeterminateSystems/update-flake-lock?tab=readme-ov-file#with-a-personal-authentication-token
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,20 @@
modules = [./home/nicky/mapro.nix];
};
};

# TODO: make function to auto create this
# also, read github ci for why home manager configs are commented
checks = {
aarch64-darwin = {
"mapro" = self.darwinConfigurations.mapro.system;

# "nicky@mapro" = self.homeConfigurations."nicky@mapro".activationPackage;
};
x86_64-linux = {
# nixos configs are checked by default

# "nicky@icarus" = self.homeConfigurations."nicky@icarus".activationPackage;
};
};
};
}
6 changes: 3 additions & 3 deletions home/nicky/icarus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
imports = [
../shared/nix.nix

../shared/desktop/wms/hyprland
# ../shared/desktop/wms/sway
../shared/desktop/wayland.nix
../shared/desktop/wms/hyprland.nix
# ../shared/desktop/wms/sway.nix
../shared/desktop/wayland

../shared/desktop
../shared/desktop/discord.nix
Expand Down
1 change: 0 additions & 1 deletion home/shared/desktop/wms/gnome.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{
imports = [./common];
}
5 changes: 0 additions & 5 deletions home/shared/desktop/wms/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
}: let
grimblast = inputs.hyprland-contrib.packages.${pkgs.hostPlatform.system}.grimblast;
in {
imports = [
./common
./common/wayland
];

home.packages = [
grimblast
pkgs.jaq
Expand Down
5 changes: 0 additions & 5 deletions home/shared/desktop/wms/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
config,
...
}: {
imports = [
./common
./common/wayland
];

wayland.windowManager = {
sway = {
enable = true;
Expand Down
5 changes: 0 additions & 5 deletions home/shared/desktop/wms/wayfire.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{pkgs, ...}: {
imports = [
./common
./common/wayland
];

home.packages = with pkgs; [wayfire];

xdg.configFile."wayfire.ini".text = ''
Expand Down
2 changes: 1 addition & 1 deletion home/shared/dev/gpg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}: {
services.gpg-agent = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
pinentryFlavor = "gnome3";
pinentryPackage = pkgs.pinentry-gnome3;
};

programs = {
Expand Down
2 changes: 1 addition & 1 deletion hosts/nix-darwin/shared/homebrew.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
environment.systemPath = [/opt/homebrew/bin];
# environment.systemPath = [/opt/homebrew/bin];

homebrew = {
enable = true;
Expand Down

0 comments on commit d0f513c

Please sign in to comment.