-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
100 lines (89 loc) · 2.26 KB
/
flake.nix
File metadata and controls
100 lines (89 loc) · 2.26 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
94
95
96
97
98
99
100
{
description = "flake for fuzzing fnotation";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
};
};
outputs =
{
self,
nixpkgs,
fenix,
crane,
...
}@inputs:
let
# Linux-specific outputs (NixOS configurations and deploy)
linuxSystem = "x86_64-linux";
devShellSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
nixpkgsFor =
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
};
rustToolchainFor =
system:
inputs.fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-mEgn8v8xFz241fdSjNB1CxBHwm3aZz0svD9IqZVZeEA=";
};
pkgsLinux = nixpkgsFor linuxSystem;
rustToolchainLinux = rustToolchainFor linuxSystem;
craneLib = (crane.mkLib pkgsLinux).overrideToolchain rustToolchainLinux;
cargoArtifacts = craneLib.buildDepsOnly {
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
nativeBuildInputs = [
pkgsLinux.pkg-config
];
buildInputs = [
pkgsLinux.openssl
];
};
# Generate devShells for each system
devShellForSystem =
system:
let
pkgs = nixpkgsFor system;
rustToolchain = rustToolchainFor system;
in
pkgs.mkShell {
name = "catcolab-devshell";
buildInputs =
with pkgs;
[
rustToolchain
rust-analyzer
rustfmt
clippy
pkg-config
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [
stdenv.cc.cc.lib
]);
# macOS-specific environment variables for OpenSSL and pkg-config
};
in
{
# Create devShells for all supported systems
devShells = builtins.listToAttrs (
map (system: {
name = system;
value = {
default = devShellForSystem system;
};
}) devShellSystems
);
};
}