# SPDX-FileCopyrightText: 2022 Luke Granger-Brown # # SPDX-License-Identifier: Apache-2.0 { pkgs, ... }: let python3Env = pkgs.python3.withPackages (pm: with pm; [ absl-py ]); src = pkgs.runCommand "factorio-multiworld-infect-src" { nativeBuildInputs = [ (pkgs.python3.withPackages (pm: with pm; [ black ])) pkgs.luaformatter ]; src = ./.; } '' mkdir $out cp $src/infect.py $out/infect.py black --check $out/infect.py cp $src/multiworld.lua $out/multiworld.lua cp $src/.lua-format ./. lua-format --check $out/multiworld.lua ''; in pkgs.runCommand "factorio-multiworld-infect" { python3 = "${python3Env}/bin/python"; infectPy = "${src}/infect.py"; multiworldlua = "${src}/multiworld.lua"; } '' mkdir -p $out/bin substitute $infectPy $out/bin/factorio-multiworld-infect \ --subst-var python3 \ --subst-var multiworldlua chmod +x $out/bin/factorio-multiworld-infect ''