-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
174 lines (163 loc) · 4.95 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
uiua.url = "github:uiua-lang/uiua";
};
outputs = {
nixpkgs,
uiua,
...
}: let
defaultSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
eachDefaultSystem = f:
builtins.listToAttrs (map (system: {
name = system;
value = f rec {
inherit system;
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"dyalog"
];
};
python = pkgs.python313.withPackages (p:
with p; [
z3
numpy
networkx
sympy
]);
pypy = pkgs.pypy310.withPackages (p:
with p; [
# z3
# numpy
networkx
sympy
]);
downloadInput = pkgs.stdenvNoCC.mkDerivation {
name = "aoc-download-input";
dontUnpack = true;
nativeBuildInputs = with pkgs; [makeWrapper];
installPhase = ''
mkdir -p $out/bin
cp ${./scripts/download_input.sh} $out/bin/aoc-download-input
chmod +x $out/bin/*
wrapProgram $out/bin/* --set PATH ${with pkgs;
lib.makeBinPath [
bash
coreutils
curl
gnugrep
termdown
less
glibc
]}
'';
};
getSession = pkgs.python3.pkgs.buildPythonApplication {
name = "aoc-get-session";
pyproject = false;
dontUnpack = true;
installPhase = "mkdir -p $out/bin; cp ${./scripts/get_session.py} $out/bin/aoc-get-session; chmod +x $out/bin/*";
propagatedBuildInputs = with pkgs.python3.pkgs; [
requests
pycrypto
];
};
pruneLeaderboard = pkgs.python3.pkgs.buildPythonApplication {
name = "aoc-prune-leaderboard";
pyproject = false;
dontUnpack = true;
installPhase = "mkdir -p $out/bin; cp ${./scripts/prune_leaderboard.py} $out/bin/aoc-prune-leaderboard; chmod +x $out/bin/*";
propagatedBuildInputs = with pkgs.python3.pkgs; [
requests
];
};
fetchRanks = pkgs.python3.pkgs.buildPythonApplication {
name = "aoc-fetch-ranks";
pyproject = false;
dontUnpack = true;
installPhase = "mkdir -p $out/bin; cp ${./scripts/fetch_ranks.py} $out/bin/aoc-fetch-ranks; chmod +x $out/bin/*";
propagatedBuildInputs = with pkgs.python3.pkgs; [
requests
beautifulsoup4
];
};
live = pkgs.python3.pkgs.buildPythonApplication {
name = "aoc-live";
pyproject = false;
dontUnpack = true;
installPhase = "mkdir -p $out/bin; cp ${./scripts/live.py} $out/bin/aoc-live; chmod +x $out/bin/*";
makeWrapperArgs = ["--set AOC_PYTHON ${python}/bin/python"];
propagatedBuildInputs = with pkgs.python3.pkgs; [
requests
beautifulsoup4
pyperclip
watchdog
];
};
};
})
defaultSystems);
in {
devShells = eachDefaultSystem ({
system,
pkgs,
downloadInput,
getSession,
pruneLeaderboard,
fetchRanks,
live,
python,
pypy,
...
}: {
default = pkgs.mkShell {
buildInputs = [
downloadInput
getSession
pruneLeaderboard
fetchRanks
live
pkgs.z3
];
packages = with pkgs; [
just
jq
hyperfine
# Python
python
pypy
# Haskell
(haskellPackages.ghcWithPackages (p: with p; [split regex-tdfa]))
haskell-language-server
ormolu # haskell code formatter
# APL
# (dyalog.override {
# acceptLicense = true;
# })
# Uiua
uiua.packages.${system}.default
# Nushell
nushell
# Ruby
ruby
solargraph
# Lean
lean4
];
PYTHONPATH = ".";
LIBCLANG_PATH = with pkgs; lib.makeLibraryPath [llvmPackages.clang-unwrapped.lib];
LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [z3.lib];
CPATH = with pkgs; lib.makeSearchPath "include" [musl.dev llvmPackages.clang-unwrapped.lib z3.dev];
UIUA_RECURSION_LIMIT = 1000;
};
});
};
}