2022-12-04 05:45:35 +00:00
|
|
|
{
|
|
|
|
description = "D4 AOC with Lua!";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
outputs = { nixpkgs, flake-utils, ... } @ inputs:
|
|
|
|
flake-utils.lib.eachSystem flake-utils.lib.defaultSystems (sys:
|
|
|
|
let
|
|
|
|
overlays = [ ];
|
|
|
|
pkgs = import nixpkgs { system = sys; overlays = overlays; };
|
|
|
|
shellHookAfter = ''
|
2022-12-04 08:41:03 +00:00
|
|
|
echo "The input files should be placed under ./data/{submission,example}.txt"
|
2022-12-04 06:54:01 +00:00
|
|
|
echo "This problem shares one input between two parts"
|
2022-12-04 05:45:35 +00:00
|
|
|
'';
|
2022-12-04 08:28:40 +00:00
|
|
|
py_pkgs = [ pkgs.python310 ];
|
2022-12-04 06:54:01 +00:00
|
|
|
lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ];
|
2022-12-04 05:45:35 +00:00
|
|
|
in
|
2022-12-04 06:54:01 +00:00
|
|
|
{
|
|
|
|
# Jack of all trades
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = py_pkgs ++ lua_pkgs;
|
2022-12-04 05:45:35 +00:00
|
|
|
shellHook = ''
|
2022-12-04 06:54:01 +00:00
|
|
|
echo "> Default runtime. This contains both lua and python3 env"
|
|
|
|
echo "Run ./run-py.sh for Python's output and ./run-lua.sh for Lua's output"
|
2022-12-04 05:45:35 +00:00
|
|
|
'' + shellHookAfter;
|
|
|
|
};
|
2022-12-04 08:41:03 +00:00
|
|
|
devShells = {
|
|
|
|
# nix develop ./#lua
|
|
|
|
lua = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = lua_pkgs;
|
|
|
|
shellHook = ''
|
|
|
|
echo "> Lua runtime"
|
|
|
|
echo "Run ./run-lua.sh to see the output of the solution"
|
|
|
|
'' + shellHookAfter;
|
|
|
|
};
|
|
|
|
# nix develop ./#python
|
|
|
|
python = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = py_pkgs;
|
|
|
|
shellHook = ''
|
|
|
|
echo "> Python3 runtime"
|
|
|
|
echo "Run ./run-py.sh to see the output of the solution"
|
|
|
|
'' + shellHookAfter;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
2022-12-04 05:45:35 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|