- 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:
- GNU Guix Reference Manual: read this first for installation and basic usage & setup.
- GNU Guix Cookbook: read this after you have your Guix installed and have some basic knowledge about Guix.
How to use Guix on NixOS: https://github.com/ryan4yin/nix-config/blob/main/modules/nixos/desktop/guix.nix
- ‘a: a syntax sugar of
(quote a)
, a symbola
is not evaluated. #t
and#f
: true and false- ’() or
null
: empty list (list arg1 arg2 …)
or'(arg1 arg2 …)
: a linked list,cons* arg1 arg2 …
: similar to(list arg1 arg2 …)
, but its last cons cell is a dotted list, which does not havenull
for its cdr.- This function is called
list*
in some other Schemes and in Common LISP.
- This function is called
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)
cons
create a pair with two elements, the first element is itscar
and the second element itscdr
.(list a b ...)
create a linked list with multiple elements, and anull
is appended to the end of the list.(cons* a b ... g h)
create a linked list with multiple elements, but the last element is notnull
, 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)
guix search <package-name>
to find the package’s location.- For example,
guix search kitty
will show the package’s location isgnu/packages/terminals.scm
.
- For example,
- add
(use-package-modules terminals)
to the top ofconfig.scm
. - add
kitty
to thepackages
list inconfig.scm
.
- docs for
use-modules
: it’s provided by guile, see https://www.gnu.org/software/guile/manual/html_node/Using-Modules.html - 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 - Source code:
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
outpacesguix 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.
guix system reconfigure
by introducing nonguix’s substitutes.
Other dotfiles that inspired me: