diff --git a/.github/workflows/orca.yaml b/.github/workflows/orca.yaml index de5b41f..ea25220 100644 --- a/.github/workflows/orca.yaml +++ b/.github/workflows/orca.yaml @@ -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 diff --git a/flake.nix b/flake.nix index 4b26ac5..eacded7 100644 --- a/flake.nix +++ b/flake.nix @@ -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; @@ -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; }; @@ -75,6 +83,7 @@ packages = { orca = orca-stuff.package; + orca-min = orca-stuff.package-min; gray-whale = gray-whale-stuff.package; }; diff --git a/orca/default.nix b/orca/default.nix index 1ed102e..f809542 100644 --- a/orca/default.nix +++ b/orca/default.nix @@ -7,6 +7,7 @@ makeWrapper, nix-gitignore, buildFeatures ? [ ], + rustPlatform, craneLib, system, lib, @@ -19,6 +20,7 @@ let nativeBuildInputs = [ openssl pkg-config + makeWrapper ]; # Build *just* the cargo dependencies, so we can reuse @@ -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;