diff --git a/2022/d4/.envrc b/2022/d4/.envrc new file mode 100644 index 0000000..8ba04f9 --- /dev/null +++ b/2022/d4/.envrc @@ -0,0 +1,4 @@ +if command -v nix-shell &> /dev/null + then + use flake +fi diff --git a/2022/d4/.gitignore b/2022/d4/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/2022/d4/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/2022/d4/flake.nix b/2022/d4/flake.nix new file mode 100644 index 0000000..bf6291e --- /dev/null +++ b/2022/d4/flake.nix @@ -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; + + }; + } + ); +} diff --git a/2022/d4/run.sh b/2022/d4/run-py.sh similarity index 100% rename from 2022/d4/run.sh rename to 2022/d4/run-py.sh