Skip to content

Commit

Permalink
add nix flake to build the package
Browse files Browse the repository at this point in the history
  • Loading branch information
elmarx committed Jun 8, 2024
1 parent 3f6196c commit 1b221b1
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
.idea

result
/target
127 changes: 127 additions & 0 deletions flake.lock

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

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "Description for the project";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
# To import a flake module
# 1. Add foo to inputs
# 2. Add foo as a parameter to the outputs function
# 3. Add here: foo.flakeModule

];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
packages.default = pkgs.rustPlatform.buildRustPackage rec {
pname = "wg-mesh";
version = "0.1.0";

src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};

# rsdns runs rustfmt on build, so provide the binary
nativeBuildInputs = with pkgs; [
rustPlatform.bindgenHook
rustfmt
];

};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.

};
};
}

0 comments on commit 1b221b1

Please sign in to comment.