1
{
2
description = "blissify-rs";
3
4
inputs = {
5
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
6
};
7
8
outputs =
9
{
10
nixpkgs,
11
...
12
}:
13
let
14
systems = [
15
"aarch64-darwin"
16
"aarch64-linux"
17
"x86_64-darwin"
18
"x86_64-linux"
19
];
20
eachSystem = nixpkgs.lib.genAttrs systems;
21
in
22
{
23
24
packages = eachSystem (
25
system:
26
let
27
pkgs = nixpkgs.legacyPackages.${system};
28
cargoToml = pkgs.lib.importTOML ./Cargo.toml;
29
30
mkBlissifyRs =
31
pkgs:
32
pkgs.rustPlatform.buildRustPackage {
33
pname = "blissify-rs";
34
inherit (cargoToml.package) version;
35
36
nativeBuildInputs = with pkgs; [
37
pkg-config
38
llvmPackages.libclang
39
llvmPackages.libcxxClang
40
clang
41
];
42
43
buildInputs = with pkgs; [
44
ffmpeg
45
sqlite
46
];
47
48
LIBCLANG_PATH = with pkgs; "${llvmPackages.libclang.lib}/lib";
49
50
# This step per https://hoverbear.org/blog/rust-bindgen-in-nix/.
51
# I haven't tried reducing it to see what's strictly necessary.
52
preBuild =
53
let
54
inherit (pkgs) stdenv lib;
55
in
56
''
57
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \
58
$(< ${stdenv.cc}/nix-support/libc-cflags) \
59
$(< ${stdenv.cc}/nix-support/cc-cflags) \
60
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
61
${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \
62
${lib.optionalString stdenv.cc.isGNU "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include"} \
63
"
64
'';
65
66
src = ./.;
67
cargoLock.lockFile = ./Cargo.lock;
68
69
doCheck = false;
70
};
71
in
72
rec {
73
default = blissify-rs;
74
75
blissify-rs = mkBlissifyRs pkgs;
76
}
77
);
78
79
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt);
80
};
81
}
82