-
Notifications
You must be signed in to change notification settings - Fork 13
/
flake.nix
83 lines (69 loc) · 2.5 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
inputs = {
holonix = {
url = "github:holochain/holonix?ref=main";
inputs.crane.follows = "crane";
inputs.rust-overlay.follows = "rust-overlay";
};
nixpkgs.follows = "holonix/nixpkgs";
# lib to build a nix package from a rust crate
crane = {
url = "github:ipetkov/crane";
};
# Rust toolchain
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "holonix/nixpkgs";
};
};
outputs = inputs@{ nixpkgs, holonix, crane, rust-overlay, ... }:
holonix.inputs.flake-parts.lib.mkFlake { inherit inputs; } {
# provide a dev shell for all systems that the holonix flake supports
systems = builtins.attrNames holonix.devShells;
perSystem = { inputs', config, system, pkgs, lib, ... }:
{
formatter = pkgs.nixpkgs-fmt;
devShells.default = pkgs.mkShell {
packages = [
# add packages from Holonix
inputs'.holonix.packages.holochain
inputs'.holonix.packages.lair-keystore
inputs'.holonix.packages.rust
# add further packages from nixpkgs
pkgs.nodejs
(lib.optional pkgs.stdenv.isDarwin [
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.CoreFoundation
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
])
];
shellHook = ''
export PS1='\[\033[1;34m\][holonix:\w]\$\[\033[0m\] '
'';
};
packages.trycp-server =
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.stable."1.78.0".minimal;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
crateInfo = craneLib.crateNameFromCargoToml { cargoToml = ./crates/trycp_server/Cargo.toml; };
in
craneLib.buildPackage {
pname = "trycp-server";
version = crateInfo.version;
src = craneLib.cleanCargoSource (craneLib.path ./.);
doCheck = false;
buildInputs = [ ]
++ (lib.optionals pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
CoreFoundation
Security
]));
};
};
};
}