Skip to content

ryan4yin/guix-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

guix-config

My dotfiles for GNU Guix

Tutorials

Tutorials for Guile Scheme Language:
  • A Scheme Primer: for a basic understanding of Scheme
  • Guile 3.0 Manual: The most important part of this manual is API Reference, when in doubt, check the API Reference.

How to practice Guile Scheme Language(on NixOS):

nix shell nixpkgs#racket-minimal --command "racket"

Tutorials for Guix itself:

How to use Guix on NixOS: https://github.com/ryan4yin/nix-config/blob/main/modules/nixos/desktop/guix.nix

Key community projects

Notes

  1. ‘a: a syntax sugar of (quote a), a symbol a is not evaluated.
  2. #t and #f: true and false
  3. ’() or null: empty list
  4. (list arg1 arg2 …) or '(arg1 arg2 …): a linked list,
  5. cons* arg1 arg2 …: similar to (list arg1 arg2 …), but its last cons cell is a dotted list, which does not have null for its cdr.
    1. This function is called list* in some other Schemes and in Common LISP.
scheme@(guile-user)> (cons* 1 2 3 4 5)
$4 = (1 2 3 4 . 5)
scheme@(guile-user)> (list 1 2 3 4 5)
$5 = (1 2 3 4 5)
scheme@(guile-user)> '(1 2 3 4 5)
$6 = (1 2 3 4 5)

scheme@(guile-user)> '(1 2)
$7 = (1 2)
scheme@(guile-user)> (cons 1 (cons 2 '()))
$8 = (1 2)
;; a list which does not have `null` for its cdr is called a dotted list.
scheme@(guile-user)> (cons 1 2)
$9 = (1 . 2)

Guix Mirror in China

https://mirror.sjtu.edu.cn/docs/guix

FAQ

1. In which scenarios should I use cons* instead of list / cons?

  1. cons create a pair with two elements, the first element is its car and the second element its cdr.
  2. (list a b ...) create a linked list with multiple elements, and a null is appended to the end of the list.
  3. (cons* a b ... g h) create a linked list with multiple elements, but the last element is not null, it is the last element of the list.

cons* is useful when you want to insert multiple elements at the front of a list. For example, (cons* 1 2 3 '(4 5 6)) will insert 1 2 3 at the front of (4 5 6), and the result is (1 2 3 4 5 6).

nonguix’s installation description use cons* ... %default-channels to insert its channel infront of guix’s default channels.

if we use list ... %default-channels, the result have an extra null at the end of the list, which is not what we want.

scheme@(guile-user) [1]> (list 1 2 3 (list 4 5 6))
$13 = (1 2 3 (4 5 6))
scheme@(guile-user) [1]> '(1 2 3 (4 5 6))
$14 = (1 2 3 (4 5 6))
scheme@(guile-user) [1]> (cons* 1 2 3 (list 4 5 6))
$15 = (1 2 3 4 5 6)

2. How to install package vai config.scm?

  1. guix search <package-name> to find the package’s location.
    1. For example, guix search kitty will show the package’s location is gnu/packages/terminals.scm.
  2. add (use-package-modules terminals) to the top of config.scm.
  3. add kitty to the packages list in config.scm.

3. Documentation?

  1. docs for use-modules: it’s provided by guile, see https://www.gnu.org/software/guile/manual/html_node/Using-Modules.html
  2. docs for use-service-modules, use-package-modules & use-system-modules: No docs for them. But you can read their definition in source code: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu.scm#n143
  3. Source code:
    1. https://git.savannah.gnu.org/cgit/guix.git/tree/
    2. https://github.com/nonguix/nonguix/tree/master/nongnu

4. Why is guix pull so sluggish? (Stuck in computing guix derivation)

Learn more: https://guix.gnu.org/manual/en/html_node/Channels-with-Substitutes.html

When executing guix pull, Guix initially compiles the definitions of every available package. This is a resource-intensive process for which substitutes (refer to Substitutes) may be accessible.

For nonguix, you can enhance the speed of the guix pull operation by incorporating its official substitutes. To delve into the details, refer to the ‘substitutes’ section in https://gitlab.com/nonguix/nonguix.

In NixOS, nix undergoes no compilation phase and functions as a fully interpreted language. Consequently, nix flake update outpaces guix pull in terms of speed.

The substitutes you integrate into config.scm will become effective only after the initial completion of guix system reconfigure! For expediting the inaugural reconfiguration, consult nonuix’s official README for guidance.

5. Why is guix system reconfigure so lethargic? (Stuck in build phase)

Similar to the earlier point, you can hasten guix system reconfigure by introducing nonguix’s substitutes.

References

Other dotfiles that inspired me:

Releases

No releases published