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

12 lines
367 B
Fish
Raw Normal View History

2024-07-09 00:22:12 +00:00
#!/bin/env fish
function evalModule --argument-names modulePath property
2024-07-11 19:01:39 +00:00
set -l argv $argv[3..]
if not contains -- "--json" $argv
set -a argv --raw
end
2024-07-09 00:22:12 +00:00
set -l nixPkgs 'import <nixpkgs> { config = {}; overlay = []; }'
2024-07-11 19:01:39 +00:00
nix eval --file "$modulePath" --apply "_: (($nixPkgs).lib.evalModules { modules = [ _ ]; }).config.$property" $argv
2024-07-09 00:22:12 +00:00
end