Skip to content

Commit

Permalink
Don't save environment with the instance.
Browse files Browse the repository at this point in the history
This neat trick does not work with all workflows, and some of the
functionality that uses it has already been changed or removed.

Let's reconsider this functionality after 0.7.

* examples/config-base.scm (envfile): Remove.
* create (prep_init_mount_point): Don't create config.env & co.
  • Loading branch information
mbakke committed Nov 1, 2022
1 parent a7cf56c commit f566bcf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
13 changes: 0 additions & 13 deletions create
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,6 @@ prep_init_mount_point(){
fi
fi

# Create /etc/config.env on target with relevant environment
# variables, assuming that the value of the variables are
# correctly set, we therefore skip the quote for ease of parsing
# them back to our guix config.scm files.
TARGET_ETC="$TARGET_ROOT"/etc
mkdir -p "$TARGET_ETC" >&2
printf '%s\n' INSTANCE_NAME="$INSTANCE_NAME" > "$TARGET_ETC"/config.env
printf '%s\n' NIC_0_NETWORK_SUBNET="$NIC_0_NETWORK_SUBNET" >> "$TARGET_ETC"/config.env
printf '%s\n' NIC_0_NETWORK_GATEWAY="$NIC_0_NETWORK_GATEWAY" >> "$TARGET_ETC"/config.env
printf '%s\n' NIC_0_IP="$NIC_0_IP" >> "$TARGET_ETC"/config.env
printf '%s\n' FS_TYPE="$FS_TYPE" >> "$TARGET_ETC"/config.env
guix describe --format=json | "${JQ}" -r '"GUIX_COMMIT=" + .[].commit' >> "$TARGET_ETC"/config.env
cat "$(dirname "$(readlink -f "${GUIX_CONFIG}")")"/config-base.scm > "$TARGET_ETC"/config-base.scm
printf "$TARGET_ROOT"
}
# guix system init on a target device's second partition
Expand Down
9 changes: 0 additions & 9 deletions examples/config-base.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
(use-package-modules certs screen linux)
(use-service-modules networking ssh sysctl)

(let ((envfile (string-append (dirname (current-filename)) "/config.env")))
(if (file-exists? envfile)
(call-with-input-file envfile
(lambda (port)
(let ((lines (get-string-all port)))
(environ
(append (delete "" (string-split lines #\newline))
(environ))))))))

(define (cidr->netmask address)
"Convert a CIDR specification such as 10.0.0.0/24 to 255.255.255.0."
(let ((mask (string->number (match (string-split address #\/)
Expand Down

1 comment on commit f566bcf

@methuselah-0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updated thoughts on this? What workflows are not compatible?

Please sign in to comment.