Skip to content

Commit

Permalink
Split resulting package to few outputs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander V. Nikolaev <[email protected]>
  • Loading branch information
avnik committed Aug 23, 2024
1 parent e51fa6a commit 1fcc8e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 4 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@
];
};
in
{
rec {
givc-app = pkgs.callPackage ./nixos/packages/givc-app.nix { inherit src; };
givc-agent = pkgs.callPackage ./nixos/packages/givc-agent.nix { inherit src; };
givc-admin = pkgs.callPackage ./nixos/packages/givc-admin.nix { inherit src; };
givc-admin-rs = pkgs.callPackage ./nixos/packages/givc-admin-rs.nix {
inherit crane;
src = ./.;
};
givc-cli = givc-admin-rs.cli;
};
};
flake = {
Expand All @@ -83,8 +84,8 @@

# Overlays
overlays.default = _final: prev: {
src = ./.;
givc-app = prev.callPackage ./nixos/packages/givc-app.nix { pkgs = prev; };
inherit (self.packages.${prev.stdenv.hostPlatform.system}) givc-app;
givc-cli = self.packages.${prev.stdenv.hostPlatform.system}.givc-admin-rs.cli;
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nixos/packages/givc-admin-rs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ let
givc = craneLib.buildPackage (
commonArgs
// {
outputs = [
"out"
"cli"
"agent"
];
cargoArtifacts = craneLib.buildDepsOnly commonArgs;

# Additional environment variables or build phases/hooks can be set
Expand All @@ -39,6 +44,11 @@ let
# Avoid issue with source filtering, put symlink back into source tree
ln -sf ../api $sourceRoot/common/api
'';
postInstall = ''
mkdir -p $cli/bin $agent/bin
mv $out/bin/givc-cli $cli/bin/givc-cli
mv $out/bin/givc-agent $agent/bin/givc-agent
'';
}
);
in
Expand Down
2 changes: 1 addition & 1 deletion nixos/tests/admin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ in
testScript =
{ nodes, ... }:
let
cli = "${self'.packages.givc-admin-rs}/bin/givc-cli";
cli = "${self'.packages.givc-admin-rs.cli}/bin/givc-cli";
expected = "givc-ghaf-host.service"; # Name which we _expect_ to see registered in admin server's registry
in
# FIXME: why it so bizzare? (derived from name in cert)
Expand Down

0 comments on commit 1fcc8e3

Please sign in to comment.