59 lines
1.3 KiB
Fish
Executable file
59 lines
1.3 KiB
Fish
Executable file
#!/bin/env fish
|
|
function isConfigured -S
|
|
set -q CONFIG_NAME
|
|
end
|
|
|
|
function getProfiles -S
|
|
source "$(status dirname)/eval-flake.fish";
|
|
evalFlake "" "" --apply "builtins.attrNames" --json
|
|
end
|
|
|
|
function getConfig -S -a property
|
|
source "$(status dirname)/eval-flake.fish"
|
|
evalFlake "$CONFIG_NAME" "$property" $argv[2..]
|
|
end
|
|
|
|
function getOSConfigRoot
|
|
echo "valhalla.linux"
|
|
end
|
|
|
|
function getOSConfig -S -a property
|
|
getConfig "$(getOSConfigRoot).$property" $argv[2..]
|
|
end
|
|
|
|
function getAttributes -S -a property
|
|
getConfig "$property" --apply "builtins.attrNames" --json
|
|
end
|
|
|
|
function getUsers -S
|
|
getAttributes "$(getOSConfigRoot).users"
|
|
end
|
|
|
|
function getUserConfig -S -a name property
|
|
getOSConfig "users.$name.$property" $argv[3..]
|
|
end
|
|
|
|
function isSet -S -a property
|
|
not test "$(getConfig "$property" --json)" = "null"
|
|
end
|
|
|
|
function isOSSet -S -a property
|
|
isSet "$(getOSConfigRoot).$property"
|
|
end
|
|
|
|
function isUserSet -S -a name property
|
|
isOSSet "users.$name.$property"
|
|
end
|
|
|
|
function isEnabled -S -a property
|
|
getConfig "$property" --json | jq --exit-status > /dev/null
|
|
end
|
|
|
|
function isOSEnabled -S -a property
|
|
isEnabled "$(getOSConfigRoot).$property"
|
|
end
|
|
|
|
function collectionActive -S -a name
|
|
isOSEnabled "software.$name"
|
|
end
|