-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
62 lines (59 loc) · 1.75 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
{
description = "Advent of Code";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
readme = import ./readme.nix { inherit pkgs; };
copyReadme = pkgs.writeScriptBin "copy-readme" ''
cp ${readme}/README.md .
chmod u+w README.md
'';
derivations = import ./derivations.nix { inherit pkgs; };
langs = import ./langs.nix { inherit pkgs; };
aoc = pkgs.callPackage ./utils/aoc/aoc.nix {};
in
{
apps = {
aoc = {
type = "app";
program = "${aoc}/bin/aoc";
};
readme = {
type = "app";
program = "${copyReadme}/bin/copy-readme";
};
};
lib = {
inherit langs;
};
packages = {
aoc = aoc;
};
devShells =
let langShell = lang: { name, buildInputs, shellRunHelp, extension, ... }: pkgs.mkShell {
inherit buildInputs;
shellHook = ''
echo '------------------------'
echo 'Shell for: ${name}'
echo 'Compile and run with: '
echo ' ${shellRunHelp}'
echo '------------------------'
'';
};
in
{
langs = builtins.mapAttrs langShell langs;
libs.hs = pkgs.mkShell {
buildInputs = [
pkgs.cabal2nix
pkgs.haskellPackages.cabal-install
pkgs.ghc
];
};
};
}
);
}