-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
88 lines (80 loc) · 2.41 KB
/
flake.nix
File metadata and controls
88 lines (80 loc) · 2.41 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
{
description = "An EverQuest .wld file loader";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane";
};
outputs = { self, nixpkgs, rust-overlay, crane }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
forSystem = system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
rust = pkgs.rust-bin.stable.latest.default;
rustDev = rust.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
craneLib = (crane.mkLib pkgs).overrideToolchain rust;
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type:
(craneLib.filterCargoSources path type)
|| builtins.match ".*README\\.md$" path != null;
};
commonArgs = {
inherit src;
strictDeps = true;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
{
inherit pkgs rustDev craneLib commonArgs cargoArtifacts;
};
in
{
overlays.default = final: prev: {
s3d = self.packages.${final.system}.s3d;
wld-cli = self.packages.${final.system}.wld-cli;
};
packages = forAllSystems (system:
let
s = forSystem system;
in
{
s3d = s.craneLib.buildPackage (s.commonArgs // {
inherit (s) cargoArtifacts;
pname = "s3d";
cargoExtraArgs = "--package s3d";
});
wld-cli = s.craneLib.buildPackage (s.commonArgs // {
inherit (s) cargoArtifacts;
pname = "wld-cli";
cargoExtraArgs = "--package wld-cli";
});
});
devShells = forAllSystems (system:
let
s = forSystem system;
in
{
default = s.pkgs.mkShell {
buildInputs = [
s.rustDev
s.pkgs.pkg-config
s.pkgs.openssl
];
nativeBuildInputs = [
s.pkgs.nixpkgs-fmt
s.pkgs.perf-tools
s.pkgs.cargo-flamegraph
s.pkgs.cargo-readme
];
};
});
};
}