d4: flake.nix and run.sh -> run-py.sh

master
pegasust 2022-12-04 05:45:35 +00:00
parent db4b25319f
commit 640bd62b19
4 changed files with 46 additions and 0 deletions

4
2022/d4/.envrc Normal file
View File

@ -0,0 +1,4 @@
if command -v nix-shell &> /dev/null
then
use flake
fi

1
2022/d4/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.direnv

41
2022/d4/flake.nix Normal file
View File

@ -0,0 +1,41 @@
{
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 = ''
echo "The input files should be placed under ./data/{submission,example}.txt
echo "This problem only "
'';
in
rec {
devShell = devShell.lua;
devShell.lua = lib.mkShell {
nativeBuildInputs = [
pkgs.lua.withPackages
(luapkgs:
[ luapkgs.busted luapkgs.luafilesystem ]
)
];
shellHook = ''
echo "> Lua runtime"
echo "Run ./run-lua.sh to see solution's output"
'' + shellHookAfter;
};
devShell.python = lib.mkShell {
nativeBuildInputs = [ pkgs.python3 ];
shellHook = ''
echo "> Python3 runtime"
echo "Run ./run-py.sh to see solution's output"
'' + shellHookAfter;
};
}
);
}