-
Notifications
You must be signed in to change notification settings - Fork 57
/
flake.nix
59 lines (51 loc) · 1.57 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
let
cargo-package = (builtins.fromTOML (builtins.readFile ./zeronsd/Cargo.toml)).package;
rust-version = "1.81.0";
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
config.allowUnfree = true;
};
devInputs = with pkgs; [
rust-bin.stable.${rust-version}.complete
pkg-config
openssl
toml-cli
] ++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
] ;
zeronsd-bin = pkgs.rustPlatform.buildRustPackage rec {
inherit (cargo-package) name version;
src = ./.;
buildAndTestSubdir = "zeronsd";
nativeBuildInputs = devInputs;
buildInputs = devInputs;
cargoLock.lockFile = ./Cargo.lock;
};
in rec {
devShells.default = pkgs.mkShell {
buildInputs = devInputs;
nativeBuildInputs = [ pkgs.just ];
};
packages = {
zeronsd = zeronsd-bin;
default = zeronsd-bin;
};
overlays = {
default = final: prev: { zeronsd = zeronsd-bin; };
};
});
}