This repository was archived by the owner on Sep 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathflake.nix
More file actions
93 lines (80 loc) · 3.02 KB
/
Copy pathflake.nix
File metadata and controls
93 lines (80 loc) · 3.02 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
description = "OpenSecret SDK - TypeScript and Rust development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Keep Bun aligned with package.json and CI without advancing the SDK's
# older Node/Rust/system package set. Update all three pins together.
bun-nixpkgs.url = "github:NixOS/nixpkgs/5912c1772a44e31bf1c63c0390b90501e5026886";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, bun-nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; };
bunPkgs = import bun-nixpkgs { inherit system; };
sdkBun = assert bunPkgs.bun.version == "1.3.5"; bunPkgs.bun;
# Try to use rust-toolchain.toml if it exists, otherwise use stable
rust = if builtins.pathExists ./rust-toolchain.toml
then pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else pkgs.rust-bin.stable.latest.default;
commonInputs = with pkgs; [
# TypeScript/JavaScript tooling
sdkBun
nodejs_20
nodePackages.typescript
nodePackages.typescript-language-server
# Rust tooling
rust
rust-analyzer
pkg-config
openssl
zlib
clang
libclang
# Useful tools
jq
just
];
darwinOnlyInputs = with pkgs; [
libiconv
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
linuxOnlyInputs = with pkgs; [
gcc
];
allInputs = commonInputs
++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinOnlyInputs
++ pkgs.lib.optionals pkgs.stdenv.isLinux linuxOnlyInputs;
in
{
devShells.default = pkgs.mkShell {
packages = allInputs;
shellHook = ''
echo "OpenSecret SDK Development Environment"
echo "----------------------------------------"
echo "TypeScript/Bun tools available"
echo "Rust toolchain: $(rustc --version)"
echo ""
# Set up Rust environment variables
export LIBCLANG_PATH=${pkgs.libclang.lib}/lib/
export LD_LIBRARY_PATH=${pkgs.openssl}/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=${pkgs.openssl.dev}/lib/pkgconfig
${pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
# macOS-specific setup
export RUST_BACKTRACE=1
''}
${pkgs.lib.optionalString pkgs.stdenv.isLinux ''
# Linux-specific setup
export RUST_BACKTRACE=1
''}
'';
};
}
);
}