help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guix home, guix system, channels, some noob questions


From: Daniel Meißner
Subject: Re: Guix home, guix system, channels, some noob questions
Date: Tue, 17 May 2022 12:15:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Sébastien Rey-Coyrehourcq writes:

> If you have some example of guix home profile that use dotfile manager
> i'm interested :)
> I'm planned to use chezmoi with pass (https://www.chezmoi.io/) in go
> that use git to version file.

IIUC you can use Guix home directly and dispense with chezmoi.  However,
I did not know chezmoi before so there might be a use-case that is not
covered by Guix home, in principle though, Guix home is itself a dotfile
manager.  I use it for example to manage my Git config, Emacs config and
others.  The manual has a chapter about it:

https://guix.gnu.org/de/manual/devel/en/html_node/Home-Configuration.html#Home-Configuration

A simple example would be the following:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu home)
             (gnu home services)
             (gnu home services shells)
             (gnu services)
             (gnu packages admin)
             (guix gexp))


(home-environment
 (packages (list htop))
 (services
  (list
   (service home-bash-service-type
            (home-bash-configuration
             (environment-variables
              '(("HISTFILE" . "$XDG_STATE_HOME/bash_history")))))

   (simple-service 'git-config
                   home-files-service-type
                   (list `(".gitconfig"
                           ,(plain-file "gitconfig"
                                        "[user]
        email = daniel.meissner-i4k@ruhr-uni-bochum.de
        name = Daniel Meißner
")))))))
--8<---------------cut here---------------end--------------->8---

This would create a home-environment with the package ‘htop’, a bash
configuration that sets the HISTFILE env var as well as the .gitconfig
file with the above contents.  You can test this environment using:

  guix home container test-home.scm

This spawns a shell where your home environment is set up as specified
but using a container.  So your actual home directory is not modified.
You don’t have to embed all your config files inside the Scheme file
directly.  You can also load from other files, for example, you could
replace the ,(plain-file ...) call with a ,(local-file "gitconfig.txt")
which would use the contents of the file gitconfig.txt which lives next
to your Scheme file for the generation of the .gitconfig file.

Best

--
Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]