local/bin/homeinit: Install more Guix profiles, including laptop profiles.

master
Pierre Neidhardt 2020-06-11 12:39:35 +02:00
parent d823e88826
commit 575cd8f538
1 changed files with 35 additions and 9 deletions

View File

@ -130,6 +130,10 @@ has_gpg_keys() {
[ -n "$(ls -1 ~/.gnupg/private-*)" ]
}
is_laptop() {
[ -n "$(ls -1 /sys/class/power_supply/)" ]
}
if ! has_gpg_keys; then
section "GPG sync"
if [ -n "$OPT_DEVICE" ]; then
@ -205,10 +209,26 @@ pushd ~/dotfiles
stow -v . || exit 1
popd
guix_install_profile() {
local profile
local manifest
manifest=$HOME/.package-lists/guix-$i-manifest.scm
if [ -f "$manifest"]; then
warning "Manifest $manifest not found."
else
profile=$HOME/.guix-extra-profiles/$i/$i
mkdir -p $(dirname "$profile")
~/.config/guix/current/bin/guix package --manifest=$HOME/.package-lists/guix-$i-manifest.scm --keep-failed --profile="$profile" --substitute-urls="$SUBSTITUTE_URLS"
if [ -f "$profile"/etc/profile ]; then
. "$profile"/etc/profile
fi
fi
}
section "System packages"
if inpath guix; then
if [ ! -e ~/.cache/guix ]; then
message "First Guix pull"
message "First 'guix pull'"
guix pull --substitute-urls="$SUBSTITUTE_URLS"
hash guix
fi
@ -216,15 +236,21 @@ if inpath guix; then
~/.config/guix/current/bin/guix package --manifest=$HOME/.package-lists/guix-default-manifest.scm --keep-failed --substitute-urls="$SUBSTITUTE_URLS"
. ~/.guix-profile/etc/profile
for i in main emacs texlive; do
profile=$HOME/.guix-extra-profiles/$i/$i
mkdir -p $(dirname "$profile")
~/.config/guix/current/bin/guix package --manifest=$HOME/.package-lists/guix-$i-manifest.scm --keep-failed --profile="$profile" --substitute-urls="$SUBSTITUTE_URLS"
if [ -f "$profile"/etc/profile ]; then
. "$profile"/etc/profile
fi
unset profile
for i in main emacs next texlive; do
guix_install_profile "$i"
done
if $is_laptop; then
guix_install_profile laptop laptop-gaming
else
guix_install_profile gaming
fi
if $OPT_UPDATE; then
for i in blender chromium electrum racket; do
guix_install_profile "$i"
done
fi
else
warning "Package manager not supported. Install Guix."
fi
if inpath emacs; then