Skip to content

Commit

Permalink
nix: Add server wrapper that include runtime deps
Browse files Browse the repository at this point in the history
While we don't have various deps bundled in the exe or in the case of
pipreqs we don't fetch it; use Nix to package them.
  • Loading branch information
richiejp committed Jul 25, 2024
1 parent 9e6bb76 commit 7f9c72e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions distros/nix/server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
lib, stdenv, makeWrapper, version, buildkit, nerdctl, pipreqs, cli
}:
let
runtimeDeps = [ buildkit nerdctl pipreqs ];
in
stdenv.mkDerivation {
pname = "ayup-server";
meta.mainProgram = "ay";
inherit version;
src = cli;
nativeBuildInputs = [ makeWrapper ];
buildInputs = runtimeDeps;
installPhase = ''
mkdir -p $out/bin
cp $src/bin/ay $out/bin/
wrapProgram $out/bin/ay \
--prefix PATH : ${ lib.makeBinPath runtimeDeps }
'';
}
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
GOOS = "linux";
GOARCH = "amd64";
};
server = pkgs.callPackage ./distros/nix/server.nix {
inherit version cli;
};
in
{
devShells.${system}.default = pkgs.mkShell {
Expand All @@ -67,6 +70,8 @@
packages.${system} = {
inherit src;
inherit cli cli-darwin-amd64 cli-darwin-arm64 cli-linux-arm64 cli-linux-amd64;
inherit server;

default = cli;
dev = pkgs.stdenv.mkDerivation {
pname = "dev";
Expand Down

0 comments on commit 7f9c72e

Please sign in to comment.