Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
118 lines (100 loc) · 3.92 KB
/
Copy pathflake.nix
File metadata and controls
118 lines (100 loc) · 3.92 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay/stable";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
with inputs;
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
# SemVer bump helper: bump-version <major|minor|patch|X.Y.Z> [--tag]
bump-version = pkgs.writeShellApplication {
name = "bump-version";
runtimeInputs = with pkgs; [gnugrep gnused gawk coreutils git];
text = builtins.readFile ./scripts/bump-version.sh;
};
# Keep the CLI installable on its own, while also exposing the
# workspace crates as buildable package outputs for downstream
# flakes.
# The workspace version cargo-release bumps, so the label never drifts.
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
mkHaqorCrate = crate: pname:
pkgs.rustPlatform.buildRustPackage {
inherit pname version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
cargoBuildFlags = ["-p" crate];
cargoTestFlags = ["-p" crate];
# nixpkgs' cargo setup hook exports LIBSQLITE3_SYS_USE_PKG_CONFIG=1
# (from 26.11), which overrides rusqlite's `bundled` feature and
# links the system SQLite, so the package has to provide it.
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [pkgs.sqlite];
# The workspace test profile deliberately exercises every
# morphology paradigm and is too expensive for package builds.
doCheck = false;
};
haqor = mkHaqorCrate "haqor-cli" "haqor";
haqor-sync-server = mkHaqorCrate "haqor-sync-server" "haqor-sync-server";
in {
packages = {
inherit bump-version haqor haqor-sync-server;
haqor-cli = haqor;
haqor-admin = mkHaqorCrate "haqor-admin" "haqor-admin";
haqor-core = mkHaqorCrate "haqor-core" "haqor-core";
haqor-db-gen = mkHaqorCrate "haqor-db-gen" "haqor-db-gen";
haqor-morphology = mkHaqorCrate "haqor-morphology" "haqor-morphology";
};
apps.bump-version = {
type = "app";
program = "${bump-version}/bin/bump-version";
};
apps.haqor = {
type = "app";
program = "${haqor}/bin/haqor";
};
apps.sync-server = {
type = "app";
program = "${haqor-sync-server}/bin/haqor-sync-server";
};
devShells = {
default = with pkgs;
mkShell {
buildInputs = [
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
cargo-nextest
cargo-udeps
cargo-vet
cargo-about
cargo-release
bump-version
rust-analyzer
rustfmt
adrs
typos
sqlitebrowser
# for the PDF scans in src_texts/Apologetics
git-lfs
# bsondump, for scripts/fetch-sefaria-lexicons.sh
mongodb-tools
# mod2imp, for scripts/fetch-murdock.sh
sword
# If the dependencies need system libs, you usually need pkg-config + the lib
pkg-config
openssl
sqlite
];
};
};
formatter = nixpkgs.legacyPackages.${system}.alejandra;
}
);
}