upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-09 13:15:25 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-09 16:22:34 +0100
commitf6f7f81f94fe00df0dd756b517848296a622867c (patch)
tree028ee62fae8533c1baa8a33802e5f4cb1c4db806 /flake.nix
parentc394faff72d618abdb940c62a3009589adafdbee (diff)
build: use nix to build binaries
using rustPlatform.buildRustPackage as used in nixpkgs
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index bdaa633..5015dba 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,6 +12,7 @@
12 pkgs = import nixpkgs { 12 pkgs = import nixpkgs {
13 inherit system overlays; 13 inherit system overlays;
14 }; 14 };
15 manifest = pkgs.lib.importTOML ./Cargo.toml;
15 in 16 in
16 with pkgs; 17 with pkgs;
17 { 18 {
@@ -42,6 +43,22 @@
42 export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} 43 export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
43 ''; 44 '';
44 }; 45 };
46 # Create packages for each binary defined in Cargo.toml
47 packages = lib.listToAttrs (map (bin: {
48 inherit (bin) name;
49 value = pkgs.rustPlatform.buildRustPackage {
50 pname = bin.name;
51 version = manifest.package.version;
52 src = bin.path;
53 cargoLock = {
54 lockFile = ./Cargo.lock;
55 };
56 buildInputs = [
57 pkgs.pkg-config
58 pkgs.openssl
59 ];
60 };
61 }) manifest.bin);
45 } 62 }
46 ); 63 );
47} 64} \ No newline at end of file