[PATCH 1/2] remote: Build derivations appropriate for the remote's architecture.

  • Done
  • quality assurance status badge
Details
3 participants
  • Christopher Lemmer Webber
  • Thompson, David
  • Jakob L. Kreuze
Owner
unassigned
Submitted by
Jakob L. Kreuze
Severity
normal
J
J
Jakob L. Kreuze wrote on 31 Jul 2019 15:41
(address . guix-patches@gnu.org)
87lfwee2yd.fsf@sdf.lonestar.org
* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
guix/remote.scm | 13 ++++++++-----
guix/ssh.scm | 7 +++++++
2 files changed, 15 insertions(+), 5 deletions(-)

Toggle diff (58 lines)
diff --git a/guix/remote.scm b/guix/remote.scm
index 853029c54f..d5738ebbfa 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -72,7 +72,7 @@ prerequisites of EXP are already available on the host at SESSION."
"Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
result to the current output port using the (guix repl) protocol."
(define program
- (scheme-file "remote-exp.scm" exp))
+ (program-file "remote-exp.scm" exp))
(with-imported-modules (source-module-closure '((guix repl)))
#~(begin
@@ -97,10 +97,13 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
the remote store afterwards; otherwise, dependencies are built directly on the
remote store."
- (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
- #:module-path %load-path))
- (remote -> (connect-to-remote-daemon session
- socket-name)))
+ (mlet* %store-monad ((system -> (remote-system session))
+ (lowered (lower-gexp (trampoline exp)
+ #:system system
+ #:guile-for-build #f
+ #:module-path %load-path))
+ (remote -> (connect-to-remote-daemon session
+ socket-name)))
(define inputs
(cons (lowered-gexp-guile lowered)
(lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
remote-inferior
remote-daemon-channel
connect-to-remote-daemon
+ remote-system
send-files
retrieve-files
retrieve-files*
@@ -282,6 +283,12 @@ be read. When RECURSIVE? is true, the closure of FILES is exported."
,(object->string
(object->string export))))))
+(define (remote-system session)
+ "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+ (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+ session))
+
(define* (send-files local files remote
#:key
recursive?
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1BmooACgkQ9Qb9Fp2P
2VptEA/+J/IgPRjvq/Cbe/wFJbMLxlyiq7ZEImt88YwBIHZHhXIttMa8SfNy7L+w
AZt6YhmcNH/NtxNzLGEt0uUT2zk4T/MObXuwMj4rYq0R8nOLtNOj316buNlLVz6K
VPFGrOVq/rzp3IIY88QpFCTsNLNHB//7WeBbMoFGevRPGfi3+G5fjPWIPAFVci4e
zQ2A8HkQ0vctOoD0KG95bMARsCSWY7n3IZ5BDhVW5X/sWse9IviQWRi1ijplqKFF
53OY5hG64wWxcuvmc5dvoq1u+uT1cOiNlSQ7Dc+7AkCc9fi4CsmT1C9u1NCYhDs1
agEYIC0R27bvocN9JZrad2kRiDLnRRDiarpsXaarsrB12xKIvgPSc4eMZX4oWQ4D
ETlbd6KTtMa1H5F+Nn8wHCfVV8LfJwdP511qGB/WAgO3Ka1RQ8b2IB2xUrYNVctN
Tvxh/c6QnmGPlftDoKLuF8xef7yUwv/X1sSsj+sdfgxl+n5xZIURwGJs5F5PB4qu
mc+K1cz+w2lRAClZnVqWNtdzTrc/9u77n6iHiO2TKsrnT6FA/uFAfQ2+nlqCuU05
Bq8ZPU/NYGjWebEZ8E5b3gbsNuMmiTE4Sd7EyPaawlCJDalSad94JZq9VO0z9Rd/
r0a+ZT/sOHme2VhOPpcuFCGjaofulG3TXBlw+yY4NMeCslNNBGE=
=hfQd
-----END PGP SIGNATURE-----

J
J
Jakob L. Kreuze wrote on 31 Jul 2019 15:43
[PATCH 2/2] remote: Remove '--system' argument.
(address . 36872@debbugs.gnu.org)
87h872e2v2.fsf@sdf.lonestar.org
* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
gnu/services.scm | 56 ++++++++++++++++++++---------------------
guix/scripts/deploy.scm | 8 ++----
2 files changed, 30 insertions(+), 34 deletions(-)

Toggle diff (102 lines)
diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
(define (activation-script gexps)
"Return the system's activation script, which evaluates GEXPS."
(define actions
- (map (cut scheme-file "activate-service" <>) gexps))
-
- (scheme-file "activate"
- (with-imported-modules (source-module-closure
- '((gnu build activation)
- (guix build utils)))
- #~(begin
- (use-modules (gnu build activation)
- (guix build utils))
-
- ;; Make sure the user accounting database exists. If it
- ;; does not exist, 'setutxent' does not create it and
- ;; thus there is no accounting at all.
- (close-port (open-file "/var/run/utmpx" "a0"))
-
- ;; Same for 'wtmp', which is populated by mingetty et
- ;; al.
- (mkdir-p "/var/log")
- (close-port (open-file "/var/log/wtmp" "a0"))
-
- ;; Set up /run/current-system. Among other things this
- ;; sets up locales, which the activation snippets
- ;; executed below may expect.
- (activate-current-system)
-
- ;; Run the services' activation snippets.
- ;; TODO: Use 'load-compiled'.
- (for-each primitive-load '#$actions)))))
+ (map (cut program-file "activate-service.scm" <>) gexps))
+
+ (program-file "activate.scm"
+ (with-imported-modules (source-module-closure
+ '((gnu build activation)
+ (guix build utils)))
+ #~(begin
+ (use-modules (gnu build activation)
+ (guix build utils))
+
+ ;; Make sure the user accounting database exists. If it
+ ;; does not exist, 'setutxent' does not create it and
+ ;; thus there is no accounting at all.
+ (close-port (open-file "/var/run/utmpx" "a0"))
+
+ ;; Same for 'wtmp', which is populated by mingetty et
+ ;; al.
+ (mkdir-p "/var/log")
+ (close-port (open-file "/var/log/wtmp" "a0"))
+
+ ;; Set up /run/current-system. Among other things this
+ ;; sets up locales, which the activation snippets
+ ;; executed below may expect.
+ (activate-current-system)
+
+ ;; Run the services' activation snippets.
+ ;; TODO: Use 'load-compiled'.
+ (for-each primitive-load '#$actions)))))
(define (gexps->activation-gexp gexps)
"Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 8eeb9ae7a1..bc1d93a93a 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -44,8 +44,6 @@
(define (show-help)
(display (G_ "Usage: guix deploy [OPTION] FILE...
Perform the deployment specified by FILE.\n"))
- (display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(show-build-options-help)
(newline)
(display (G_ "
@@ -67,8 +65,7 @@ Perform the deployment specified by FILE.\n"))
%standard-build-options))
(define %default-options
- `((system . ,(%current-system))
- (substitutes? . #t)
+ `((substitutes? . #t)
(build-hook? . #t)
(graft? . #t)
(debug . 0)
@@ -91,8 +88,7 @@ Perform the deployment specified by FILE.\n"))
(for-each (lambda (machine)
(info (G_ "deploying to ~a...~%")
(machine-display-name machine))
- (parameterize ((%current-system (assq-ref opts 'system))
- (%graft? (assq-ref opts 'graft?)))
+ (parameterize ((%graft? (assq-ref opts 'graft?)))
(guard (c ((message-condition? c)
(report-error (G_ "failed to deploy ~a: '~a'~%")
(machine-display-name machine)
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1BmwEACgkQ9Qb9Fp2P
2Vp5kw//en36fICfLjxE5bCOTR7KSDsGCzk7KsJJVi1v6v9KMhalBptAbIfD1irK
GpO7GWc2+DjSPyNLCb6Syjrnq5x8xuDCJTeK1IdTMDMLogijSe0uZA43rOmXtx4L
877MQ9KB+wejy4dTTS8LyLN2AmjhQBfNzxmPgF/7BechE0X5A+E7YyaHiYDAOGZu
/xmJRbK0KsFS3tCZ8HvHbT5Bx1dJYPN14oDenbNooC0wVZjHnxYf0hTJcWmdE7HK
Z6YS0zgJ9QBmJnAZagqq7GXCm5QUz7PXN5hSpeIb52LNa3YhLMlJiNyYQGlJTcpw
qQr3L0Z/JKbB/E9VRXncT4dsuaK5x3+7ak6Gm76JmGG9EPYjm+fQM8iDFOQEPT3e
G1qAO/aSifAEg6gyr4ZCKw42wyObjB2IeVZ14wxDdknDMreiij7Aq2z/PfZtOzOq
tsYseivavFPK433M8dhJnnZDkIOcZJLlArQvG6bu/W8RmwKfjg43/LBv9vzBhbxI
/2wFZ3CxSWWo20YN+krINoqUnMJDIafKJwKiVKfO+kyD/WOOGBJcTrfw+6Z1VW2O
qpZROkrfzZ5eW4CwBX+NH0V6WOF8l+ly+iVwpifBwvVKzccmLFmrRrrblt4+tShq
F2qQq3BefVRuVXAgXf/MaoPHHIJob3Fp0Kjt8vDpx8GKBJFn1WY=
=pNoE
-----END PGP SIGNATURE-----

C
C
Christopher Lemmer Webber wrote on 6 Aug 2019 22:57
(address . guix-patches@gnu.org)(address . 36872@debbugs.gnu.org)
87ef1yovur.fsf@dustycloud.org
I'm still wondering whether asking the remote machine what its
architecture is won't turn out to be fragile in some way, though I'm not
sure how to articulate how that would be yet. It seems like a weird
side effect to apply before doing the build. (What if we want to build
derivations when we don't actually have a machine up and running yet?
Etc, etc.)

But you and Dave seem to think it's the right thing to do, so I'm going
to assume that you both know what to do better than I do at this point.

At any rate, the patch looks fine; once it's rebased on top of master
I'm ok with pushing it if there are no objections.

Jakob L. Kreuze writes:

Toggle quote (110 lines)
> * gnu/services.scm (activation-script): Return a <program-file> rather
> than a <scheme-file>.
> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
> (show-help): Remove documentation for '--system'.
> (%default-options): Remove default setting for 'system'.
> ---
> gnu/services.scm | 56 ++++++++++++++++++++---------------------
> guix/scripts/deploy.scm | 8 ++----
> 2 files changed, 30 insertions(+), 34 deletions(-)
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 7de78105ff..6ee05d4580 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
> (define (activation-script gexps)
> "Return the system's activation script, which evaluates GEXPS."
> (define actions
> - (map (cut scheme-file "activate-service" <>) gexps))
> -
> - (scheme-file "activate"
> - (with-imported-modules (source-module-closure
> - '((gnu build activation)
> - (guix build utils)))
> - #~(begin
> - (use-modules (gnu build activation)
> - (guix build utils))
> -
> - ;; Make sure the user accounting database exists. If it
> - ;; does not exist, 'setutxent' does not create it and
> - ;; thus there is no accounting at all.
> - (close-port (open-file "/var/run/utmpx" "a0"))
> -
> - ;; Same for 'wtmp', which is populated by mingetty et
> - ;; al.
> - (mkdir-p "/var/log")
> - (close-port (open-file "/var/log/wtmp" "a0"))
> -
> - ;; Set up /run/current-system. Among other things this
> - ;; sets up locales, which the activation snippets
> - ;; executed below may expect.
> - (activate-current-system)
> -
> - ;; Run the services' activation snippets.
> - ;; TODO: Use 'load-compiled'.
> - (for-each primitive-load '#$actions)))))
> + (map (cut program-file "activate-service.scm" <>) gexps))
> +
> + (program-file "activate.scm"
> + (with-imported-modules (source-module-closure
> + '((gnu build activation)
> + (guix build utils)))
> + #~(begin
> + (use-modules (gnu build activation)
> + (guix build utils))
> +
> + ;; Make sure the user accounting database exists. If it
> + ;; does not exist, 'setutxent' does not create it and
> + ;; thus there is no accounting at all.
> + (close-port (open-file "/var/run/utmpx" "a0"))
> +
> + ;; Same for 'wtmp', which is populated by mingetty et
> + ;; al.
> + (mkdir-p "/var/log")
> + (close-port (open-file "/var/log/wtmp" "a0"))
> +
> + ;; Set up /run/current-system. Among other things this
> + ;; sets up locales, which the activation snippets
> + ;; executed below may expect.
> + (activate-current-system)
> +
> + ;; Run the services' activation snippets.
> + ;; TODO: Use 'load-compiled'.
> + (for-each primitive-load '#$actions)))))
>
> (define (gexps->activation-gexp gexps)
> "Return a gexp that runs the activation script containing GEXPS."
> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
> index 8eeb9ae7a1..bc1d93a93a 100644
> --- a/guix/scripts/deploy.scm
> +++ b/guix/scripts/deploy.scm
> @@ -44,8 +44,6 @@
> (define (show-help)
> (display (G_ "Usage: guix deploy [OPTION] FILE...
> Perform the deployment specified by FILE.\n"))
> - (display (G_ "
> - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
> (show-build-options-help)
> (newline)
> (display (G_ "
> @@ -67,8 +65,7 @@ Perform the deployment specified by FILE.\n"))
> %standard-build-options))
>
> (define %default-options
> - `((system . ,(%current-system))
> - (substitutes? . #t)
> + `((substitutes? . #t)
> (build-hook? . #t)
> (graft? . #t)
> (debug . 0)
> @@ -91,8 +88,7 @@ Perform the deployment specified by FILE.\n"))
> (for-each (lambda (machine)
> (info (G_ "deploying to ~a...~%")
> (machine-display-name machine))
> - (parameterize ((%current-system (assq-ref opts 'system))
> - (%graft? (assq-ref opts 'graft?)))
> + (parameterize ((%graft? (assq-ref opts 'graft?)))
> (guard (c ((message-condition? c)
> (report-error (G_ "failed to deploy ~a: '~a'~%")
> (machine-display-name machine)
J
J
Jakob L. Kreuze wrote on 6 Aug 2019 22:58
Re: [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's
(name . Christopher Lemmer Webber)(address . cwebber@dustycloud.org)(address . 36872@debbugs.gnu.org)
87o912vwmp.fsf_-_@sdf.lonestar.org
* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
guix/remote.scm | 13 ++++++++-----
guix/ssh.scm | 7 +++++++
2 files changed, 15 insertions(+), 5 deletions(-)

Toggle diff (58 lines)
diff --git a/guix/remote.scm b/guix/remote.scm
index 5fecd954e9..0a0bdaf30b 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -71,7 +71,7 @@ prerequisites of EXP are already available on the host at SESSION."
"Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
result to the current output port using the (guix repl) protocol."
(define program
- (scheme-file "remote-exp.scm" exp))
+ (program-file "remote-exp.scm" exp))
(with-imported-modules (source-module-closure '((guix repl)))
#~(begin
@@ -96,10 +96,13 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
the remote store afterwards; otherwise, dependencies are built directly on the
remote store."
- (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
- #:module-path %load-path))
- (remote -> (connect-to-remote-daemon session
- socket-name)))
+ (mlet* %store-monad ((system -> (remote-system session))
+ (lowered (lower-gexp (trampoline exp)
+ #:system system
+ #:guile-for-build #f
+ #:module-path %load-path))
+ (remote -> (connect-to-remote-daemon session
+ socket-name)))
(define inputs
(cons (lowered-gexp-guile lowered)
(lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
remote-inferior
remote-daemon-channel
connect-to-remote-daemon
+ remote-system
send-files
retrieve-files
retrieve-files*
@@ -282,6 +283,12 @@ be read. When RECURSIVE? is true, the closure of FILES is exported."
,(object->string
(object->string export))))))
+(define (remote-system session)
+ "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+ (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+ session))
+
(define* (send-files local files remote
#:key
recursive?
--
2.22.0
J
J
Jakob L. Kreuze wrote on 6 Aug 2019 22:59
Re: [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument.
(name . Christopher Lemmer Webber)(address . cwebber@dustycloud.org)(address . 36872@debbugs.gnu.org)
87imravwlo.fsf_-_@sdf.lonestar.org
* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
gnu/services.scm | 56 ++++++++++++++++++++---------------------
guix/scripts/deploy.scm | 8 ++----
2 files changed, 30 insertions(+), 34 deletions(-)

Toggle diff (101 lines)
diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
(define (activation-script gexps)
"Return the system's activation script, which evaluates GEXPS."
(define actions
- (map (cut scheme-file "activate-service" <>) gexps))
-
- (scheme-file "activate"
- (with-imported-modules (source-module-closure
- '((gnu build activation)
- (guix build utils)))
- #~(begin
- (use-modules (gnu build activation)
- (guix build utils))
-
- ;; Make sure the user accounting database exists. If it
- ;; does not exist, 'setutxent' does not create it and
- ;; thus there is no accounting at all.
- (close-port (open-file "/var/run/utmpx" "a0"))
-
- ;; Same for 'wtmp', which is populated by mingetty et
- ;; al.
- (mkdir-p "/var/log")
- (close-port (open-file "/var/log/wtmp" "a0"))
-
- ;; Set up /run/current-system. Among other things this
- ;; sets up locales, which the activation snippets
- ;; executed below may expect.
- (activate-current-system)
-
- ;; Run the services' activation snippets.
- ;; TODO: Use 'load-compiled'.
- (for-each primitive-load '#$actions)))))
+ (map (cut program-file "activate-service.scm" <>) gexps))
+
+ (program-file "activate.scm"
+ (with-imported-modules (source-module-closure
+ '((gnu build activation)
+ (guix build utils)))
+ #~(begin
+ (use-modules (gnu build activation)
+ (guix build utils))
+
+ ;; Make sure the user accounting database exists. If it
+ ;; does not exist, 'setutxent' does not create it and
+ ;; thus there is no accounting at all.
+ (close-port (open-file "/var/run/utmpx" "a0"))
+
+ ;; Same for 'wtmp', which is populated by mingetty et
+ ;; al.
+ (mkdir-p "/var/log")
+ (close-port (open-file "/var/log/wtmp" "a0"))
+
+ ;; Set up /run/current-system. Among other things this
+ ;; sets up locales, which the activation snippets
+ ;; executed below may expect.
+ (activate-current-system)
+
+ ;; Run the services' activation snippets.
+ ;; TODO: Use 'load-compiled'.
+ (for-each primitive-load '#$actions)))))
(define (gexps->activation-gexp gexps)
"Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 52bba3f3bf..52d5e1e1da 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -42,8 +42,6 @@
(define (show-help)
(display (G_ "Usage: guix deploy [OPTION] FILE...
Perform the deployment specified by FILE.\n"))
- (display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(show-build-options-help)
(newline)
(display (G_ "
@@ -65,8 +63,7 @@ Perform the deployment specified by FILE.\n"))
%standard-build-options))
(define %default-options
- `((system . ,(%current-system))
- (substitutes? . #t)
+ `((substitutes? . #t)
(build-hook? . #t)
(graft? . #t)
(debug . 0)
@@ -88,7 +85,6 @@ Perform the deployment specified by FILE.\n"))
(set-build-options-from-command-line store opts)
(for-each (lambda (machine)
(info (G_ "deploying to ~a...") (machine-display-name machine))
- (parameterize ((%current-system (assq-ref opts 'system))
- (%graft? (assq-ref opts 'graft?)))
+ (parameterize ((%graft? (assq-ref opts 'graft?)))
(run-with-store store (deploy-machine machine))))
machines))))
--
2.22.0
J
J
Jakob L. Kreuze wrote on 6 Aug 2019 23:29
Re: [bug#36872] [PATCH 2/2] remote: Remove '--system' argument.
(name . Christopher Lemmer Webber)(address . cwebber@dustycloud.org)(address . 36872@debbugs.gnu.org)
877e7qvv75.fsf@sdf.lonestar.org
Hey Chris!

Christopher Lemmer Webber <cwebber@dustycloud.org> writes:

Toggle quote (7 lines)
> I'm still wondering whether asking the remote machine what its
> architecture is won't turn out to be fragile in some way, though I'm not
> sure how to articulate how that would be yet. It seems like a weird
> side effect to apply before doing the build. (What if we want to build
> derivations when we don't actually have a machine up and running yet?
> Etc, etc.)

I agree that it isn't the purest solution, but my thinking is that
'remote-eval' is meant to be effectful anyway. As for the situation
where we build derivations for a machine that isn't running yet: I think
we can cross that bridge when we get to it -- 'guix deploy' doesn't have
the feature at the moment.

Regards,
Jakob
C
C
Christopher Lemmer Webber wrote on 7 Aug 2019 20:31
(address . 36872@debbugs.gnu.org)
87a7ckq129.fsf@dustycloud.org
Jakob L. Kreuze writes:

Toggle quote (20 lines)
> Hey Chris!
>
> Christopher Lemmer Webber <cwebber@dustycloud.org> writes:
>
>> I'm still wondering whether asking the remote machine what its
>> architecture is won't turn out to be fragile in some way, though I'm not
>> sure how to articulate how that would be yet. It seems like a weird
>> side effect to apply before doing the build. (What if we want to build
>> derivations when we don't actually have a machine up and running yet?
>> Etc, etc.)
>
> I agree that it isn't the purest solution, but my thinking is that
> 'remote-eval' is meant to be effectful anyway. As for the situation
> where we build derivations for a machine that isn't running yet: I think
> we can cross that bridge when we get to it -- 'guix deploy' doesn't have
> the feature at the moment.
>
> Regards,
> Jakob

I thought about it more between yesterday and today, and it continues to
seem strange to me that we're doing "probing" here. We don't probe to
guess where Guix is currently installed or etc to specify disks. I
guess that's not the same thing, but...

Here's the concern: imagine that we want to be able to up-front do
something like "guix system build" before we even start spinning up
servers. Does this block that direction?

Dave, your input appreciated on this one.

I'm not sure I want to block the patch series with my hand wringing, but
I do want to make sure we give it appropriate consideration.

- Chris
T
T
Thompson, David wrote on 7 Aug 2019 21:03
(name . Christopher Lemmer Webber)(address . cwebber@dustycloud.org)
CAJ=RwfYEDDD379=AMt9nE8oo6GmACc_sCQ+mwd6ZuZqqfbx9=w@mail.gmail.com
Hi,

On Wed, Aug 7, 2019 at 2:31 PM Christopher Lemmer Webber
<cwebber@dustycloud.org> wrote:
Toggle quote (10 lines)
>
> I thought about it more between yesterday and today, and it continues to
> seem strange to me that we're doing "probing" here. We don't probe to
> guess where Guix is currently installed or etc to specify disks. I
> guess that's not the same thing, but...
>
> Here's the concern: imagine that we want to be able to up-front do
> something like "guix system build" before we even start spinning up
> servers. Does this block that direction?

This is a good point. We want to make sure that the config file
*completely* describes the operating systems that need to be built,
therefore having to talk to a remote machine is no bueno. The reason
I didn't want the user to have to explicitly specify the remote
system's architecture is for usability. I wanted 'guix deploy' to
just DTRT like guix already does when you run `guix system
reconfigure` or `guix build` locally where %current-system defaults to
what the local machine is running. However, I think that providing
this information would only be a small inconvenience for the current
managed host environment type. This wouldn't be an issue at all for an
AWS environment type, for example, because the user would have to
specify which instance type they want and with that you know what the
value of %current-system should be when generating the OS derivation.
I imagine this would be the case for any cloud environment.

I think I've said this before (not sure if IRL or in an email) that we
should make it the responsibility of the environment type to determine
what the remote machine's system is. I still think that should be the
case, but we should change the managed host type so that the user
specifies that information as a new record field rather than making
'guix deploy' probe for it.

Does this make sense?

- Dave
J
J
Jakob L. Kreuze wrote on 7 Aug 2019 22:28
(name . Thompson, David)(address . dthompson2@worcester.edu)
87sgqclnz0.fsf@sdf.lonestar.org
Hi Chris and Dave,

"Thompson, David" <dthompson2@worcester.edu> writes:

Toggle quote (38 lines)
> Hi,
>
> On Wed, Aug 7, 2019 at 2:31 PM Christopher Lemmer Webber
> <cwebber@dustycloud.org> wrote:
>>
>> I thought about it more between yesterday and today, and it continues to
>> seem strange to me that we're doing "probing" here. We don't probe to
>> guess where Guix is currently installed or etc to specify disks. I
>> guess that's not the same thing, but...
>>
>> Here's the concern: imagine that we want to be able to up-front do
>> something like "guix system build" before we even start spinning up
>> servers. Does this block that direction?
>
> This is a good point. We want to make sure that the config file
> *completely* describes the operating systems that need to be built,
> therefore having to talk to a remote machine is no bueno. The reason
> I didn't want the user to have to explicitly specify the remote
> system's architecture is for usability. I wanted 'guix deploy' to
> just DTRT like guix already does when you run `guix system
> reconfigure` or `guix build` locally where %current-system defaults to
> what the local machine is running. However, I think that providing
> this information would only be a small inconvenience for the current
> managed host environment type. This wouldn't be an issue at all for an
> AWS environment type, for example, because the user would have to
> specify which instance type they want and with that you know what the
> value of %current-system should be when generating the OS derivation.
> I imagine this would be the case for any cloud environment.
>
> I think I've said this before (not sure if IRL or in an email) that we
> should make it the responsibility of the environment type to determine
> what the remote machine's system is. I still think that should be the
> case, but we should change the managed host type so that the user
> specifies that information as a new record field rather than making
> 'guix deploy' probe for it.
>
> Does this make sense?

Right. My gut feels a bit conflicted since 'remote-eval' is already
talking to the remote, but the points about building ahead of time and
having the configuration file completely specify the deployment are
strong -- perhaps the better thing to do is to add a 'system' keyword to
'remote-eval'. I'll redo this patch as a 'system' field for the
'managed-host-environment-type' configuration.

Regards,
Jakob
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1LNGMACgkQ9Qb9Fp2P
2Vqq7A/+IOlyZwgRKkoFCdK0oa/n5cvyxu+1FF3WksiEfKZ4flDF6dojOXq64jVW
EutCCflOwOL3cx1QM6wpZ6pN47pvl4IeDUAIickfci9aTlgoZR+dAOCTEfpvP+6t
OuxOqN2hurBRW3438U8+ugFlPSwIlW4X31eNFEnG792aivJeAWzLnAZV95iyvzuo
CWuQiMWv0/6w0cr/xa6Ec+sf8tLYfsa6y3/A8m0Yf6NDNfznFXyMQ1GTGGX9pp4u
7W/Scser6rQHd7KguKS3BpmoSLwvX+xvdNNPsvJyxqS930iMvbW2fcxaX2ixXcWk
xxg7QYPYIkvqW+5r6A+9ggVIae4LWVfryUEYxWjljg9RBec3zo/AHjCliPmmpNVI
EHfPv1tKJcL3uIsmam5BMZza0Quvr/A5X3QQ6say/+Bp6/2EVE0WDMeT3vZA3hsn
K+yyvZddbSIZ+QCW/GDJpnyJ2tn6H8o4epO88rzqlpIty/uLjoBwfT80Mypo09Xe
8GEdQkghUzkoOIOGbiWVk7jV3DIgzJSFVdh4V1oipxRsAz2zooEzNnF+0Azl1J17
r7k++fZDK0rvrGot6IFjjsPU3SX0mMsURUQhToBxcrfksLLR+0LLDKHrC3oeySez
wECacMRSK6zvWM0/fvw5JElQkdwpVfHvgB4n1LeEJW53c09h8eE=
=W92O
-----END PGP SIGNATURE-----

J
J
Jakob L. Kreuze wrote on 9 Aug 2019 20:24
Re: [bug#36872] [PATCH v2 1/2] remote: Build derivations appropriate for the remote's
(name . Thompson, David)(address . dthompson2@worcester.edu)
8736ianqme.fsf_-_@sdf.lonestar.org
* gnu/machine/ssh.scm (machine-ssh-configuration): Add 'system' field.
(managed-host-remote-eval): Pass 'system' field to 'remote-eval'.
(machine-check-building-for-appropriate-system): New variable.
(check-deployment-sanity): Add call to
'machine-check-building-for-appropriate-system'.
* doc/guix.texi (Invoking guix deploy): Describe new 'system' field.
* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(remote-eval): Add 'system' keyword argument.
(trampoline): Return a <program-file> rather than a <scheme-file>.
---
doc/guix.texi | 3 +++
gnu/machine/ssh.scm | 31 +++++++++++++++++++++++++++----
guix/remote.scm | 14 +++++++++-----
guix/ssh.scm | 7 +++++++
4 files changed, 46 insertions(+), 9 deletions(-)

Toggle diff (154 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 734206a4b2..a7facf4701 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -25573,6 +25573,9 @@ with an @code{environment} of @code{managed-host-environment-type}.
@table @asis
@item @code{host-name}
+@item @code{system}
+The Nix system type describing the architecture of the machine being deployed
+to. This should look something like ``x86_64-linux''.
@item @code{port} (default: @code{22})
@item @code{user} (default: @code{"root"})
@item @code{identity} (default: @code{#f})
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index ba3e33c922..670990a633 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -36,6 +36,7 @@
#:use-module (ice-9 match)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:export (managed-host-environment-type
@@ -68,6 +69,7 @@
machine-ssh-configuration?
this-machine-ssh-configuration
(host-name machine-ssh-configuration-host-name) ; string
+ (system machine-ssh-configuration-system) ; string
(build-locally? machine-ssh-configuration-build-locally?
(default #t))
(port machine-ssh-configuration-port ; integer
@@ -103,10 +105,12 @@ one from the configuration's parameters if one was not provided."
"Internal implementation of 'machine-remote-eval' for MACHINE instances with
an environment type of 'managed-host."
(maybe-raise-unsupported-configuration-error machine)
- (remote-eval exp (machine-ssh-session machine)
- #:build-locally?
- (machine-ssh-configuration-build-locally?
- (machine-configuration machine))))
+ (let ((config (machine-configuration machine)))
+ (remote-eval exp (machine-ssh-session machine)
+ #:build-locally?
+ (machine-ssh-configuration-build-locally? config)
+ #:system
+ (machine-ssh-configuration-system config))))
;;;
@@ -240,10 +244,29 @@ MACHINE's 'system' declaration do not exist on the machine."
device)
(return #t)))
+(define (machine-check-building-for-appropriate-system machine)
+ "Raise a '&message' error condition if MACHINE is configured to be built
+locally and the 'system' field does not match the '%current-system' reported
+by MACHINE."
+ (let ((config (machine-configuration machine))
+ (system (remote-system (machine-ssh-session machine))))
+ (when (and (machine-ssh-configuration-build-locally? config)
+ (not (string= system (machine-ssh-configuration-system config))))
+ (raise (condition
+ (&message
+ (message (format #f (G_ "incorrect target system \
+('~a' was given, while the system reports that it is '~a')~%")
+ (machine-ssh-configuration-system config)
+ system)))))))
+ (with-monad %store-monad (return #t)))
+
(define (check-deployment-sanity machine)
"Raise a '&message' error condition if it is clear that deploying MACHINE's
'system' declaration would fail."
+ ;; Order is important here -- an incorrect value for 'system' will cause
+ ;; invocations of 'remote-eval' to fail.
(mbegin %store-monad
+ (machine-check-building-for-appropriate-system machine)
(machine-check-file-system-availability machine)
(machine-check-initrd-modules machine)))
diff --git a/guix/remote.scm b/guix/remote.scm
index 5fecd954e9..bcac64ea7a 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -24,6 +24,7 @@
#:use-module (guix monads)
#:use-module (guix modules)
#:use-module (guix derivations)
+ #:use-module (guix utils)
#:use-module (ssh popen)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
@@ -71,7 +72,7 @@ prerequisites of EXP are already available on the host at SESSION."
"Return a \"trampoline\" gexp that evaluates EXP and writes the evaluation
result to the current output port using the (guix repl) protocol."
(define program
- (scheme-file "remote-exp.scm" exp))
+ (program-file "remote-exp.scm" exp))
(with-imported-modules (source-module-closure '((guix repl)))
#~(begin
@@ -89,6 +90,7 @@ result to the current output port using the (guix repl) protocol."
(define* (remote-eval exp session
#:key
(build-locally? #t)
+ (system (%current-system))
(module-path %load-path)
(socket-name "/var/guix/daemon-socket/socket"))
"Evaluate EXP, a gexp, on the host at SESSION, an SSH session. Ensure that
@@ -96,10 +98,12 @@ all the elements EXP refers to are built and deployed to SESSION beforehand.
When BUILD-LOCALLY? is true, said dependencies are built locally and sent to
the remote store afterwards; otherwise, dependencies are built directly on the
remote store."
- (mlet %store-monad ((lowered (lower-gexp (trampoline exp)
- #:module-path %load-path))
- (remote -> (connect-to-remote-daemon session
- socket-name)))
+ (mlet* %store-monad ((lowered (lower-gexp (trampoline exp)
+ #:system system
+ #:guile-for-build #f
+ #:module-path %load-path))
+ (remote -> (connect-to-remote-daemon session
+ socket-name)))
(define inputs
(cons (lowered-gexp-guile lowered)
(lowered-gexp-inputs lowered)))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index ede00133c8..9b5ca68894 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -39,6 +39,7 @@
remote-inferior
remote-daemon-channel
connect-to-remote-daemon
+ remote-system
send-files
retrieve-files
retrieve-files*
@@ -282,6 +283,12 @@ be read. When RECURSIVE? is true, the closure of FILES is exported."
,(object->string
(object->string export))))))
+(define (remote-system session)
+ "Return the system type as expected by Nix, usually ARCHITECTURE-KERNEL, of
+the machine on the other end of SESSION."
+ (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
+ session))
+
(define* (send-files local files remote
#:key
recursive?
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1NunsACgkQ9Qb9Fp2P
2Vo2NRAAqq0C2TeM/rHZzh+4nNS4AfOqqQ2Wp+TiLFaq+PfrCVZuBZycnl5+g8nV
+FH51VUhkmIvOYpJtDJg68uwVP5wgJ1/waTZtBTsZgR0zpp5YHt2JVMxUzzimbx6
O9wvo3RLlDLhKyuvLPPaOCvfopwxyEcJHXNXw70yb60297ZwHFHD6b69uxlIpqWW
aAjk+WE+fIIX7C+EUnXUHAlqrtRoaWO3L3rzpqZLQVJR7LuAzX0yAyT5er4jfEZ7
8THPj3Xrbfm9wgPuCqV83nBX9mJIn39SSyLfWP0/lsK08JEMjXSDiuV4So+UknoK
7rI0MZO0DO0gtq+efDlTYbkde6D5kdEuo/QK13h+imDckoMWk/1pi1Dk5J6zR4YE
qapp/SLFAQ4Svoph1bvOUxo74QIitdufwNCIeu1nTSaiGIg3XeVY3iPMarKJay0W
td0RgHBTUkn/8TxIF4M96D1Vc0bnQzguj9SUvgcMOMUiFoNtkCttv2aJ/05pzDX2
wi2vRMmrpq5BmG6khFjc+21SD1hL4tHAwU2ywR+lIj8iRBvUWHMkZiAzyOsylFDE
o5cBt38y43folUo6nsVOkT2iJCK/ZlkF9TkDfmTG5qj6AfMP3Bn5R/J1SGCdb6YF
S3CdxrBfTkYnqJ/Kh8I/zxXajQMJWzvuUozgB/3LVD6iZILLShY=
=Ksmr
-----END PGP SIGNATURE-----

J
J
Jakob L. Kreuze wrote on 9 Aug 2019 20:25
Re: [bug#36872] [PATCH v2 2/2] remote: Remove '--system' argument.
(name . Thompson, David)(address . dthompson2@worcester.edu)
87y302mc0d.fsf_-_@sdf.lonestar.org
* gnu/services.scm (activation-script): Return a <program-file> rather
than a <scheme-file>.
* gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
(show-help): Remove documentation for '--system'.
(%default-options): Remove default setting for 'system'.
---
gnu/services.scm | 56 ++++++++++++++++++++---------------------
guix/scripts/deploy.scm | 8 ++----
2 files changed, 30 insertions(+), 34 deletions(-)

Toggle diff (101 lines)
diff --git a/gnu/services.scm b/gnu/services.scm
index 7de78105ff..6ee05d4580 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
(define (activation-script gexps)
"Return the system's activation script, which evaluates GEXPS."
(define actions
- (map (cut scheme-file "activate-service" <>) gexps))
-
- (scheme-file "activate"
- (with-imported-modules (source-module-closure
- '((gnu build activation)
- (guix build utils)))
- #~(begin
- (use-modules (gnu build activation)
- (guix build utils))
-
- ;; Make sure the user accounting database exists. If it
- ;; does not exist, 'setutxent' does not create it and
- ;; thus there is no accounting at all.
- (close-port (open-file "/var/run/utmpx" "a0"))
-
- ;; Same for 'wtmp', which is populated by mingetty et
- ;; al.
- (mkdir-p "/var/log")
- (close-port (open-file "/var/log/wtmp" "a0"))
-
- ;; Set up /run/current-system. Among other things this
- ;; sets up locales, which the activation snippets
- ;; executed below may expect.
- (activate-current-system)
-
- ;; Run the services' activation snippets.
- ;; TODO: Use 'load-compiled'.
- (for-each primitive-load '#$actions)))))
+ (map (cut program-file "activate-service.scm" <>) gexps))
+
+ (program-file "activate.scm"
+ (with-imported-modules (source-module-closure
+ '((gnu build activation)
+ (guix build utils)))
+ #~(begin
+ (use-modules (gnu build activation)
+ (guix build utils))
+
+ ;; Make sure the user accounting database exists. If it
+ ;; does not exist, 'setutxent' does not create it and
+ ;; thus there is no accounting at all.
+ (close-port (open-file "/var/run/utmpx" "a0"))
+
+ ;; Same for 'wtmp', which is populated by mingetty et
+ ;; al.
+ (mkdir-p "/var/log")
+ (close-port (open-file "/var/log/wtmp" "a0"))
+
+ ;; Set up /run/current-system. Among other things this
+ ;; sets up locales, which the activation snippets
+ ;; executed below may expect.
+ (activate-current-system)
+
+ ;; Run the services' activation snippets.
+ ;; TODO: Use 'load-compiled'.
+ (for-each primitive-load '#$actions)))))
(define (gexps->activation-gexp gexps)
"Return a gexp that runs the activation script containing GEXPS."
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index ebc99e52cc..81f2b33260 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -43,8 +43,6 @@
(define (show-help)
(display (G_ "Usage: guix deploy [OPTION] FILE...
Perform the deployment specified by FILE.\n"))
- (display (G_ "
- -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(show-build-options-help)
(newline)
(display (G_ "
@@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
%standard-build-options))
(define %default-options
- `((system . ,(%current-system))
- (substitutes? . #t)
+ `((substitutes? . #t)
(build-hook? . #t)
(graft? . #t)
(debug . 0)
@@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
(set-build-options-from-command-line store opts)
(for-each (lambda (machine)
(info (G_ "deploying to ~a...") (machine-display-name machine))
- (parameterize ((%current-system (assq-ref opts 'system))
- (%graft? (assq-ref opts 'graft?)))
+ (parameterize ((%graft? (assq-ref opts 'graft?)))
(run-with-store store (deploy-machine machine))))
machines))))
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1NurMACgkQ9Qb9Fp2P
2VqwcRAAqRKmTRpyD1pRRGyHhZD4XUB/vGJJ7n4GbE4/4HSOZEp5Hmynj8De9a5K
4fY1htECNrwhGiJ7Qn565IRZ6EsU0jr01QBRj2jq9zeGfbwESoS6Dk5+5+BnbnT8
rXa42OGCaLdDhth1e+o6y/kN6P0FSrDkyX0Q0dB8u/MSzRilDWyXeaC52ZPJ+ZkV
JdQyscxYI+xN4ilz5jDm/dpROgTnZN96lyajfzDjhMLssjJ4ZLhooZY7jBIg/JQK
Xs7CTtH+M6s9h1OQ0y7LbBKw4JEOyNqPi9AAG7dP1fj/1g+UJKUxzmIVRTsXsgrC
ixHT/iU4tGRTe0ewaTvgzIEKykZfvajyLJmazgzBd0xfAtZv0irNV8C+JlQYeXMR
yDOurpfsokz0sKZCFp6b3YtufdsxkZvLrE1zluPMFku7n2wNCJc9t/AHVgeo7VdG
y+126dVYJ5VB4N9d9Hq2m69IXDAqZa59b8WG7UKuVptZvm23j4qesPus/W/dyY+D
GoZj/T2f9QvTruXsK28D8e2jefXLLB+ZZE/Y4+1IZ2Rke3Wgi1VtrLWgsKT8T1Kj
v4Xo09Wlv18rkD8CKtNPra8Ln9oajXoizsBI3bx0qghgQK9bV3oQm3XZDn4JAdNk
AaNggFbkGytj7weiRBCl0UGOW6DW0SjjLdRg8VTws3+Y5dxwJrM=
=UbYc
-----END PGP SIGNATURE-----

C
C
Christopher Lemmer Webber wrote on 14 Aug 2019 21:40
(name . Jakob L. Kreuze)(address . zerodaysfordays@sdf.lonestar.org)
87sgq3y1qi.fsf@dustycloud.org
Looks good. Merged & pushed!

Jakob L. Kreuze writes:

Toggle quote (109 lines)
> * gnu/services.scm (activation-script): Return a <program-file> rather
> than a <scheme-file>.
> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
> (show-help): Remove documentation for '--system'.
> (%default-options): Remove default setting for 'system'.
> ---
> gnu/services.scm | 56 ++++++++++++++++++++---------------------
> guix/scripts/deploy.scm | 8 ++----
> 2 files changed, 30 insertions(+), 34 deletions(-)
>
> diff --git a/gnu/services.scm b/gnu/services.scm
> index 7de78105ff..6ee05d4580 100644
> --- a/gnu/services.scm
> +++ b/gnu/services.scm
> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
> (define (activation-script gexps)
> "Return the system's activation script, which evaluates GEXPS."
> (define actions
> - (map (cut scheme-file "activate-service" <>) gexps))
> -
> - (scheme-file "activate"
> - (with-imported-modules (source-module-closure
> - '((gnu build activation)
> - (guix build utils)))
> - #~(begin
> - (use-modules (gnu build activation)
> - (guix build utils))
> -
> - ;; Make sure the user accounting database exists. If it
> - ;; does not exist, 'setutxent' does not create it and
> - ;; thus there is no accounting at all.
> - (close-port (open-file "/var/run/utmpx" "a0"))
> -
> - ;; Same for 'wtmp', which is populated by mingetty et
> - ;; al.
> - (mkdir-p "/var/log")
> - (close-port (open-file "/var/log/wtmp" "a0"))
> -
> - ;; Set up /run/current-system. Among other things this
> - ;; sets up locales, which the activation snippets
> - ;; executed below may expect.
> - (activate-current-system)
> -
> - ;; Run the services' activation snippets.
> - ;; TODO: Use 'load-compiled'.
> - (for-each primitive-load '#$actions)))))
> + (map (cut program-file "activate-service.scm" <>) gexps))
> +
> + (program-file "activate.scm"
> + (with-imported-modules (source-module-closure
> + '((gnu build activation)
> + (guix build utils)))
> + #~(begin
> + (use-modules (gnu build activation)
> + (guix build utils))
> +
> + ;; Make sure the user accounting database exists. If it
> + ;; does not exist, 'setutxent' does not create it and
> + ;; thus there is no accounting at all.
> + (close-port (open-file "/var/run/utmpx" "a0"))
> +
> + ;; Same for 'wtmp', which is populated by mingetty et
> + ;; al.
> + (mkdir-p "/var/log")
> + (close-port (open-file "/var/log/wtmp" "a0"))
> +
> + ;; Set up /run/current-system. Among other things this
> + ;; sets up locales, which the activation snippets
> + ;; executed below may expect.
> + (activate-current-system)
> +
> + ;; Run the services' activation snippets.
> + ;; TODO: Use 'load-compiled'.
> + (for-each primitive-load '#$actions)))))
>
> (define (gexps->activation-gexp gexps)
> "Return a gexp that runs the activation script containing GEXPS."
> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
> index ebc99e52cc..81f2b33260 100644
> --- a/guix/scripts/deploy.scm
> +++ b/guix/scripts/deploy.scm
> @@ -43,8 +43,6 @@
> (define (show-help)
> (display (G_ "Usage: guix deploy [OPTION] FILE...
> Perform the deployment specified by FILE.\n"))
> - (display (G_ "
> - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
> (show-build-options-help)
> (newline)
> (display (G_ "
> @@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
> %standard-build-options))
>
> (define %default-options
> - `((system . ,(%current-system))
> - (substitutes? . #t)
> + `((substitutes? . #t)
> (build-hook? . #t)
> (graft? . #t)
> (debug . 0)
> @@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
> (set-build-options-from-command-line store opts)
> (for-each (lambda (machine)
> (info (G_ "deploying to ~a...") (machine-display-name machine))
> - (parameterize ((%current-system (assq-ref opts 'system))
> - (%graft? (assq-ref opts 'graft?)))
> + (parameterize ((%graft? (assq-ref opts 'graft?)))
> (run-with-store store (deploy-machine machine))))
> machines))))
C
C
Christopher Lemmer Webber wrote on 14 Aug 2019 22:29
(name . Jakob L. Kreuze)(address . zerodaysfordays@sdf.lonestar.org)
87r25nxzgi.fsf@dustycloud.org
Forgot to signal -done :)

Christopher Lemmer Webber writes:

Toggle quote (113 lines)
> Looks good. Merged & pushed!
>
> Jakob L. Kreuze writes:
>
>> * gnu/services.scm (activation-script): Return a <program-file> rather
>> than a <scheme-file>.
>> * gnu/deploy.scm (guix-deploy): Remove handling for '--system'.
>> (show-help): Remove documentation for '--system'.
>> (%default-options): Remove default setting for 'system'.
>> ---
>> gnu/services.scm | 56 ++++++++++++++++++++---------------------
>> guix/scripts/deploy.scm | 8 ++----
>> 2 files changed, 30 insertions(+), 34 deletions(-)
>>
>> diff --git a/gnu/services.scm b/gnu/services.scm
>> index 7de78105ff..6ee05d4580 100644
>> --- a/gnu/services.scm
>> +++ b/gnu/services.scm
>> @@ -430,34 +430,34 @@ ACTIVATION-SCRIPT-TYPE."
>> (define (activation-script gexps)
>> "Return the system's activation script, which evaluates GEXPS."
>> (define actions
>> - (map (cut scheme-file "activate-service" <>) gexps))
>> -
>> - (scheme-file "activate"
>> - (with-imported-modules (source-module-closure
>> - '((gnu build activation)
>> - (guix build utils)))
>> - #~(begin
>> - (use-modules (gnu build activation)
>> - (guix build utils))
>> -
>> - ;; Make sure the user accounting database exists. If it
>> - ;; does not exist, 'setutxent' does not create it and
>> - ;; thus there is no accounting at all.
>> - (close-port (open-file "/var/run/utmpx" "a0"))
>> -
>> - ;; Same for 'wtmp', which is populated by mingetty et
>> - ;; al.
>> - (mkdir-p "/var/log")
>> - (close-port (open-file "/var/log/wtmp" "a0"))
>> -
>> - ;; Set up /run/current-system. Among other things this
>> - ;; sets up locales, which the activation snippets
>> - ;; executed below may expect.
>> - (activate-current-system)
>> -
>> - ;; Run the services' activation snippets.
>> - ;; TODO: Use 'load-compiled'.
>> - (for-each primitive-load '#$actions)))))
>> + (map (cut program-file "activate-service.scm" <>) gexps))
>> +
>> + (program-file "activate.scm"
>> + (with-imported-modules (source-module-closure
>> + '((gnu build activation)
>> + (guix build utils)))
>> + #~(begin
>> + (use-modules (gnu build activation)
>> + (guix build utils))
>> +
>> + ;; Make sure the user accounting database exists. If it
>> + ;; does not exist, 'setutxent' does not create it and
>> + ;; thus there is no accounting at all.
>> + (close-port (open-file "/var/run/utmpx" "a0"))
>> +
>> + ;; Same for 'wtmp', which is populated by mingetty et
>> + ;; al.
>> + (mkdir-p "/var/log")
>> + (close-port (open-file "/var/log/wtmp" "a0"))
>> +
>> + ;; Set up /run/current-system. Among other things this
>> + ;; sets up locales, which the activation snippets
>> + ;; executed below may expect.
>> + (activate-current-system)
>> +
>> + ;; Run the services' activation snippets.
>> + ;; TODO: Use 'load-compiled'.
>> + (for-each primitive-load '#$actions)))))
>>
>> (define (gexps->activation-gexp gexps)
>> "Return a gexp that runs the activation script containing GEXPS."
>> diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
>> index ebc99e52cc..81f2b33260 100644
>> --- a/guix/scripts/deploy.scm
>> +++ b/guix/scripts/deploy.scm
>> @@ -43,8 +43,6 @@
>> (define (show-help)
>> (display (G_ "Usage: guix deploy [OPTION] FILE...
>> Perform the deployment specified by FILE.\n"))
>> - (display (G_ "
>> - -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
>> (show-build-options-help)
>> (newline)
>> (display (G_ "
>> @@ -66,8 +64,7 @@ Perform the deployment specified by FILE.\n"))
>> %standard-build-options))
>>
>> (define %default-options
>> - `((system . ,(%current-system))
>> - (substitutes? . #t)
>> + `((substitutes? . #t)
>> (build-hook? . #t)
>> (graft? . #t)
>> (debug . 0)
>> @@ -92,7 +89,6 @@ Perform the deployment specified by FILE.\n"))
>> (set-build-options-from-command-line store opts)
>> (for-each (lambda (machine)
>> (info (G_ "deploying to ~a...") (machine-display-name machine))
>> - (parameterize ((%current-system (assq-ref opts 'system))
>> - (%graft? (assq-ref opts 'graft?)))
>> + (parameterize ((%graft? (assq-ref opts 'graft?)))
>> (run-with-store store (deploy-machine machine))))
>> machines))))
Closed
?