Commit e7e6df1355a4
Changed files (1)
fish
fish/nix-aliases.fish
@@ -1,11 +1,12 @@
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
+ set -l unstable op:_1password update-desktop-database:desktop-file-utils
+ set -l channels_file ~/.config/nixpkgs/channels.nix
for s in $stable
- _nix_run_package $s
+ _nix_run_package $s nixpkgs
end
for s in $unstable
- _nix_run_package $s "-f ~/.config/nixpkgs/channels.nix"
+ _nix_run_package $s unstable $channels_file
end
end
@@ -14,18 +15,23 @@ function _nix_run_package
set -l package (string split ":" $s)
switch (count $package)
case 1
- _nix_run $s $s $argv[2]
+ _nix_run $s $s $argv[2] $argv[3]
case 2
- _nix_run $package[1] $package[2] $argv[2]
+ _nix_run $package[1] $package[2] $argv[2] $argv[3]
end
end
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
+ set -l channel $argv[3]
+ set -l channelsfile $argv[4]
+ function $c --inherit-variable c --inherit-variable p --inherit-variable channel --inherit-variable channelsfile
+ set -l cmd nix run
+ if test -n "$channelsfile"
+ set cmd $cmd -f $channelsfile
+ end
+ eval $cmd $channel.$p -c $c $argv
end
end