diff options
| -rw-r--r-- | flake.nix | 19 |
1 files changed, 18 insertions, 1 deletions
| @@ -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 |