feat: add nix for formatting
Also adds CI tests!
This commit is contained in:
parent
58249e9ad0
commit
73142cfab8
9 changed files with 314 additions and 121 deletions
|
@ -13,7 +13,7 @@ endgroup
|
|||
|
||||
group 'Show Packages'
|
||||
packages=$(
|
||||
jq --raw-output '.packages."x86_64-linux" | select(. != null) | keys[]' <<-EOF
|
||||
jq --raw-output '.packages."x86_64-linux" | select(. != null) | keys[]' <<-EOF
|
||||
$flake_info
|
||||
EOF
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ endgroup
|
|||
|
||||
group 'Show NixOS Configurations'
|
||||
configurations=$(
|
||||
jq --raw-output '.nixosConfigurations | select(. != null) | keys[]' <<-EOF
|
||||
jq --raw-output '.nixosConfigurations | select(. != null) | keys[]' <<-EOF
|
||||
$flake_info
|
||||
EOF
|
||||
)
|
||||
|
@ -30,34 +30,34 @@ log "$configurations"
|
|||
endgroup
|
||||
|
||||
pkgs_json() {
|
||||
group 'Building packages'
|
||||
trap endgroup RETURN
|
||||
for package in $packages; do
|
||||
log "Building $package"
|
||||
path=$(nix build --print-out-paths ".#$package")
|
||||
log "Calculating size of $package"
|
||||
nix path-info --closure-size --json "$path" |
|
||||
jq --compact-output --arg pkg "$package" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
|
||||
done
|
||||
endgroup
|
||||
group 'Building packages'
|
||||
trap endgroup RETURN
|
||||
for package in $packages; do
|
||||
log "Building $package"
|
||||
path=$(nix build --print-out-paths ".#$package")
|
||||
log "Calculating size of $package"
|
||||
nix path-info --closure-size --json "$path" |
|
||||
jq --compact-output --arg pkg "$package" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
|
||||
done
|
||||
endgroup
|
||||
}
|
||||
|
||||
configs_json() {
|
||||
group 'Building NixOS configurations'
|
||||
trap endgroup RETURN
|
||||
for config in $configurations; do
|
||||
log "Building $config"
|
||||
path=$(nix build --print-out-paths ".#nixosConfigurations.$config.config.system.build.toplevel")
|
||||
log "Calculating size of $config"
|
||||
nix path-info --closure-size --json "$path" |
|
||||
jq --compact-output --arg pkg "$config" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
|
||||
done
|
||||
group 'Building NixOS configurations'
|
||||
trap endgroup RETURN
|
||||
for config in $configurations; do
|
||||
log "Building $config"
|
||||
path=$(nix build --print-out-paths ".#nixosConfigurations.$config.config.system.build.toplevel")
|
||||
log "Calculating size of $config"
|
||||
nix path-info --closure-size --json "$path" |
|
||||
jq --compact-output --arg pkg "$config" '.[] | {"name": $pkg, "size": .closureSize, "narSize": .narSize}'
|
||||
done
|
||||
}
|
||||
|
||||
pkgs=$(pkgs_json | jq --slurp '.')
|
||||
configs=$(configs_json | jq --slurp '.')
|
||||
|
||||
echo "{}" | jq \
|
||||
--argjson pkgs "$pkgs" \
|
||||
--argjson configs "$configs" \
|
||||
'{"packages": $pkgs, "nixosConfigurations": $configs}'
|
||||
--argjson pkgs "$pkgs" \
|
||||
--argjson configs "$configs" \
|
||||
'{"packages": $pkgs, "nixosConfigurations": $configs}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue