summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch
diff options
context:
space:
mode:
authorbenaryorg <binary@benary.org>2024-09-05 01:21:14 +0000
committerbenaryorg <binary@benary.org>2024-11-02 02:57:40 +0000
commit048d8cceeec8d20b6267fde8dc55bb753706a4fd (patch)
tree28a4acf0b1cb510eb11b63b5d3ebe6aa454d8c26 /pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch
parentedd7f434421aa1d00795cd77cdb404aa8839f00d (diff)
nixos/qemu-vm: minor readability improvements
The script generation is using the *lib.imap* functions in several other places already so this spot using a shell script variable instead seems a bit off. Moving the previous shell script code to Nix improves upon the Nix code by removing the additional *lib.optionalString* for the variable initialisation making the code more concise. The shell code is reduced to a one-liner per disk image, making it much easier to determine that this is a templated loop. Compare the previous: ```bash idx=0 if ! test -e "empty$idx.qcow2"; then /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "20480M" fi idx=$((idx + 1)) if ! test -e "empty$idx.qcow2"; then /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "20480M" fi idx=$((idx + 1)) if ! test -e "empty$idx.qcow2"; then /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "20480M" fi idx=$((idx + 1)) ``` and the new: ```bash test -e "empty0.qcow2" || /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty0.qcow2" "20480M" test -e "empty1.qcow2" || /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty1.qcow2" "20480M" test -e "empty2.qcow2" || /nix/store/73n3qwfazqw8zwr1z840jsirjllqpg9v-qemu-host-cpu-only-for-vm-tests-9.0.2/bin/qemu-img create -f qcow2 "empty2.qcow2" "20480M" ``` While the line becomes slightly longer it also becomes immediately obvious on a visual level which parts are changing for each invocation (i.e. different disk sizes as well as the incremented counter stick out). Since the "idx" variable is now embedded, this also becomes copy&pastable, and also shows the maximum index readily in the last line, as opposed to having to count the number of if statements otherwise. None of this is *needed* of course. Signed-off-by: benaryorg <binary@benary.org>
Diffstat (limited to 'pkgs/development/python-modules/python-mapnik/python-mapnik_std_optional.patch')
0 files changed, 0 insertions, 0 deletions