1
{
2
description = "char";
3
4
inputs = {
5
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
6
fenix = {
7
url = "github:nix-community/fenix";
8
inputs.nixpkgs.follows = "nixpkgs";
9
};
10
};
11
12
outputs =
13
{
14
nixpkgs,
15
fenix,
16
...
17
}:
18
let
19
systems = [
20
"aarch64-darwin"
21
"aarch64-linux"
22
"x86_64-darwin"
23
"x86_64-linux"
24
];
25
eachSystem = nixpkgs.lib.genAttrs systems;
26
in
27
{
28
29
packages = eachSystem (
30
system:
31
let
32
pkgs = nixpkgs.legacyPackages.${system};
33
cargoToml = pkgs.lib.importTOML ./Cargo.toml;
34
35
mkChar =
36
pkgs:
37
pkgs.rustPlatform.buildRustPackage {
38
pname = "char";
39
inherit (cargoToml.package) version;
40
41
src = ./.;
42
cargoLock.lockFile = ./Cargo.lock;
43
44
doCheck = false;
45
};
46
in
47
rec {
48
default = char;
49
50
char = mkChar pkgs;
51
char-musl = mkChar pkgs.pkgsStatic;
52
}
53
);
54
55
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt);
56
57
devShells = eachSystem (
58
system:
59
let
60
pkgs = nixpkgs.legacyPackages.${system};
61
fenixPkgs = fenix.packages.${system};
62
63
mkShell =
64
{ name, toolchain }:
65
pkgs.mkShell {
66
inherit name;
67
68
packages = with pkgs; [
69
(toolchain.withComponents [
70
"cargo"
71
"rustc"
72
"rust-analyzer"
73
"clippy"
74
"rustfmt"
75
"rust-src"
76
"llvm-tools-preview"
77
])
78
cargo-fuzz
79
cargo-nextest
80
bacon
81
qbe
82
];
83
};
84
in
85
{
86
default = mkShell {
87
name = "char";
88
toolchain = fenixPkgs.complete;
89
};
90
}
91
);
92
};
93
}
94