-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
103 lines (92 loc) · 2.51 KB
/
flake.nix
File metadata and controls
103 lines (92 loc) · 2.51 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
{
description = "Terrier";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
devenv.url = "github:cachix/devenv";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
devenv,
rust-overlay,
...
}@inputs:
let
devSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
packageSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f system);
in
{
packages = forAllSystems packageSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustPlatform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
in
{
default = rustPlatform.buildRustPackage {
pname = "terrier";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [
dioxus-cli
pkg-config
wasm-bindgen-cli_0_2_108 # pinned in Cargo.lock
binaryen # for wasm-opt
];
buildInputs = with pkgs; [ openssl ];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
dx bundle --platform web --release
runHook postBuild
'';
dontCargoBuild = true;
doCheck = false;
installPhase = ''
runHook preInstall
mkdir -p $out/public
cp target/dx/terrier/release/web/terrier $out/terrier
cp -r target/dx/terrier/release/web/public/* $out/public/
runHook postInstall
'';
};
}
);
devShells = forAllSystems devSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [ ./nix/devenv.nix ];
};
}
);
nixosModules.default = import ./nix/module.nix { inherit self; };
};
}