Skip to content

Commit

Permalink
nix: add flake and derivation
Browse files Browse the repository at this point in the history
Referenced issue: waku-org/nwaku#3232

Signed-off-by: markoburcul <[email protected]>
  • Loading branch information
markoburcul committed Jan 22, 2025
1 parent 00f8d03 commit 7cbb57c
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ debug/
target/
wabt/

# Generated by Nix
result/

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
20 changes: 20 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ pkgs }:

pkgs.rustPlatform.buildRustPackage {
pname = "zerokit";
version = "nightly";

src = ./.;

cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};

CARGO_HOME = "/tmp";

meta = with pkgs.lib; {
description = "Zerokit";
license = licenses.mit;
};
}
27 changes: 27 additions & 0 deletions flake.lock

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

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "A flake for building zerokit";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};

outputs = { self, nixpkgs }:
let
stableSystems = [
"x86_64-linux" "aarch64-linux"
"x86_64-darwin" "aarch64-darwin"
"x86_64-windows" "i686-linux"
"i686-windows"
];
forAllSystems = nixpkgs.lib.genAttrs stableSystems;
pkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
packages = forAllSystems (system: let
pkgs = pkgsFor.${system};
in {
default = pkgs.callPackage ./default.nix {};
});
};
}

0 comments on commit 7cbb57c

Please sign in to comment.