-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
70 lines (57 loc) · 2.2 KB
/
flake.nix
File metadata and controls
70 lines (57 loc) · 2.2 KB
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
{
description = "Godon CLI - Rust-based CLI for Godon API";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.pkgsBuildHost.rust-bin.stable.latest.default;
godon-cli = { version ? (if builtins.getEnv "GODON_VERSION" == "" then
"DEV_BUILD"
else
builtins.getEnv "GODON_VERSION") }:
pkgs.stdenv.mkDerivation {
pname = "godon-cli";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [ rustToolchain pkg-config ];
buildInputs = with pkgs; [ openssl ];
env = {
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
CURL_CA_BUNDLE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
};
buildPhase = ''
echo "Building godon-cli version: ${version}"
export CARGO_HOME=$PWD/.cargo-home
cargo build --release
'';
installPhase = ''
mkdir -p $out/bin
cp target/release/godon_cli $out/bin/godon_cli
chmod +x $out/bin/godon_cli
'';
meta = with pkgs.lib; {
description = "CLI for the Godon API";
license = licenses.agpl3Only;
platforms = platforms.linux;
};
};
in {
packages.default = godon-cli { };
packages.godon-cli = godon-cli;
packages.godon-cli-custom = version: godon-cli { inherit version; };
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ rustToolchain rust-analyzer cargo-watch ];
shellHook = ''
echo "Godon CLI development environment"
echo "Rust: $(rustc --version)"
'';
};
});
}