From 070edd9ff6efef503b61d34402633753c15e7db6 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 23 May 2025 19:52:15 -0400 Subject: [PATCH 1/2] Run the build on aarch64 too --- .github/workflows/ci.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7429699..463faa9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,16 @@ on: jobs: build: - runs-on: UbuntuLatest32Cores128G + strategy: + matrix: + runners: + - runner: UbuntuLatest32Cores128G + system: x86_64-linux + + - runner: UbuntuLatest32Cores128GArm + system: aarch64-linux + + runs-on: ${{ matrix.runners.runner }} permissions: id-token: write contents: write @@ -18,10 +27,10 @@ jobs: - uses: DeterminateSystems/flakehub-cache-action@main - - run: nix build .#iso + - run: nix build .#packages.${{ matrix.runners.system }}.iso - uses: actions/upload-artifact@v4 with: - name: nixos-with-determinate.iso + name: nixos-with-determinate-${{ matrix.runners.system }}.iso path: ./result/iso/* retention-days: 90 From 954add6e704a197e74261d4ace13ceb8820e68e5 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 23 May 2025 22:20:17 -0400 Subject: [PATCH 2/2] fmt, build arm --- .github/workflows/ci.yml | 4 ++ flake.nix | 139 ++++++++++++++++++++++++++------------- 2 files changed, 97 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 463faa9..c81e6ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,11 @@ jobs: - uses: DeterminateSystems/flakehub-cache-action@main + - run: nix develop --command nixfmt --check . + if: success() || failure() + - run: nix build .#packages.${{ matrix.runners.system }}.iso + if: success() || failure() - uses: actions/upload-artifact@v4 with: diff --git a/flake.nix b/flake.nix index 4ccbf51..96f198b 100644 --- a/flake.nix +++ b/flake.nix @@ -11,58 +11,105 @@ fh, ... }: - { - packages.x86_64-linux.toplevel = self.nixosConfigurations.install.config.system.build.toplevel; - packages.x86_64-linux.iso = self.nixosConfigurations.install.config.system.build.isoImage; + let + forSystems = + s: f: + nixpkgs.lib.genAttrs s ( + system: + f rec { + inherit system; + pkgs = nixpkgs.legacyPackages.${system}; + } + ); - nixosConfigurations.install = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - # Load the Determinate module - determinate.nixosModules.default - "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal-combined.nix" - ( - { options, pkgs, lib, ... }: - { - environment.systemPackages = [ fh.packages.${pkgs.stdenv.hostPlatform.system}.default ]; - environment.etc."nixos/flake.nix" = { - source = ./flake.nix; - mode = "0644"; - }; - environment.etc."nixos/flake.lock" = { - source = ./flake.lock; - mode = "0644"; - }; - environment.etc."nixos-generate-config.conf".text = '' - [Defaults] - Flake=1 - ''; + forAllSystems = forSystems [ + "aarch64-darwin" + "x86_64-darwin" + "x86_64-linux" + "aarch64-linux" + ]; + forLinuxSystems = forSystems [ + "x86_64-linux" + "aarch64-linux" + ]; + in + { + devShells = forAllSystems ( + { system, pkgs, ... }: + { + default = pkgs.mkShellNoCC { + buildInputs = with pkgs; [ + nixfmt-rfc-style + ]; + }; + } + ); - networking.wireless.enable = lib.mkForce false; - networking.networkmanager.enable = true; + packages = forLinuxSystems ( + { system, ... }: + { + toplevel = self.nixosConfigurations.${system}.install.config.system.build.toplevel; + iso = self.nixosConfigurations.${system}.install.config.system.build.isoImage; + } + ); - system.nixos-generate-config.flake = '' + nixosConfigurations = forLinuxSystems ( + { system, ... }: + { + install = nixpkgs.lib.nixosSystem { + system = system; + modules = [ + # Load the Determinate module + determinate.nixosModules.default + "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal-combined.nix" + ( + { + options, + pkgs, + lib, + ... + }: { - inputs = { - determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/3"; - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # NixOS, rolling release - # nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # NixOS, current stable + environment.systemPackages = [ fh.packages.${pkgs.stdenv.hostPlatform.system}.default ]; + environment.etc."nixos/flake.nix" = { + source = ./flake.nix; + mode = "0644"; }; - outputs = inputs\@{ self, nixpkgs, determinate, ... }: { - # NOTE: '${options.networking.hostName.default}' is the default hostname - nixosConfigurations.${options.networking.hostName.default} = nixpkgs.lib.nixosSystem { - modules = [ - determinate.nixosModule.default - ./configuration.nix - ]; - }; + environment.etc."nixos/flake.lock" = { + source = ./flake.lock; + mode = "0644"; }; + environment.etc."nixos-generate-config.conf".text = '' + [Defaults] + Flake=1 + ''; + + networking.wireless.enable = lib.mkForce false; + networking.networkmanager.enable = true; + + system.nixos-generate-config.flake = '' + { + inputs = { + determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/3"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # NixOS, rolling release + # nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # NixOS, current stable + }; + outputs = inputs\@{ self, nixpkgs, determinate, ... }: { + # NOTE: '${options.networking.hostName.default}' is the default hostname + nixosConfigurations.${options.networking.hostName.default} = nixpkgs.lib.nixosSystem { + modules = [ + determinate.nixosModule.default + ./configuration.nix + ]; + }; + }; + } + ''; } - ''; - } - ) - ]; - }; + ) + ]; + }; + } + ); }; - }