.PHONY: system-reconfigure system-vm system-container system-build pull home-reconfigure home-vm home-container home-build
SYSTEM_ARGS = -L ./modules ./config.scm
HOME_ARGS = -L ./home/modules ./home/home-configuration.scm
TIMEMACHINE = guix time-machine -C channels-lock.scm
GUIX=target/guix/bin/guix
target: channels-lock.scm channels-profile.scm channels-manifest.scm
rm -rf target
mkdir -p target
guix build \
-f ./channels-profile.scm \
-r ./target/guix
pull: channels-lock.scm channels-manifest.scm target
# 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 package --profile='~/.config/guix/current' \
--manifest=./channels-manifest.scm
system-build: channels-lock.scm target
$(GUIX) system build $(SYSTEM_ARGS)
system-reconfigure: channels-lock.scm target
$(GUIX) system reconfigure $(SYSTEM_ARGS) --cores=10 --max-jobs=5
system-vm: channels-lock.scm target
$(GUIX) system vm $(SYSTEM_ARGS)
system-container: channels-lock.scm target
$(GUIX) system container $(SYSTEM_ARGS)
home-build: channels-lock.scm target
$(GUIX) home build $(HOME_ARGS)
home-reconfigure: channels-lock.scm target
$(GUIX) home reconfigure $(HOME_ARGS) --cores=10 --max-jobs=5
home-container: channels-lock.scm target
$(GUIX) home container $(HOME_ARGS)
system-repl: channels-lock.scm target
$(GUIX) repl -L modules -i ./repl-init.scm
channels-lock.scm: channels.scm
guix time-machine -C channels.scm -- describe -f channels > channels-lock.scm