Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

zimoun/my-conf

Repository files navigation

Debian

apt install aptitude emacs-nox
emacs /etc/apt/sources.list # <name> -> stable + contrib non-free
aptitude update
aptitude install intel-microcode firmware-iwlwifi
aptitude install awesome xfce4-power-manager xscreensaver xterm
aptitude install vlc transmission-gtk pavucontrol blueman
aptitude install network-manager-openvpn
dpkg-reconfigure tzdata

Be careful, the battery icon could be turned off, see xfce4-power-manager-settings.

Guix

As root

  1. Binary install
    wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
    bash guix-install.sh
        

    Do not forget to add the gpg key as hinted by the helper script.

  2. Update (could be long)
    guix pull
        
  3. Install the locales used for the daemon
    guix install glibc-locales
        
  4. Do not forget to restart the daemon:
    systemctl restart guix-daemon.service
        

    and see the configuration file /etc/systemd/system/guix-daemon.service.

As regular user

  1. Update
    guix pull
    hash guix
        

    Now ~/.config/guix/current should be created.

  2. Clone the configuration files
    guix shell git nss-certs -- \
         git clone https://github.com/zimoun/my-conf.git
        

    Usually in ~/src/.

  3. Populate the profiles
    1. Create the folder and track the origin
GUIX=~/.config/guix/current/bin/guix
GUIX_MYPROFILES=~/.config/guix/profiles

mkdir -p $GUIX_MYPROFILES

$GUIX describe -f channels \
      > $GUIX_MYPROFILES/from-channels.scm
  1. Install for example the Emacs related packages
mkdir -p ${GUIX_MYPROFILES}/emacs/emacs
$GUIX package					\
      -m .config/guix/manifests/emacs.scm	\
      -p ${GUIX_MYPROFILES}/emacs/emacs		\
      --fallback

The file my-dumb-manifest-installer.sh should automatize this for all the manifests. Note that the option --fallback is required because some substitutes should be missing.

Maybe create ~/.config/emacs.

Configuration

  1. Propagate all the configurations files
    guix shell stow \
         -- stow -d $(pwd) -t $HOME . -R
        

    Sometimes the folder does not exist yet and should be used by other applications, so to avoid issues and mix files in my-conf/ let create them before stowing them, e.g., mkdir -p ~/.emacs.d/

  2. Optionally cleanup the store
    guix gc
        
  3. Create email encrypted password
    gpg -o ~/mail/pass-kikoo.gpg -c -
        
  4. Enable sync of Emails
    export XDG_RUNTIME_DIR=/run/user/$(id -u)
    systemctl --user start mbsync.service mbsync.timer
    systemctl --user enable mbsync.timer
    systemctl --user start smtp.service smtp.timer
    systemctl --user enable smtp.timer
        

Now logout and relog (or maybe reboot).

Tips

Empty shell

env -i $(which bash) --login --noprofile --norc

GUIX_PROFILE=path/to/project
. $GUIX_PROFILE/etc/profile

Enable guix shell –container

Be careful !

# as root
echo "kernel.unprivileged_userns_clone = 1" > /etc/sysctl.d/local.conf
sysctl --system

Trick for Debian.

Protect from GC 2.5GiB of input texlive-*-texmf.tar.xz

guix build texlive -K
guix gc --list-dead | grep texmf
# As root
ln -s /gnu/store/<hash>-texlive-<date>-texmf.tar.xz \
   /var/guix/gcroots/texlive-<date>-texmf.tar.xz
# As user
guix gc

guix system *-image and KVM

  1. Check if /dev/kvm is there: ls -l /dev/kvm
  2. Add the user to the KVM group
    sudo usermod -a -G kvm <user>
    newgrp kvm
        
  3. If it does not work, then try:
    sudo chmod 777 /dev/kvm
        
  4. Verify with e.g.
    guix system image -t docker gnu/system/examples/docker-image.scm
        

Docker

sudo chmod 666 /var/run/docker.sock

Email: mbsync+notmuch = hard time with Gmail

One of the issue is that Gmail holds forever all the emails in All Mails and it is then hard to definitively remove them. They claim it works with some IMAP settings but I have failed. The solution I came up is:

  1. Add the tag +deleted to messages.
  2. Remove them:
    notmuch tag -unread tag:deleted
    notmuch search --output=files --format=text0 tag:deleted \
            | xargs -0 --no-run-if-empty rm
        
  3. Sync: mbsync -Va
  4. Remove them time to time by hand using the WebApp interface, using the query:
    -in:inbox -from:me -label:protected -label:starred
        

    Be careful, it seems not working as expected, since Gmail outputs all the thread. Aside, the label protected is to skip the archived emails.

Last, do not forget to allow IMAP for some folders, e.g., [Gmail]/Bin.

Example of query – size the detached GPG signatures:

guix shell pv
notmuch search --output=messages tag:signed \
    | xargs -I{} notmuch show --part=3 {}   \
    | pv -b 1> /dev/nul
# Assumption!
# Part: 1 all message, 2 body, 3 first attachment

GitHub token

git remote add origin https://<token>@github.com/<username/<repo>

where <token> has to be generated from their WebUI: User settings -> Developer Settings -> Personal access tokens; uniquely defined, thus redefined for each repo .git/config.

Date/hour

date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"