unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: jankremser via <help-guix@gnu.org>
To: "help-guix@gnu.org" <help-guix@gnu.org>
Subject: Issue with local-file
Date: Sun, 05 Jan 2025 04:26:52 +0000	[thread overview]
Message-ID: <3_nwJZghadEmw9C6P8Y2WnICGAVad_sv2T9JYcacRTKOf14656HsHvM4qfc77E-s3wQHNFzWBhkfOGNTDca8Xf4y6FjKwHGjVhRwpkCBuuo=@proton.me> (raw)

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]$

             reply	other threads:[~2025-01-05 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05  4:26 jankremser via [this message]
2025-01-05  4:35 ` Issue with local-file jankremser via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='3_nwJZghadEmw9C6P8Y2WnICGAVad_sv2T9JYcacRTKOf14656HsHvM4qfc77E-s3wQHNFzWBhkfOGNTDca8Xf4y6FjKwHGjVhRwpkCBuuo=@proton.me' \
    --to=help-guix@gnu.org \
    --cc=jankremser@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).