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" {
22 source = " ../nix-build"
33 attribute = var. nixos_system_attr
44 file = var. file
5+ nix_options = var. nix_options
56}
67
78module "partitioner-build" {
89 source = " ../nix-build"
910 attribute = var. nixos_partitioner_attr
1011 file = var. file
12+ nix_options = var. nix_options
1113}
1214
1315locals {
@@ -37,7 +39,7 @@ module "nixos-rebuild" {
3739 module . install
3840 ]
3941
40- # Do not execute this step if var.stop_after_disko == true
42+ # Do not execute this step if var.stop_after_disko == true
4143 count = var. stop_after_disko ? 0 : 1
4244
4345 source = " ../nixos-rebuild"
Original file line number Diff line number Diff line change @@ -101,3 +101,9 @@ variable "no_reboot" {
101101 description = " Do not reboot after installation"
102102 default = false
103103}
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+ }
14data "external" "nix-build" {
25 program = [ " ${ path . module } /nix-build.sh" ]
36 query = {
47 attribute = var.attribute
58 file = var.file
9+ nix_options = local.nix_options
610 }
711}
812output "result" {
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -efu
33
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) "' ) "
66if [[ -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 " )
88 printf ' %s' " $out " | jq -c ' .[].outputs'
99else
10- out=$( nix build --no-link --json " $attribute " )
10+ out=$( nix build --no-link --json $( echo " $nix_options " ) " $attribute " )
1111 printf ' %s' " $out " | jq -c ' .[].outputs'
1212fi
Original file line number Diff line number Diff line change @@ -8,3 +8,9 @@ variable "file" {
88 description = " the nix file to evaluate, if not run in flake mode"
99 default = null
1010}
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