~ruther/guix-config

7e4a8470bef8649e8a803f073b89c17d5cdcb45f — Rutherther 5 months ago d9ade33
feat: move to more robust solution than time-machine

The problem with time-machine is that the guix
derivation might need to be recomputed and rebuilt.
This can happen because the underlying guix version used
to build it can differ. The solution to this can be
to keep the resulting guix in a folder, and use it out of
that folder, instead of recomputing it every time.

This can still mean that there will be need for
duplicit recomputation between building the guix
and pulling it into user profile. I don't know what
a good solution to this is, yet.
5 files changed, 59 insertions(+), 17 deletions(-)

A .gitignore
M Makefile
A channels-manifest.scm
A channels-profile.scm
M home/home-configuration.scm
A .gitignore => .gitignore +1 -0
@@ 0,0 1,1 @@
target
\ No newline at end of file

M Makefile => Makefile +34 -17
@@ 4,29 4,46 @@ SYSTEM_ARGS = -L ./modules ./config.scm
HOME_ARGS = -L ./home/modules ./home/home-configuration.scm
TIMEMACHINE = guix time-machine -C channels-lock.scm

system-build: channels-lock.scm
	$(TIMEMACHINE) -- system build $(SYSTEM_ARGS)
GUIX=target/guix/bin/guix

system-reconfigure: channels-lock.scm
	$(TIMEMACHINE) -- system reconfigure $(SYSTEM_ARGS)
target/guix: channels-lock.scm channels-profile.scm channels-manifest.scm
	mkdir -p target
	rm -rf ./target/guix
	guix build \
    -f ./channels-profile.scm \
		-r ./target/guix

system-vm: channels-lock.scm
	$(TIMEMACHINE) -- system vm $(SYSTEM_ARGS)
pull: channels-lock.scm channels-manifest.scm target/guix
  # TODO: investigate what guix version to use here.
  # How to ensure it is not built twice unnecessarily?
  # The problem is that guix-for-channels actually produces
  # a different derivation if we are in different current guix.
  # Maybe it would make sense to have sort of a bootstrap guix
  # built that will not be updated so regularly, and be used
  # only to obtain the guix instances?
	guix install --profile='~/.config/guix/current' \
    --manifest=./channels-manifest.scm

system-container: channels-lock.scm
	$(TIMEMACHINE) -- system container $(SYSTEM_ARGS)
system-build: channels-lock.scm target/guix
	$(GUIX) system build $(SYSTEM_ARGS)

home-build: channels-lock.scm
	$(TIMEMACHINE) -- home build $(HOME_ARGS)
system-reconfigure: channels-lock.scm target/guix
	$(GUIX) system reconfigure $(SYSTEM_ARGS) --cores=10 --max-jobs=5

home-reconfigure: channels-lock.scm
	$(TIMEMACHINE) -- home reconfigure $(HOME_ARGS)
system-vm: channels-lock.scm target/guix
	$(GUIX) system vm $(SYSTEM_ARGS)

home-container: channels-lock.scm
	$(TIMEMACHINE) -- home container $(HOME_ARGS)
system-container: channels-lock.scm target/guix
	$(GUIX) system container $(SYSTEM_ARGS)

home-build: channels-lock.scm target/guix
	$(GUIX) home build $(HOME_ARGS)

home-reconfigure: channels-lock.scm target/guix
	$(GUIX) home reconfigure $(HOME_ARGS) --cores=10 --max-jobs=5

home-container: channels-lock.scm target/guix
	$(GUIX) home container $(HOME_ARGS)

channels-lock.scm: channels.scm
	guix time-machine -C channels.scm -- describe -f channels > channels-lock.scm

pull: channels-lock.scm
	guix pull -C channels-lock.scm

A channels-manifest.scm => channels-manifest.scm +11 -0
@@ 0,0 1,11 @@
(use-modules
 (guix ui)
 (gnu packages package-management))

(define (load-channels file)
  (load* file (make-user-module '((guix channels)))))

(packages->manifest
 (list
  (guix-for-channels
   (load-channels "./channels-lock.scm"))))

A channels-profile.scm => channels-profile.scm +7 -0
@@ 0,0 1,7 @@
(use-modules
 (guix ui)
 (guix profiles))

(profile
 (content
  (load "./channels-manifest.scm")))

M home/home-configuration.scm => home/home-configuration.scm +6 -0
@@ 4,10 4,16 @@
;; need to capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

;; TODO: ~/.msmtpd, ~/.offlineimaprc, ~/.offlineimap.py, ~/.notmuch-config, ~/.notmuch/post-new
;;       ~/.emacs.d/lisp/custom-packages.el
;; from_full_name =?utf-8?B?RnJhbnRpxaFlayBCb2jDocSNZWs=?=

(use-modules (guix packages)
             (guix gexp)
             (guix transformations)
             (gnu home)
             (gnu packages)
             (gnu packages librewolf)
             (gnu packages gnupg)
             (gnu packages base)
             (gnu packages emacs)

Do not follow this link