File tree Expand file tree Collapse file tree 4 files changed +29
-17
lines changed Expand file tree Collapse file tree 4 files changed +29
-17
lines changed Original file line number Diff line number Diff line change 1
1
module "system-build" {
2
- source = " ../nix-build"
3
- attribute = var. nixos_system_attr
4
- file = var. file
5
- nix_options = var. nix_options
6
- special_args = var. special_args
2
+ source = " ../nix-build"
3
+ attribute = var. nixos_system_attr
4
+ debug_logging = var. debug_logging
5
+ file = var. file
6
+ nix_options = var. nix_options
7
+ special_args = var. special_args
7
8
}
8
9
9
10
module "partitioner-build" {
10
- source = " ../nix-build"
11
- attribute = var. nixos_partitioner_attr
12
- file = var. file
13
- nix_options = var. nix_options
14
- special_args = var. special_args
11
+ source = " ../nix-build"
12
+ attribute = var. nixos_partitioner_attr
13
+ debug_logging = var. debug_logging
14
+ file = var. file
15
+ nix_options = var. nix_options
16
+ special_args = var. special_args
15
17
}
16
18
17
19
locals {
Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ locals {
6
6
data " external" " nix-build" {
7
7
program = [" ${ path . module } /nix-build.sh" ]
8
8
query = {
9
- attribute = var.attribute
10
- file = var.file
11
- nix_options = local.nix_options
12
- special_args = jsonencode (var. special_args )
9
+ attribute = var.attribute
10
+ file = var.file
11
+ nix_options = local.nix_options
12
+ debug_logging = var.debug_logging
13
+ special_args = jsonencode (var. special_args )
13
14
}
14
15
}
15
16
output " result" {
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
set -efu
3
3
4
- declare file attribute nix_options special_args
5
- eval " $( jq -r ' @sh "attribute=\(.attribute) file=\(.file) nix_options=\(.nix_options) special_args=\(.special_args)"' ) "
4
+ declare file attribute nix_options special_args debug_logging
5
+ eval " $( jq -r ' @sh "attribute=\(.attribute) file=\(.file) nix_options=\(.nix_options) special_args=\(.special_args) debug_logging=\(.debug_logging)"' ) "
6
+ if [ " ${debug_logging} " = " true" ]; then
7
+ set -x
8
+ fi
6
9
if [ " ${nix_options} " != ' {"options":{}}' ]; then
7
10
options=$( echo " ${nix_options} " | jq -r ' .options | to_entries | map("--option \(.key) \(.value)") | join(" ")' )
8
11
else
41
44
# substitute variables into the template
42
45
nix_expr=" (builtins.getFlake ''${flake_url} '').${config_path} .extendModules { specialArgs = builtins.fromJSON ''${special_args} ''; }"
43
46
# inject `special_args` into nixos config's `specialArgs`
44
-
47
+
45
48
# shellcheck disable=SC2086
46
49
out=$( nix build --no-link --json ${options} --expr " ${nix_expr} " " ${config_attribute} " )
47
50
fi
Original file line number Diff line number Diff line change @@ -20,3 +20,9 @@ variable "special_args" {
20
20
default = {}
21
21
description = " A map exposed as NixOS's `specialArgs` thru a file."
22
22
}
23
+
24
+ variable "debug_logging" {
25
+ type = bool
26
+ default = false
27
+ description = " Enable debug logging"
28
+ }
You can’t perform that action at this time.
0 commit comments