-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
82 lines (73 loc) · 2.32 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
{
description = "Upload files to the internet";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
# Start inserting submodules as inputs here
cxxopts = {
url = "https://github.com/jarro2783/cxxopts.git";
flake = false;
type = "git";
rev = "aaa5e790b6b5b4c9de0b1ca3346ed0c2e55e4e03";
};
cpp-httplib = {
url = "https://github.com/yhirose/cpp-httplib.git";
flake = false;
type = "git";
rev = "ff813bf99d3402adafd4141b660ed2313d27f7a6";
};
miniz-cpp = {
url = "https://github.com/Zebreus/miniz-cpp.git";
flake = false;
type = "git";
rev = "5a7a6b2aae35cdd5aecb38b9fb51efd9178dd510";
};
# Stop inserting submodules as inputs here
};
outputs = { self, nixpkgs, flake-utils /* Insert submodules */, cxxopts, miniz-cpp, cpp-httplib /* Stop insert submodules */ }:
flake-utils.lib.eachDefaultSystem (system:
rec {
name = "upload";
packages.default = (with nixpkgs.legacyPackages.${system};
stdenv.mkDerivation {
pname = name;
version = "0.3.2";
src = ./.;
nativeBuildInputs = [
ronn
];
buildInputs = [
openssl
];
patchPhase = ''
# Start inserting submodule softlinks here
rm -rf libs/cxxopts
ln -s ${cxxopts} libs/cxxopts
rm -rf libs/miniz-cpp
ln -s ${miniz-cpp} libs/miniz-cpp
rm -rf libs/cpp-httplib
ln -s ${cpp-httplib} libs/cpp-httplib
# Stop inserting submodule softlinks here
'';
buildPhase = ''
export SOURCE_DATE_EPOCH="${toString (self.lastModified or 0)}"
make
'';
});
devShells.default = (with nixpkgs.legacyPackages.${system};
mkShell {
nativeBuildInputs = packages.default.nativeBuildInputs ++ [
upx
clang-tools
nixpkgs-fmt
wget
];
buildInputs = packages.default.buildInputs;
});
apps.default = flake-utils.lib.mkApp {
drv = packages.default;
exePath = "/bin/${name}";
};
}
);
}