nix-setup/nix-cmd.script.nix
2024-09-07 01:18:31 +02:00

12 lines
234 B
Nix

with import <nixpkgs> {};
pkgs.writeShellScriptBin "nix-cmd" ''
#!/bin/sh
pkg="''${@:1:1}"
rest="''${@:2}"
if [ "$rest" = "" ] ; then
rest="$pkg"
fi
exec nix-shell -p $pkg --run "$(echo "$rest" | sed -E "s/^_ /$pkg /")"
''