-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
57 lines (48 loc) · 1.49 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
51
52
53
54
55
56
57
{
description = "A simple cli utility for accessing PWSafe3 databases";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
rust-overlay.url = "github:oxalica/rust-overlay";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, naersk, nixpkgs, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (pkgs.stdenv) isDarwin;
# this overlay gives us pre-built binaries for the rust
# toolchain, so we have reproducible builds
overlays = [ (import rust-overlay) ];
pkgs = (import nixpkgs) {
inherit system overlays;
};
myrust = pkgs.rust-bin.beta.latest.default.override {
extensions = [ "rust-analyzer" ];
};
# configure naersk to use our rust overlay
naersk' = pkgs.callPackage naersk {
cargo = myrust;
rustc = myrust;
};
# on osx, we need to include some apple libs
appkit = if isDarwin then pkgs.darwin.apple_sdk.frameworks.AppKit else null;
in
with pkgs;
{
# For `nix build` & `nix run`:
packages.default = naersk'.buildPackage {
buildInputs = [
appkit
];
src = ./.;
};
# For `nix develop`:
devShells.default = pkgs.mkShell {
buildInputs = [
appkit
myrust
];
};
}
);
}