From b8f9b7c2d03c4a168155526cf20f368db199e08a Mon Sep 17 00:00:00 2001 From: pegasust Date: Sun, 4 Dec 2022 06:54:01 +0000 Subject: [PATCH] fix: d4: pkgs.lua.withPackages operator precedence goes awry --- 2022/d4/flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ 2022/d4/flake.nix | 46 ++++++++++++++++++++++++++-------------------- 2 files changed, 69 insertions(+), 20 deletions(-) create mode 100644 2022/d4/flake.lock diff --git a/2022/d4/flake.lock b/2022/d4/flake.lock new file mode 100644 index 0000000..a62a638 --- /dev/null +++ b/2022/d4/flake.lock @@ -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 +} diff --git a/2022/d4/flake.nix b/2022/d4/flake.nix index bf6291e..aa68136 100644 --- a/2022/d4/flake.nix +++ b/2022/d4/flake.nix @@ -11,31 +11,37 @@ pkgs = import nixpkgs { system = sys; overlays = overlays; }; shellHookAfter = '' 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 - rec { - devShell = devShell.lua; - devShell.lua = lib.mkShell { - nativeBuildInputs = [ - pkgs.lua.withPackages - (luapkgs: - [ luapkgs.busted luapkgs.luafilesystem ] - ) - ]; + { + # Jack of all trades + devShell = pkgs.mkShell { + nativeBuildInputs = py_pkgs ++ lua_pkgs; shellHook = '' - echo "> Lua runtime" - echo "Run ./run-lua.sh to see solution's output" + 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" '' + shellHookAfter; }; - devShell.python = lib.mkShell { - nativeBuildInputs = [ pkgs.python3 ]; - shellHook = '' - echo "> Python3 runtime" - echo "Run ./run-py.sh to see solution's output" - '' + shellHookAfter; - - }; + # devShells.${sys} = { + # lua = pkgs.mkShell { + # nativeBuildInputs = lua_pkgs; + # shellHook = '' + # echo "> Lua runtime" + # 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; + # + # }; + # }; } ); }