help-guix
[Top][All Lists]
Advanced

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

Re: How to declare symlinks in the configuration?


From: Gary Johnson
Subject: Re: How to declare symlinks in the configuration?
Date: Wed, 17 May 2023 22:40:10 -0400

Marek Paśnikowski <marekpasnikowski@protonmail.com> writes:

> How can I declare symbolic links in the system configuration?
> In this specific case, I wish to be able to declare the following link:
> ~/.config/guix/channels.scm -> ~/src/izumi/channels.scm

Hi Marek,

`guix system` is meant to declare the immutable state of your filesystem
*outside* of your home directory as well as packages and services
installed at the system level.

`guix home` is meant to declare the immutable state of your filesystem
*within* your home directory as well as packages and services installed at
the user level.

Used together, they allow you to declare the immutable state of your
entire filesystem. Then you will just need to back up those parts which
are not immutable in order to be able to recover your system after a
failure or transfer the same configuration to another machine.

Since your question is about creating a symlink to a file in your home
directory, you will want to use `guix home` for this task. First place
this code into a file called `home-config.scm`:

```scheme
(use-modules
 ((gnu home)          #:select (home-environment))
 ((gnu home services) #:select (service home-files-service-type))
 ((guix gexp)         #:select (local-file)))

(home-environment
 (services
  (list
   (service home-files-service-type
            `((".config/guix/channels.scm" ,(local-file 
"/home/your_username/src/izumi/channels.scm")))))))
```

Next, run this command from your shell (do not use `sudo`):

```sh
guix home reconfigure home-config.scm
```

Once this command exits, you should find a symlink at
`~/.config/guix/channels.scm` that points to a copy of your
`channels.scm` file located under the system-wide immutable `/gnu/store`
directory. Each time you want to update this file, simply edit
`~/src/izumi/channels.scm` and re-run the `guix home` command above.

Good luck and happy hacking!
  Gary

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



reply via email to

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