27 lines
742 B
Fish
Executable file
27 lines
742 B
Fish
Executable file
#!/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 $(realpath --relative-to (pwd) "$(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
|