From 251bb102e3d5fcb741e93d2b278520a45336375b Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sat, 30 Mar 2024 15:52:10 -0400 Subject: [PATCH 1/3] add ci workflow --- .github/workflows/build.yml | 39 ++++++++++++++++++++++++++++++++++++ .github/workflows/update.yml | 28 ++++++++++++++++++++++++++ flake.nix | 12 +++++++++++ 3 files changed, 79 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5054335 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: check +on: + workflow_dispatch: + push: + paths: + - "src/" + - "flake.lock" + - "flake.nix" + - ".sops.yml" + - ".github/workflows/build.yml" + pull_request: + paths: + - "src/" + - "flake.lock" + - "flake.nix" + - ".sops.yml" + - ".github/workflows/build.yml" + +jobs: + check: + strategy: + 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 + run: nix flake check diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..f72a929 --- /dev/null +++ b/.github/workflows/update.yml @@ -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 }} diff --git a/flake.nix b/flake.nix index 55ba38f..92dd983 100755 --- a/flake.nix +++ b/flake.nix @@ -70,5 +70,17 @@ modules = [./home/nicky/mapro.nix]; }; }; + + # TODO: make function to auto create this + checks = { + aarch64-darwin = { + "mapro" = self.darwinConfigurations.mapro.system; + + "nicky@mapro" = self.homeConfigurations."nicky@mapro".activationPackage; + }; + x86_64-linux = { + "nicky@icarus" = self.homeConfigurations."nicky@icarus".activationPackage; + }; + }; }; } From fe35b445caa8ccc717e193cecdbc3a6962fdf42b Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sat, 30 Mar 2024 18:46:06 -0400 Subject: [PATCH 2/3] update linux config --- home/nicky/icarus.nix | 6 +++--- home/shared/desktop/wms/gnome.nix | 1 - home/shared/desktop/wms/hyprland.nix | 5 ----- home/shared/desktop/wms/sway.nix | 5 ----- home/shared/desktop/wms/wayfire.nix | 5 ----- home/shared/dev/gpg.nix | 2 +- 6 files changed, 4 insertions(+), 20 deletions(-) diff --git a/home/nicky/icarus.nix b/home/nicky/icarus.nix index d116c50..aa0cd48 100755 --- a/home/nicky/icarus.nix +++ b/home/nicky/icarus.nix @@ -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 diff --git a/home/shared/desktop/wms/gnome.nix b/home/shared/desktop/wms/gnome.nix index 849231d..2c63c08 100755 --- a/home/shared/desktop/wms/gnome.nix +++ b/home/shared/desktop/wms/gnome.nix @@ -1,3 +1,2 @@ { - imports = [./common]; } diff --git a/home/shared/desktop/wms/hyprland.nix b/home/shared/desktop/wms/hyprland.nix index 8f8936d..17ebf11 100755 --- a/home/shared/desktop/wms/hyprland.nix +++ b/home/shared/desktop/wms/hyprland.nix @@ -6,11 +6,6 @@ }: let grimblast = inputs.hyprland-contrib.packages.${pkgs.hostPlatform.system}.grimblast; in { - imports = [ - ./common - ./common/wayland - ]; - home.packages = [ grimblast pkgs.jaq diff --git a/home/shared/desktop/wms/sway.nix b/home/shared/desktop/wms/sway.nix index 667391f..7ed4d4e 100755 --- a/home/shared/desktop/wms/sway.nix +++ b/home/shared/desktop/wms/sway.nix @@ -3,11 +3,6 @@ config, ... }: { - imports = [ - ./common - ./common/wayland - ]; - wayland.windowManager = { sway = { enable = true; diff --git a/home/shared/desktop/wms/wayfire.nix b/home/shared/desktop/wms/wayfire.nix index a312c25..9c25a7b 100755 --- a/home/shared/desktop/wms/wayfire.nix +++ b/home/shared/desktop/wms/wayfire.nix @@ -1,9 +1,4 @@ {pkgs, ...}: { - imports = [ - ./common - ./common/wayland - ]; - home.packages = with pkgs; [wayfire]; xdg.configFile."wayfire.ini".text = '' diff --git a/home/shared/dev/gpg.nix b/home/shared/dev/gpg.nix index ad9bd7f..f0d3609 100755 --- a/home/shared/dev/gpg.nix +++ b/home/shared/dev/gpg.nix @@ -5,7 +5,7 @@ }: { services.gpg-agent = lib.mkIf pkgs.stdenv.isLinux { enable = true; - pinentryFlavor = "gnome3"; + pinentryPackage = pkgs.pinentry-gnome3; }; programs = { From 97cc0c594d3869620c7ef4e467c7b42c85cccf60 Mon Sep 17 00:00:00 2001 From: ok-nick Date: Sat, 30 Mar 2024 18:49:21 -0400 Subject: [PATCH 3/3] run ci on all .nix files in src --- .github/workflows/build.yml | 12 +++++++++--- flake.nix | 7 +++++-- hosts/nix-darwin/shared/homebrew.nix | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5054335..6e92a12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,14 +3,14 @@ on: workflow_dispatch: push: paths: - - "src/" + - "src/**/*.nix" - "flake.lock" - "flake.nix" - ".sops.yml" - ".github/workflows/build.yml" pull_request: paths: - - "src/" + - "src/**/*.nix" - "flake.lock" - "flake.nix" - ".sops.yml" @@ -19,6 +19,8 @@ on: jobs: check: strategy: + # always run all platforms disregarding failure + fail-fast: false matrix: # macos-14 is aarch64-darwin (silicone) os: [ubuntu-latest, macos-14] @@ -36,4 +38,8 @@ jobs: FLAKE_CHECKER_NO_TELEMETRY: true # validate all outputs - name: Validate flake outputs - run: nix flake check + # 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 diff --git a/flake.nix b/flake.nix index 92dd983..73d4fb1 100755 --- a/flake.nix +++ b/flake.nix @@ -72,14 +72,17 @@ }; # 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; + # "nicky@mapro" = self.homeConfigurations."nicky@mapro".activationPackage; }; x86_64-linux = { - "nicky@icarus" = self.homeConfigurations."nicky@icarus".activationPackage; + # nixos configs are checked by default + + # "nicky@icarus" = self.homeConfigurations."nicky@icarus".activationPackage; }; }; }; diff --git a/hosts/nix-darwin/shared/homebrew.nix b/hosts/nix-darwin/shared/homebrew.nix index e529b0d..04bc04d 100644 --- a/hosts/nix-darwin/shared/homebrew.nix +++ b/hosts/nix-darwin/shared/homebrew.nix @@ -1,5 +1,5 @@ { - environment.systemPath = [/opt/homebrew/bin]; + # environment.systemPath = [/opt/homebrew/bin]; homebrew = { enable = true;