-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
90 lines (76 loc) · 2.09 KB
/
flake.nix
File metadata and controls
90 lines (76 loc) · 2.09 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixvim.url = "github:sportshead/nixvim";
};
outputs = {
nixpkgs,
flake-utils,
nixvim,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
browse-wrapper = pkgs.writeShellScriptBin "browse" ''
open "$(browse.ts "$1" "$2")"
'';
today-wrapper = pkgs.writeShellScriptBin "today" ''
dir="$(today.ts "$1" "$2")"
echo "$dir"
mkdir -p "$dir"
cd "$dir" || (
echo "failed to cd!"
return
)
projectRoot="$(projectRoot.ts)"
touch part1.hs
touch input.txt
touch _input.txt
browse
'';
part2-wrapper = pkgs.writeShellScriptBin "part2" ''
[ ! -f part2.hs ] && cp part1.hs part2.hs
swap
'';
swap-wrapper = pkgs.writeShellScriptBin "swap" ''
touch input.txt
touch _input.txt
mv _input.txt __input.txt
mv input.txt _input.txt
mv __input.txt input.txt
'';
bench-wrapper = pkgs.writeShellScriptBin "bench" ''
hyperfine -w 3 --export-json timings.json --input input.txt -P pt 1 2 './part{pt}'
'';
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bun
hyperfine
browse-wrapper
today-wrapper
part2-wrapper
swap-wrapper
bench-wrapper
(nixvim.packages.${system}.default.extend {
sportshead.lang = {
haskell = true;
};
extraConfigLuaPost = ''
require("codeium").disable();
'';
})
(ghc.withPackages (p:
with p; [
haskell-language-server
]))
];
shellHook = ''
export PATH="$PWD/bin:$PATH"
'';
};
}
);
}