fix: d4: pkgs.lua.withPackages operator precedence goes awry

master
pegasust 2022-12-04 06:54:01 +00:00
parent 640bd62b19
commit b8f9b7c2d0
2 changed files with 69 additions and 20 deletions

43
2022/d4/flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1670064435,
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -11,31 +11,37 @@
pkgs = import nixpkgs { system = sys; overlays = overlays; }; pkgs = import nixpkgs { system = sys; overlays = overlays; };
shellHookAfter = '' shellHookAfter = ''
echo "The input files should be placed under ./data/{submission,example}.txt echo "The input files should be placed under ./data/{submission,example}.txt
echo "This problem only " echo "This problem shares one input between two parts"
''; '';
py_pkgs = [ pkgs.python39 ];
lua_pkgs = [ (pkgs.lua.withPackages (luapkgs: [ luapkgs.busted luapkgs.luafilesystem ])) ];
in in
rec { {
devShell = devShell.lua; # Jack of all trades
devShell.lua = lib.mkShell { devShell = pkgs.mkShell {
nativeBuildInputs = [ nativeBuildInputs = py_pkgs ++ lua_pkgs;
pkgs.lua.withPackages
(luapkgs:
[ luapkgs.busted luapkgs.luafilesystem ]
)
];
shellHook = '' shellHook = ''
echo "> Lua runtime" echo "> Default runtime. This contains both lua and python3 env"
echo "Run ./run-lua.sh to see solution's output" echo "Run ./run-py.sh for Python's output and ./run-lua.sh for Lua's output"
'' + shellHookAfter; '' + shellHookAfter;
}; };
devShell.python = lib.mkShell { # devShells.${sys} = {
nativeBuildInputs = [ pkgs.python3 ]; # lua = pkgs.mkShell {
shellHook = '' # nativeBuildInputs = lua_pkgs;
echo "> Python3 runtime" # shellHook = ''
echo "Run ./run-py.sh to see solution's output" # echo "> Lua runtime"
'' + shellHookAfter; # echo "Run ./run-lua.sh to see solution's output"
# '' + shellHookAfter;
}; # };
# python = pkgs.mkShell {
# nativeBuildInputs = py_pkgs;
# shellHook = ''
# echo "> Python3 runtime"
# echo "Run ./run-py.sh to see solution's output"
# '' + shellHookAfter;
#
# };
# };
} }
); );
} }