PortValhalla/scripts/Common/Scripts/eval-flake.fish

27 lines
708 B
Fish
Raw Normal View History

2024-09-08 15:09:01 +00:00
#!/bin/env fish
function evalFlake --argument-names config property
set -l argv $argv[3..]
argparse --ignore-unknown "apply=" "json" -- $argv
if [ -z "$_flag_json" ]
set -a argv --raw
else
set -a argv --json
end
if [ -z "$_flag_apply" ]
set _flag_apply "_: _"
end
if [ -n "$config" ]
set config ".$config"
set _flag_apply "_: ($_flag_apply) ((import $(status dirname)/../../../lib/eval-attribute.nix) _)"
end
PROPERTY="$property" \
nix eval --impure --extra-experimental-features "nix-command flakes" \
--apply "$_flag_apply" \
"$(realpath (status dirname))/../../..#valhalla$config" \
$argv
end