Skip to content

Commit

Permalink
Orca: minimal build (#196)
Browse files Browse the repository at this point in the history
exploration for addressing
ictunion/main-system#194

The scope size become major problem as it forces us to upload gigabytes
of data during deployments. It also is blocker for making OS builds
possible in CI since these now fail on running out of disk space.
  • Loading branch information
turboMaCk authored and ICTGuerrilla committed Jan 14, 2025
1 parent 33e7979 commit 7ce8ca0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/orca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ jobs:

- name: Build via nix
run: nix build .#orca --log-format raw

nix-build-min:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

# Nix
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build via nix
run: nix build .#orca-min --log-format raw
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
orcaPkgs = pkgs.callPackage ./orca {
inherit craneLib;
inherit advisory-db;
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
};
in {
devShell = with pkgs;
Expand All @@ -45,6 +49,10 @@
OSFONTDIR = "${pkgs.ibm-plex}/share/fonts/opentype";
};
package = orcaPkgs.orca;
package-min = orcaPkgs.orca-min.overrideAttrs {
buildFeatures = [ "proxy-support"];
doCheck = false;
};
checks = {
inherit (orcaPkgs) orca orca-clippy orca-fmt orca-audit;
};
Expand Down Expand Up @@ -75,6 +83,7 @@

packages = {
orca = orca-stuff.package;
orca-min = orca-stuff.package-min;
gray-whale = gray-whale-stuff.package;
};

Expand Down
32 changes: 22 additions & 10 deletions orca/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
makeWrapper,
nix-gitignore,
buildFeatures ? [ ],
rustPlatform,
craneLib,
system,
lib,
Expand All @@ -19,6 +20,7 @@ let
nativeBuildInputs = [
openssl
pkg-config
makeWrapper
];

# Build *just* the cargo dependencies, so we can reuse
Expand All @@ -45,21 +47,31 @@ let
orca-audit = craneLib.cargoAudit {
inherit src advisory-db;
};
in
rec {

buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];

postInstall = ''
wrapProgram "$out/bin/orca" --suffix PATH : "${tex}/bin"
'';
in {
orca = craneLib.buildPackage {
inherit cargoArtifacts src;
inherit cargoArtifacts src buildInputs postInstall nativeBuildInputs;
cargoExtraArgs =
if buildFeatures == []
then ""
else ''--features "${lib.strings.concatStringsSep " " buildFeatures}"'';
nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper ];
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];
postInstall = ''
wrapProgram "$out/bin/orca" --suffix PATH : "${tex}/bin"
'';
};

orca-min = rustPlatform.buildRustPackage {
inherit src buildInputs postInstall nativeBuildInputs buildFeatures;
pname = "ict-union-orca-min";
version = "0.1.0";
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
};

inherit orca-clippy;
Expand Down

0 comments on commit 7ce8ca0

Please sign in to comment.