-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
88 lines (75 loc) · 2.12 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
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
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
};
};
outputs = { self, flake-utils, naersk, rust-overlay, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = (import nixpkgs) {
inherit system overlays;
};
src = ./.;
naersk' = pkgs.callPackage naersk { };
version = "0.1";
in
rec {
packages = rec {
# For `nix build` & `nix run`:
bin = naersk'.buildPackage {
pname = "whydoesntmycodework-bin";
root = src;
buildInputs = with pkgs; [
pkg-config
openssl
];
};
static = pkgs.stdenv.mkDerivation {
pname = "whydoesntmycodework-static";
inherit (bin) version;
inherit src;
phases = "installPhase";
installPhase = ''
mkdir $out
cp -r $src/static $out
'';
};
posts = pkgs.stdenv.mkDerivation {
pname = "whydoesntmycodework-posts";
inherit (bin) version;
inherit src;
phases = "installPhase";
installPhase = ''
mkdir $out
cp -r $src/posts $out
'';
};
default = pkgs.symlinkJoin {
name = "whydoesntmycodework-${bin.version}";
paths = [ static bin posts ];
};
};
# For `nix develop`:
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
# Duplicated for rust-analyzer
pkg-config
openssl
# Profiling
linuxPackages_latest.perf
# Stuff we actually want.
rust-bin.stable.latest.default
cargo-flamegraph
rust-analyzer
dhall
dhall-json
];
};
}
);
}