File tree Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Expand file tree Collapse file tree 5 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,14 @@ module "system-build" {
2
2
source = " ../nix-build"
3
3
attribute = var. nixos_system_attr
4
4
file = var. file
5
+ nix_options = var. nix_options
5
6
}
6
7
7
8
module "partitioner-build" {
8
9
source = " ../nix-build"
9
10
attribute = var. nixos_partitioner_attr
10
11
file = var. file
12
+ nix_options = var. nix_options
11
13
}
12
14
13
15
locals {
@@ -37,7 +39,7 @@ module "nixos-rebuild" {
37
39
module . install
38
40
]
39
41
40
- # Do not execute this step if var.stop_after_disko == true
42
+ # Do not execute this step if var.stop_after_disko == true
41
43
count = var. stop_after_disko ? 0 : 1
42
44
43
45
source = " ../nixos-rebuild"
Original file line number Diff line number Diff line change @@ -101,3 +101,9 @@ variable "no_reboot" {
101
101
description = " Do not reboot after installation"
102
102
default = false
103
103
}
104
+
105
+ variable "nix_options" {
106
+ type = map (string )
107
+ description = " the options of nix"
108
+ default = null
109
+ }
Original file line number Diff line number Diff line change
1
+ locals {
2
+ nix_options = var. nix_options == null ? " " : join (" " , [for k , v in var . nix_options : " --option ${ k } ${ v } " ])
3
+ }
1
4
data "external" "nix-build" {
2
5
program = [ " ${ path . module } /nix-build.sh" ]
3
6
query = {
4
7
attribute = var.attribute
5
8
file = var.file
9
+ nix_options = local.nix_options
6
10
}
7
11
}
8
12
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
5
- eval " $( jq -r ' @sh "attribute=\(.attribute) file=\(.file)"' ) "
4
+ declare file attribute nix_options
5
+ eval " $( jq -r ' @sh "attribute=\(.attribute) file=\(.file) nix_options=\(.nix_options) "' ) "
6
6
if [[ -n ${file-} ]] && [[ -e ${file-} ]]; then
7
- out=$( nix build --no-link --json -f " $file " " $attribute " )
7
+ out=$( nix build --no-link --json $( echo " $nix_options " ) -f " $file " " $attribute " )
8
8
printf ' %s' " $out " | jq -c ' .[].outputs'
9
9
else
10
- out=$( nix build --no-link --json " $attribute " )
10
+ out=$( nix build --no-link --json $( echo " $nix_options " ) " $attribute " )
11
11
printf ' %s' " $out " | jq -c ' .[].outputs'
12
12
fi
Original file line number Diff line number Diff line change @@ -8,3 +8,9 @@ variable "file" {
8
8
description = " the nix file to evaluate, if not run in flake mode"
9
9
default = null
10
10
}
11
+
12
+ variable "nix_options" {
13
+ type = map (string )
14
+ description = " the options of nix"
15
+ default = null
16
+ }
You can’t perform that action at this time.
0 commit comments