-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
46 lines (44 loc) · 1.52 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
{
description = "ircjournal, a lightweight, fast, standalone IRC log viewer for the web, with real-time log ingestion.";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in rec
{
packages = rec {
ircjournal = pkgs.rustPlatform.buildRustPackage {
pname = "ircjournal";
version = "local";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
SQLX_OFFLINE = 1;
nativeBuildInputs = with pkgs; [
pkg-config
nodePackages.typescript
sassc
];
buildInputs = with pkgs; [ openssl ];
};
default = ircjournal;
};
devShells.default = pkgs.mkShell {
shellHook = ''
echo 'To create a test DB, use: export DATABASE_URL=$(pg_tmp -w 0 -d /tmp/ircjournal-pg)'
echo 'To migrate to be able to use sqlx compile-time validation, use: sqlx migrate run --source ircjournal/migrations'
'';
SQLX_OFFLINE = 1;
DATABASE_URL = "postgresql:///test?host=%2Ftmp%2Fircjournal-pg";
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
inputsFrom = with packages; [ ircjournal ];
buildInputs = with pkgs; [
cargo
rustc
rustfmt
ephemeralpg
clippy
sqlx-cli
];
};
});
}