Subject: [bug#42193] [WIP 2/6] services: Add 'kernel-profile-service-type'.

From: "pelzflorian (Florian Pelz)" <[email-masked]>
Date: Sat, 11 Jul 2020 19:30:08 +0200

On Wed, Jul 08, 2020 at 04:22:06PM +0000, Brice Waegeneire wrote:
> > After I apply this kernel profile patch, I get an error:
> > 
> > florian@florianmacbook ~/git/guix [env]$ ./pre-inst-env guix system
> > disk-image --file-system-type=iso9660        gnu/system/install.scm
> > […]
> > failed with exit code 1
> > […]
> > In procedure symlink: File exists
> > 
> > 
> > I have no idea where this comes from but I hope you can reproduce the
> > error.
> 
> Unfortunately I can't, it build successfully for me when applied on top of
> 6f3ede9ae2b2268181ebc0ca3764d865bd06bd63.  You probably just need to clean
> your Guix repository and rebuild it from scratch

I still have the error after pulling current guix (commit f2dce740b2)
and applying your patch.

florian@florianmacbook ~/.config/guix/current/share/guile/site/3.0$ guix system disk-image --file-system-type=iso9660 gnu/system/install.scm
[…]
build of /gnu/store/v9jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv failed
View build log at '/var/log/guix/drvs/v9/jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv.bz2'.

Indeed /gnu/store/v9jzdiykyz1rdb1an7jpsfhnnkvx21mq-system.drv contains

Derive([("out","/gnu/store/xzavg5awkmbcx556f3a0h329w5ninhyk-system","","")],[("/gnu/store/28zlas3x4ry6q88fgq625ixh40igjws5-guile-3.0.2.drv",["out"]),("/gnu/store/32yj3cnz8rjipd6lw27d08rb272rcmbp-boot.drv",["out"]),("/gnu/store/6iwq8qmqpf9sy84jvbbsd6lwwb05rvlf-etc.drv",["out"]),("/gnu/store/8rfp2v0vz8w72621qsr0mr21zgr5f062-profile.drv",["out"]),("/gnu/store/92sqsa639hl3ixy6ryys38xha7mgkyb0-profile.drv",["out"]),("/gnu/store/ca0g4jfdqx4fhsp67jr2ra17sdwajczc-parameters.drv",["out"]),("/gnu/store/fi6hy331yp7pn03zhlxavdd4d9kv6l6i-raw-initrd.drv",["out"]),("/gnu/store/i3fx8c0k6yna92cf9h7r57amdjzii7l3-locale-multiple-versions.drv",["out"]),("/gnu/store/zcz3jhx84q3zmz37wddwlfk2w3rnn5fc-module-import-compiled.drv",["out"])],["/gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-builder","/gnu/store/xv5ylv9hxvs1wraw375b5g9jwy57vs8p-module-import"],"x86_64-linux","/gnu/store/0m0vd873jp61lcm4xa3ljdgx381qa782-guile-3.0.2/bin/guile",["--no-auto-compile","-L","/gnu/store/xv5ylv9hxvs1wraw375b5g9jwy57vs8p-module-import","-C","/gnu/store/08da6i38fzn9g36gyq443k03f84nk8rk-module-import-compiled","/gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-builder"],[("out","/gnu/store/xzavg5awkmbcx556f3a0h329w5ninhyk-system"),("preferLocalBuild","1")])

and /gnu/store/ah60schb9jlzx12jzi6v872q3j099afi-system-builder
contains (with indentation added by me):

(begin (use-modules (guix build utils))
       (mkdir ((@ (guile) getenv) "out"))
       (chdir ((@ (guile) getenv) "out"))
       (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile")
              (mkdir-p (dirname "kernel"))
              (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel"))
       (begin (stat "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters")
              (mkdir-p (dirname "parameters"))
              (symlink "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters" "parameters"))
       (begin (stat "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz")
              (mkdir-p (dirname "initrd"))
              (symlink "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz" "initrd"))
       (begin (stat "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions")
              (mkdir-p (dirname "locale"))
              (symlink "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions" "locale"))
       (begin (stat "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile")
              (mkdir-p (dirname "profile"))
              (symlink "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile" "profile"))
       (begin (stat "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc")
              (mkdir-p (dirname "etc"))
              (symlink "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc" "etc"))
       (begin (stat "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot")
              (mkdir-p (dirname "boot"))
              (symlink "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot" "boot"))
       (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile")
              (mkdir-p (dirname "kernel"))
              (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")))

Without your patch I get a
/gnu/store/c74g6pazpx9z5c1jkfi4rn8h42lf36dy-system-builder with only
one "kernel":

(begin (use-modules (guix build utils))
       (mkdir ((@ (guile) getenv) "out"))
       (chdir ((@ (guile) getenv) "out"))
       (begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile")
              (mkdir-p (dirname "kernel"))
              (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel"))
       (begin (stat "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters")
              (mkdir-p (dirname "parameters"))
              (symlink "/gnu/store/7wjapypmzz4n93rwrnrrqwalwg8hhh3h-parameters" "parameters"))
       (begin (stat "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz")
              (mkdir-p (dirname "initrd"))
              (symlink "/gnu/store/j27l3k8zjg9gn9j04y90gsjrqsryjapw-raw-initrd/initrd.cpio.gz" "initrd"))
       (begin (stat "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions")
              (mkdir-p (dirname "locale"))
              (symlink "/gnu/store/bhnyk7bpzlzna28njkx21dd3940m1m4a-locale-multiple-versions" "locale"))
       (begin (stat "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile")
              (mkdir-p (dirname "profile"))
              (symlink "/gnu/store/24irabcnv3pn2mpx4cjrggmlvn30k053-profile" "profile"))
       (begin (stat "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc")
              (mkdir-p (dirname "etc"))
              (symlink "/gnu/store/z9jm8d8rrrpq19y1pmahpp73ja5ydw6h-etc" "etc"))
       (begin (stat "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot")
              (mkdir-p (dirname "boot"))
              (symlink "/gnu/store/w90vvv7mx8g17i6frd34yvmbfi0nhnl1-boot" "boot")))

The diff is only the three lines at the bottom

(begin (stat "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile")
       (mkdir-p (dirname "kernel"))
       (symlink "/gnu/store/x22lj7pv64cg58dlwsg1q1srqawjbahi-profile" "kernel")))

Regards,
Florian