-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
50 lines (46 loc) · 1.61 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
{
description = "Easily start a temporary PostgreSQL server for testing or exploration";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ my-overlay ];
};
my-overlay = final: prev: { };
package-name = "tmp-postgres";
in
{
inherit pkgs;
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ cargo rust-analyzer rustfmt cargo-watch rustPackages.clippy ];
inputsFrom = [ self.packages."${system}"."${package-name}" ];
};
packages = {
default = self.packages."${system}"."${package-name}";
# Read the docs at https://nixos.org/manual/nixpkgs/stable/#rust
"${package-name}" = pkgs.rustPlatform.buildRustPackage {
pname = package-name;
version = "0.1.0";
cargoSha256 = "sha256-6V1NbCW3y1GA8y8yL5hP/GVNHjdhbsvT31t2iwEfkec=";
src = ./src;
buildInputs =
let
darwin-frameworks = with pkgs.darwin.apple_sdk.frameworks;
[
CoreFoundation
CoreServices
SystemConfiguration
pkgs.libiconv
];
system-dependent = if pkgs.stdenv.isDarwin then darwin-frameworks else [ ];
in
system-dependent;
};
};
});
}