Skip to content

Commit

Permalink
Move from naersk to buildRustPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Aug 14, 2024
1 parent 3e0a030 commit d3d09fe
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 61 deletions.
18 changes: 11 additions & 7 deletions agent/default.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
pkgs,
naersk',
rustPlatform,
version,
gitRevision,
buildInputs,
nativeBuildInputs,
}: rec {
satori-agent = naersk'.buildPackage {
name = "satori-agent";
satori-agent = rustPlatform.buildRustPackage {
pname = "satori-agent";
version = version;

src = ./..;
cargoBuildOptions = x: x ++ ["--package" "satori-agent"];
cargoLock.lockFile = ../Cargo.lock;

nativeBuildInputs = nativeBuildInputs ++ [pkgs.makeWrapper];
buildInputs = buildInputs;

cargoBuildFlags = ["--package satori-agent"];

GIT_REVISION = gitRevision;

# Ensure ffmpeg binary is available
postInstall = ''
wrapProgram $out/bin/satori-agent --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.ffmpeg]}
'';
overrideMain = p: {
GIT_REVISION = gitRevision;
};

# No need to do tests here, testing should have already been done earlier in CI pipeline
doCheck = false;
};

satori-agent-container-image = let
Expand Down
17 changes: 10 additions & 7 deletions archiver/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
{
pkgs,
naersk',
rustPlatform,
version,
gitRevision,
buildInputs,
nativeBuildInputs,
}: rec {
satori-archiver = naersk'.buildPackage {
name = "satori-archiver";
satori-archiver = rustPlatform.buildRustPackage {
pname = "satori-archiver";
version = version;

src = ./..;
cargoBuildOptions = x: x ++ ["--package" "satori-archiver"];
cargoLock.lockFile = ../Cargo.lock;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;

overrideMain = p: {
GIT_REVISION = gitRevision;
};
cargoBuildFlags = ["--package satori-archiver"];

GIT_REVISION = gitRevision;

# No need to do tests here, testing should have already been done earlier in CI pipeline
doCheck = false;
};

satori-archiver-container-image = pkgs.dockerTools.buildImage {
Expand Down
17 changes: 10 additions & 7 deletions ctl/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
{
pkgs,
naersk',
rustPlatform,
version,
gitRevision,
buildInputs,
nativeBuildInputs,
}: rec {
satorictl = naersk'.buildPackage {
name = "satorictl";
satorictl = rustPlatform.buildRustPackage {
pname = "satorictl";
version = version;

src = ./..;
cargoBuildOptions = x: x ++ ["--package" "satorictl"];
cargoLock.lockFile = ../Cargo.lock;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;

overrideMain = p: {
GIT_REVISION = gitRevision;
};
cargoBuildFlags = ["--package satorictl"];

GIT_REVISION = gitRevision;

# No need to do tests here, testing should have already been done earlier in CI pipeline
doCheck = false;
};

satorictl-container-image = pkgs.dockerTools.buildImage {
Expand Down
17 changes: 10 additions & 7 deletions event-processor/default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
{
pkgs,
naersk',
rustPlatform,
version,
gitRevision,
buildInputs,
nativeBuildInputs,
}: rec {
satori-event-processor = naersk'.buildPackage {
name = "satori-event-processor";
satori-event-processor = rustPlatform.buildRustPackage {
pname = "satori-event-processor";
version = version;

src = ./..;
cargoBuildOptions = x: x ++ ["--package" "satori-event-processor"];
cargoLock.lockFile = ../Cargo.lock;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;

overrideMain = p: {
GIT_REVISION = gitRevision;
};
cargoBuildFlags = ["--package satori-event-processor"];

GIT_REVISION = gitRevision;

# No need to do tests here, testing should have already been done earlier in CI pipeline
doCheck = false;
};

satori-event-processor-container-image = pkgs.dockerTools.buildImage {
Expand Down
21 changes: 0 additions & 21 deletions flake.lock

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

17 changes: 5 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";

flake-utils.url = "github:numtide/flake-utils";

naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
flake-utils,
naersk,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = (import nixpkgs) {
inherit system;
};

naersk' = pkgs.callPackage naersk {
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.cargo;
rustc = pkgs.rustc;
};
Expand Down Expand Up @@ -67,10 +60,10 @@
};

packages =
import ./agent {inherit pkgs naersk' version gitRevision nativeBuildInputs buildInputs;}
// import ./archiver {inherit pkgs naersk' version gitRevision nativeBuildInputs buildInputs;}
// import ./ctl {inherit pkgs naersk' version gitRevision nativeBuildInputs buildInputs;}
// import ./event-processor {inherit pkgs naersk' version gitRevision nativeBuildInputs buildInputs;};
import ./agent {inherit pkgs rustPlatform version gitRevision nativeBuildInputs buildInputs;}
// import ./archiver {inherit pkgs rustPlatform version gitRevision nativeBuildInputs buildInputs;}
// import ./ctl {inherit pkgs rustPlatform version gitRevision nativeBuildInputs buildInputs;}
// import ./event-processor {inherit pkgs rustPlatform version gitRevision nativeBuildInputs buildInputs;};
}
);
}

0 comments on commit d3d09fe

Please sign in to comment.