Commit d8c1b33c9289
Changed files (1)
fish
fish/nix-aliases.fish
@@ -1,27 +1,32 @@
-function mr
- nix run nixpkgs.mr -c mr $argv
+function _def_nix_run_aliases
+ set -l stable mr sshfs wakeonlan:python36Packages.wakeonlan lspci:pciutils lsusb:usbutils beet:beets
+ set -l unstable op:1password update-desktop-database:destkop-file-utils
+ for s in $stable
+ _nix_run_package $s
+ end
+ for s in $unstable
+ _nix_run_package $s "-f ~/.config/nixpkgs/channels.nix"
+ end
end
-function wakeonlan
- nix run nixpkgs.python36Packages.wakeonlan -c wakeonlan $argv
+function _nix_run_package
+ set -l s $argv[1]
+ set -l package (string split ":" $s)
+ switch (count $package)
+ case 1
+ _nix_run $s $s $argv[2]
+ case 2
+ _nix_run $package[1] $package[2] $argv[2]
+ end
end
-function op
- nix run -f ~/.config/nixpkgs/channels.nix unstable.1password -c op $argv
+function _nix_run
+ set -l c $argv[1]
+ set -l p $argv[2]
+ set -l extra $argv[3]
+ function $c --inherit-variable c --inherit-variable p --inherit-variable extra
+ nix run $extra "nixpkgs.$p" -c $c $argv
+ end
end
-function update-desktop-database
- nix run nixpkgs.desktop-file-utils -c update-desktop-database $argv
-end
-
-function sshfs
- nix run nixpkgs.sshfs -c sshfs $argv
-end
-
-function lspci
- nix run nixpkgs.pciutils -c lspci $argv
-end
-
-function lsusb
- nix run nixpkgs.usbutils -c lsusb $argv
-end
+_def_nix_run_aliases