Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci/pr): build OS configurations #107

Merged
merged 8 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
name: Build

on:
pull_request:
push:
branches: [develop]


jobs:
lints:
name: Build
runs-on: ubuntu-22.04
os:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-13]
name: OS
runs-on: ${{ matrix.os }}
permissions:
id-token: "write"
contents: "read"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
# - name: Run `nix build`
# run: nix build .
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v12
- uses: DeterminateSystems/magic-nix-cache-action@v7
- uses: DeterminateSystems/flake-checker-action@v8
- run: |
nix build .#build-os-configurations
ls -lha result/
47 changes: 25 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 46 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
inputs = {
nixpkgs.follows = "nixpkgs-23-11";
nixpkgs-23-11 = {url = "github:nixos/nixpkgs/nixos-23.11";};
nixpkgsNix = {url = "github:nixos/nixpkgs/nixos-unstable";};
nixpkgs-24-05 = {url = "github:nixos/nixpkgs/nixos-24.05";};
nixpkgsNix.follows = "nixpkgs-24-05";
nixpkgsGithubActionRunners = {url = "github:nixos/nixpkgs/nixos-unstable";};
nixpkgsUnstable = {url = "github:nixos/nixpkgs/nixos-unstable";};
nixpkgsMaster = {url = "github:nixos/nixpkgs/master";};
Expand Down Expand Up @@ -135,6 +136,7 @@
inputs',
pkgs,
lib,
system,
...
}: {
# Per-system attributes can be defined here. The self' and inputs'
Expand Down Expand Up @@ -221,11 +223,49 @@
'';
};

packages = {
nomad = inputs'.nixpkgs.legacyPackages.nomad_1_6;

nixos-anywhere = inputs'.nixos-anywhere.packages.default;
};
packages =
{
# nomad = pkgs.nomad_1_6;

nixos-anywhere = inputs'.nixos-anywhere.packages.default;
}
// (
let
mkOsConfigCheck = osConfigs: let
filteredBySystem =
lib.filterAttrs (
key: value:
(value.pkgs.system == system)
# needs private repos
&& (key != "tfgrid-hpos")
)
osConfigs;
asStrings =
lib.mapAttrsToList (
key: value:
builtins.trace "evaluating ${key} (${value.pkgs.system})..."
"ln -s ${value.config.system.build.toplevel} $out/${key}"
)
filteredBySystem;
in
pkgs.stdenv.mkDerivation {
name = "check-osconfigurations";
phases = "installPhase";
installPhase = "mkdir $out;" + builtins.concatStringsSep "\n" asStrings;
};
in {
build-os-configurations =
if pkgs.stdenv.isLinux
then
mkOsConfigCheck (builtins.removeAttrs self.nixosConfigurations [
# too big for current CI structure and rarely used
"vm-nixcache"
])
else if pkgs.stdenv.isDarwin
then mkOsConfigCheck self.darwinConfigurations
else throw "unexpected case";
}
);
};
flake = {
# The usual flake attributes can be defined here, including system-
Expand Down
2 changes: 1 addition & 1 deletion modules/nixos/kitsune-bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in {
enable = lib.mkEnableOption "kitsune-bootstrap";

package = lib.mkOption {
default = self.inputs.holochain.packages.${pkgs.system}.holochain;
default = self.inputs.holochain.packages.${pkgs.system}.holochain.override {cargoExtraArgs = " --bin kitsune-bootstrap";};
type = lib.types.package;
};

Expand Down
2 changes: 1 addition & 1 deletion modules/nixos/shared.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# ]
;

nix.package = lib.mkDefault inputs.nixpkgsNix.legacyPackages.${pkgs.stdenv.system}.nixVersions.nix_2_20;
nix.package = lib.mkDefault inputs.nixpkgsNix.legacyPackages.${pkgs.stdenv.system}.nixVersions.nix_2_21;

nix.settings.extra-platforms =
lib.mkIf pkgs.stdenv.isDarwin ["x86_64-darwin" "aarch64-darwin"];
Expand Down