Do I have to do a guix pull and guix system reconfigure to add a user? I get a "wrong type to apply" error

Very new here to Guix.

I’m trying to add a user to a clean OS

through creating a config.scm, putting it in /etc/

and then running guix system reconfigure /etc/config.scm

;; This is an operating system configuration template
;; for a minimal setup

(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules screen ssh)


(operating-system
  (host-name "bib-baz")
  (timezone "Europe/Brussels")
  (locale "fr_BE.utf8")

  ;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
  ;; target hard disk, and "my-root" is the label of the target
  ;; root file system.
  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (targets '("/dev/srX"))))
  ;; It's fitting to support the equally bare bones ‘-nographic’
  ;; QEMU option, which also nicely sidesteps forcing QWERTY.
  (kernel-arguments (list "console=ttyS0,115200"))
  (file-systems (cons (file-system
                        (device (file-system-label "GUIX_X86_64-LINUX_1.4.0"))
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))
  
  (users (cons (user-account
                (name "baz")
                (comment "uzaz")
                (group "users")
                (supplementary-groups '("wheel" "netdev")))
               %base-user-accounts))

  ;; Adding base packages
  (packages (append (%base-packages)))

  ;; SSH
  (services (append (list (service dhcpcd-service-type)
                          (service openssh-service-type
                                   (openssh-configuration
                                     (openssh openssh-sans-x)
                                     (port-number 22))))
                          (service loadkeys-service-type "dvorak")
                    %base-services))
)

But I get a failed to load ‘/etc/config.scm' error on /etc/config.scm37:20 Wrong type to apply plus a whole bunch of packages.

What’s going on?

If you change something on the system configuration, you need to rerun guix system reconfigure. A guix pull actualizes the Guix package manager and is not required if you don’t change the system in a way that isn’t dependent on a new Guix feature.

/etc/system.scm isn’t the best location as it’s more user data of the administrator and /etc is part of the system that gets build.

What is at /etc/config.scm37:20 and please post the complete error message.

root@gnu /etc# guix system reconfigure /etc/config.scm
guix system: error: failed to load '/etc/.config.scm':
/etc/config.scm:37:20: Wrong type to apply: (#<package guix-icons@0.1 gnu-packages-package-management.scm:642 ?feeac829798> #<package less@590 gnu-packages-less
.scn:37 7feeb?23d0b0> #<package mg@20221112 gnupackages.text-editors.scn:497 7eeacBOBB0> #i<package nano@?.0 gnupackages.mano.scm:32 feebde2de?d> #i<package
nviB1.81.6 gnu packages/mui.scn:32 feeach31dcd> #i<package man-db@2.10.2 gnupackages-man.scm:128 7feeacd6aBf> #i<package info-reader@6.? gnuspackages texinfo.s
cn:173 7feeacd52630> #i<package bash-completionB2.8 gnu-packages bash.scm:292 feeacadfd1> #<package kbd@2.5.1 gnuspackages.linux.scm:3641 ?feeacdf79ad> H<packa
ge sudo@1.9.12p1 gnupackages-adnin.scn:1967 ?feeacab6370> #i<package guile-readline@3.0.? gnuspackages guile.scm:474 7feeac?18c60> #i<package guile-colorizeddd. ]
gnuspackages/guile-xyz.scn:953 7feeaedf76e0> #ipackage peiutils@3.?.0 gnuspackages peiutils.scniB1 ?feebd3abbdd> #<package usbutils@di4 gnupackages,linux.scn:
2146 7feeacdf0630> #<package util-linux-uith-udevdZ.37.2 gnuspackages,linux.scn:2000 7feeacdfBaS0> #<package knod@29 gnupackages-linux.scm:3768 ?feeacdf7790>
<package eudevd3.2.11 gnuspackages-linux.scn:3878 ?feeacdf7630> H<package inetutils@2.0 gnu packages adnin.scn:895 ?feeacab3z10> #i<package isc-dhcp@4.4.3 gnu/pa
ckages-adnin.scn:1410 7feeacabaS0> #i<package iproutez@5.15.0 gnu packages.linux.scn:2815 7feeacdf38£0> #<package uget@1.21.3 gnupackages uget.scn:4? 7feeaesd
160> #i<package iwB5.19 gnu-packages/linux.scn:3121 7feeacdf3420> #<package wireless—tools@30.pred gnuspackages/Linux.scni4244 feeacof70b0> fi<package procps@3.
.16 gnupackages-Linux.scn:2100 7feeac9f06ed> #<package psmisc@23.5 gnuspackageslinux.scn:1824 7feeacdfObb> #<package which@2.21 gnu packages base.scn:1304 74
eeachzedbd> #i<package shadou@4.9 gnupackages-adnin.scn:1031 ?feeacab30bd> #ipackage e2fsprogs@l.46.4 gnu packages.linux.scn:2220 7feeacdf04d0> #<package guilet
3.0.8 gnu packages guile.scn:392 7feeac?18e70> #i<package bash@5.1.8 gnupackages-bash.scn:124 ?feeacaBfb0> #i<package coreutilsd8.32 gnu-packages base.scm:358 7
feeach1?8f0> #<package findutils@4.8.0 gnu packages base.scn:320 7feeachi?9ab> #i<package grepd3.6 gnu-packages base.scn:107 7feeach1?d10> #ipackage sed@4.8 gnu.
packages-base.scn:162 ?feeach1?c60> H<package diffutils@3.8 gnu packagesbase.scni292 7feeach1?a50> #i<package patch@2.?.6 gnupackages-base.scn:262 7feeachl7bol
> #i<package gawk5.1.0 gnuspackages gauk.scm:39 7feeacdbafz0> H<package tar@1.34 gnu packagesbase.scn:203 7feeach1?bb> #<package yzip@l.10 gnu-packages-compre
ssion.scn:249 feeacaB4e?d> #i<package bzip2@1.0.8 gnupackages-compression.scn:301 ?feeacaB4dcd> #<package xz85.2.5 gnu/packages conpression.scni509 7feeaca4bl
8> #<package lzipPl.2Z gnu-packages-compression.scm:640 7feeacaB48f@>)

Line 37

(packages (append (%base-packages)))

So it has nothing to do with the user.

You can’t append only one list, it requires two or more.
Try only (packages %base-packages).

1 Like

I think you should use the following format for packages in your os: for example

  (packages (append (list
                     ;; window managers
                     emacs emacs-exwm emacs-desktop-environment
                     ;; terminal emulator
                     xterm)
                    %base-packages))
```

Otherwise, you do not need (append).