Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flake and switch to buildRustPackage #138

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
34 changes: 7 additions & 27 deletions flake.lock

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

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

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 All @@ -36,7 +29,7 @@
buildInputs = with pkgs; [openssl];

lintingRustFlags = "-D unused-crate-dependencies";
in rec {
in {
devShell = pkgs.mkShell {
nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;
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;};
}
);
}