-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
91 lines (86 loc) · 2.98 KB
/
flake.nix
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
# Copyright (c) 2024 Andrew Brower.
# This file is part of Crawlspace.
#
# Crawlspace is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# Crawlspace is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License along with Crawlspace. If not, see
# <https://www.gnu.org/licenses/>.
{
description = "Description for the project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ {
flake-parts,
rust-overlay,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: let
version = "0.0.1";
rust-bin = pkgs.pkgsBuildHost.rust-bin;
rustToolchain = rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain);
rustc = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain);
clippy = rust-bin.selectLatestNightlyWith (toolchain: rustToolchain);
};
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
];
};
devShells.default = pkgs.mkShell {
inputsFrom = [
self'.packages.default
];
packages = with pkgs;
[
rust-analyzer
]
++ lib.optionals (system == "x86_64-linux" || system == "aarch64-linux") [
valgrind
];
};
packages = let
mkCrawlspace = buildType:
rustPlatform.buildRustPackage {
pname = "crawlspace";
inherit version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
cargoLock.outputHashes."fastanvil-0.31.0" = "E4WI6SZgkjqUOtbfXfKGfpFH7btEh5V0KpMXSIsuh08=";
cargoLock.outputHashes."fastnbt-2.5.0" = "E4WI6SZgkjqUOtbfXfKGfpFH7btEh5V0KpMXSIsuh08=";
inherit buildType;
dontStrip = buildType == "debug";
buildInputs = with pkgs; [pkg-config openssl];
};
in {
default = mkCrawlspace "debug";
release = mkCrawlspace "release";
};
};
};
}