unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Issue with local-file
@ 2025-01-05  4:26 jankremser via
  2025-01-05  4:35 ` jankremser via
  0 siblings, 1 reply; 2+ messages in thread
From: jankremser via @ 2025-01-05  4:26 UTC (permalink / raw)
  To: help-guix@gnu.org

Hello everyone. I am trying yo reference some local files in my guix configuartion, but I am running into some isses. Bellow I will past my configuration and the error I see when I run the build command. The code:
;;; base.scm --- Base Guix config inheriting from the official installer
;;;
;;; Defines a module named (machines base). It exports the variable
;;; `base-os`, which is an operating-system record built on top of
;;; `installation-os`. We allow SSH (with pubkey) on root, and run DHCP for
;;; networking.

(define-module (machines base)
;; Import modules providing 'operating-system', 'installation-os', etc.
#:use-module (gnu system install) ; for installation-os
#:use-module (gnu system file-systems) ; for installation-os
#:use-module (gnu system) ; for operating-system, %base-user-accounts
#:use-module (gnu system accounts) ; for operating-system, %base-user-accounts
#:use-module (gnu services) ; base services
#:use-module (gnu services ssh)
#:use-module (gnu services networking) ; for dhcp-client-service-type
#:use-module (guix gexp) ; for installation-os
#:export (base-os))

(define %base-dir
;; The directory where *this* file (base.scm) lives.
(dirname (current-filename)))

;; 1) Define a base OS that *inherits* 'installation-os' (the default Guix
;; live installer environment).
;; 2) Override the 'services' field to provide:
;; - a DHCP client (instead of 'networking-service-type')
;; - an SSH service that allows root login via pubkey only
;; 3) Override the 'users' field so 'root' has a public key.

(define base-os
(operating-system
(inherit installation-os)

;; Basic identity
(host-name "base-installer")
(timezone "UTC")
(locale "en_US.utf8")

(file-system
(device (local-file "./keys/install-key")) ; Danger: private key in store
(mount-point "/root/.ssh/id_rsa")
(type "none")
(flags '(bind-mount)))

;; (file-systems
;; (append
;; (list
;; (file-system
;; (mount-point "/root/.ssh/authorized_keys")
;; (device (local-file "./keys/install-key.pub"))
;; (type "none")
;; (flags '(bind-mount))))
;; (operating-system-file-systems installation-os)))

;; The 'services' field: we append a DHCP service & a custom SSH config
(services
(append
(list
;; Networking: use a DHCP client on all interfaces
(service dhcp-client-service-type
(dhcp-client-configuration
(interfaces '("eno1")))) ; or '("eno1") for a specific interface

;; SSH service: root login by key only
(service openssh-service-type
(openssh-configuration
(permit-root-login 'without-password) ; No password logins
(password-authentication? #false)))
;; (authorized-keys
;; `(("root" ,(local-file "./keys/install-key.pub")))))) ; disable password-based auth

;; Keep everything else from the standard Guix installation-os
(operating-system-services installation-os))))))

;; Finally, just reference 'base-os' at the top level so Guix sees it as
;; the OS to build or reconfigure.
base-os
======== The terminal interaction =========================
[jan@bunker:/dna/@repo/installation-isos-guix]$ ls
machines manifest.scm manifest.scm~

[jan@bunker:/dna/@repo/installation-isos-guix]$ ls machines/
base.scm base.scm~ common.scm~ keys

[jan@bunker:/dna/@repo/installation-isos-guix]$ ls machines/keys/
install-key install-key.pub

[jan@bunker:/dna/@repo/installation-isos-guix]$ ~/.config/guix/current/bin/guix system image -t iso9660 -L . machines/base.scm
machines/base.scm:41:4: error: (file-system (device (local-file "./keys/install-key")) (mount-point "/root/.ssh/id_rsa") (type "none") (flags (quote (bind-mount)))): invalid field specifier
[jan@bunker:/dna/@repo/installation-isos-guix]$

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-05 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-05  4:26 Issue with local-file jankremser via
2025-01-05  4:35 ` jankremser via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).