Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
89 lines (79 loc) · 2.39 KB
/
Copy pathflake.nix
File metadata and controls
89 lines (79 loc) · 2.39 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
{
description = "Elytra Rides Backend";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.rust-bin.stable."1.76.0".default;
rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in
{
packages = {
backend = rustPlatform.buildRustPackage {
pname = "elytra-rides-backend";
version = "0.1.0";
src = ./backend;
cargoHash = "sha256-Fd7ttVMn9SO5WLoGA9knGyA99C+YxidVEG7lCclqPG4=";
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
openssl
postgresql
];
postInstall = ''
cp -r $src/migrations $out/migrations
'';
doCheck = false;
};
web = pkgs.buildNpmPackage rec {
pname = "web";
version = "0.1.0";
buildInputs = with pkgs; [
nodejs_20
nodePackages_latest.pnpm
];
npmDepsHash = "sha256-HVxTXJJ/w4OQpfAnBgcPiR8y6qrIS0o8Mx3Q8vepLgg=";
nativeBuildInputs = buildInputs;
npmFlags = [ "--legacy-peer-deps" ];
src = ./web;
postInstall = ''
mkdir -p $out/bin
exe="$out/bin/${pname}"
lib="$out/lib/node_modules/${pname}"
cp -r ./.next $lib
touch $exe
chmod +x $exe
echo "
#!/usr/bin/env bash
cd $lib
${pkgs.nodePackages_latest.pnpm}/bin/pnpm run start" > $exe
'';
};
};
devShells.default = with pkgs; mkShell {
buildInputs = [
openssl
pkg-config
rust-bin.stable."1.76.0".default
diesel-cli
postgresql
process-compose
nodejs
yarn
];
};
}
);
}