Micron Document
Nix under Guix

The Nix package manager does not simply work out of the box on Guix, despite that there is a T383838nix package. On one system I used the determinate nix installer and then made use of the nix command from a T383838guix shell nix command, and that worked okay, but I wanted to remove at least some of the imperative steps so it would be faster to reproduce it later.

So here's the process I made work:

• add nix to the system packages
• add users/groups to the system
• add a service for nix-daemon
• rebuild the system
• add a channel
• update that channel
• cheerfully build and use packages and shells

add nix to the system packages

I recently discovered T383838guix search which is how one deduces the module containing the package.

T383838guix search nix and then look at the locations. For example:

T282828
guix search nix Tb4b4b4| grep location: Tb4b4b4| head -n T79c0ff3
location: gnu/packages/package-management.scm:914:2


Without the head command there it would spew a lot of matches, but typically the first match is the real package. This can be verified by just viewing the full info:

guix show nix
name: nix
version: 2.25.5
outputs:
• out: everything
systems: x86_64-linux i686-linux
dependencies: autoconf-archive@2023.02.20 autoconf@2.69 automake@1.17 bison@3.8.2 boost@1.89.0 brotli@1.1.0 bzip2@1.0.8
• config@0.0.0-1.c8ddc84 curl@8.6.0 editline@1.17.1 flex@2.6.4 googletest@1.17.0 jq@1.8.1 libarchive@3.7.7 libblake3@1.8.2
• libcpuid@0.8.0 libgc@8.2.8 libgit2@1.9.2 libseccomp@2.6.0 libsodium@1.0.18 libtool@2.4.7 lowdown@1.1.0 man-db@2.12.0
• nlohmann-json@3.12.0 openssl@3.0.8 pkg-config@0.29.2 rapidcheck@0.0.0-1.ff6af6f sqlite@3.39.3 toml11@3.7.1 util-linux@2.40.4 xz@5.4.5
• zlib@1.3.1
location: gnu/packages/package-management.scm:914:2
homepage: https://nixos.org/
license: LGPL 2.1+
synopsis: The Nix package manager
description: Nix is a purely functional package manager. This means that it treats packages like values in purely functional
• programming languages such as Haskell—they are built by functions that don't have side-effects, and they never change after they have
• been built. Nix stores packages in the Nix store, usually the directory /nix/store, where each package has its own unique
• sub-directory.
relevance: 41

But all of that was to figure out the use-module line and what package to add to T383838config.scm:

T282828
T8b949e;; under (use-modules ...
Tb4b4b4(Td2a8ffgnu Te6edf3packages Te6edf3package-managementTb4b4b4)
T8b949e;; and the packages list later:
Tb4b4b4(Td2a8ffpackages Tb4b4b4(Tffa657append Tb4b4b4(Tffa657list
Te6edf3nix
T8b949e;; other packages installe to the system here…


add users/groups to the system

There are a bunch of nix builder groups and users that are needed to do work by the package manager, and these have to have certain group settings. I don't know scheme, so I dont know how to make this shorter, but this is needed, too:

T282828
Tb4b4b4(Td2a8ffgroups Tb4b4b4(Tffa657cons* Tb4b4b4(Td2a8ffuser-group Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4) Te6edf3%base-groupsTb4b4b4)Tb4b4b4)
T8b949e;; and later
Tb4b4b4(Td2a8ffusers Tb4b4b4(Tffa657cons* Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffstephenTa5d6ff"Tb4b4b4) T8b949e;; this is just to ilustrate the
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ffStephenTa5d6ff"Tb4b4b4) T8b949e;; other users need to go in the
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffusersTa5d6ff"Tb4b4b4) T8b949e;; users list somewhere.
Tb4b4b4(Td2a8ffhome-directory Ta5d6ff"Ta5d6ff/home/stephenTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffwheelTa5d6ff" Ta5d6ff"Ta5d6ffnetdevTa5d6ff" Ta5d6ff"Ta5d6ffaudioTa5d6ff" Ta5d6ff"Ta5d6ffvideoTa5d6ff" Ta5d6ff"Ta5d6ffdialoutTa5d6ff"Tb4b4b4)Tb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld1Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld2Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld3Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld4Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld5Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld6Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld7Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld8Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld9Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)

Tb4b4b4(Td2a8ffuser-account
Tb4b4b4(Td2a8ffname Ta5d6ff"Ta5d6ffnixbld10Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffcomment Ta5d6ff"Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffgroup Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsupplementary-groups
Tff7b72'Tb4b4b4(Ta5d6ff"Ta5d6ffnixbldTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffcreate-home-directory? Tff7b72#fTb4b4b4)
Tb4b4b4(Td2a8ffshell Ta5d6ff"Ta5d6ff$(which nologin)Ta5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffsystem? Tff7b72#tTb4b4b4)Tb4b4b4)
T8b949e;; end of added accounts, remember the others!
Te6edf3%base-user-accountsTb4b4b4)Tb4b4b4)


add a service for nix-daemon

Unfortunately this is more complicated than it needs to be. I couldn't figure out how to make a service that doesn't take a parameter with the config (as I modeled it off my keyd service) so mine has a default value of a T383838'() that it doesn't use. But otherwise, here's the service:

T282828
Tb4b4b4(Tff7b72define Te6edf3nix-daemon-service-type
Tb4b4b4(Td2a8ffservice-type Tb4b4b4(Td2a8ffname Ta5d6ff'nix-daemonTb4b4b4)
Tb4b4b4(Td2a8ffextensions Tb4b4b4(Tffa657list Tb4b4b4(Td2a8ffservice-extension Te6edf3shepherd-root-service-type

Tb4b4b4(Tff7b72lambda Tb4b4b4(Td2a8ffconfigTb4b4b4)
Tb4b4b4(Tffa657list Tb4b4b4(Td2a8ffshepherd-service Tb4b4b4(Td2a8ffprovision Tff7b72'Tb4b4b4(Te6edf3nix-daemonTb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffdocumentation Ta5d6ff"Ta5d6ffnix-daemon service for executing commands for usersTa5d6ff"Tb4b4b4)
Tb4b4b4(Td2a8ffrequirement Tff7b72'Tb4b4b4(Te6edf3user-processesTb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffauto-start? Tff7b72#tTb4b4b4)
Tb4b4b4(Td2a8ffstart Tff7b72#Te6edf3~Tb4b4b4(Td2a8ffmake-forkexec-constructor
Tb4b4b4(Tffa657list Tff7b72#Te6edf3$Tb4b4b4(Td2a8fffile-append Te6edf3nix Ta5d6ff"Ta5d6ff/bin/nix-daemonTa5d6ff"Tb4b4b4)Tb4b4b4)
Tff7b72#:log-file Ta5d6ff"Ta5d6ff/var/log/nix.logTa5d6ff"Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffstop Tff7b72#Te6edf3~Tb4b4b4(Td2a8ffmake-kill-destructorTb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffrespawn? Tff7b72#fTb4b4b4)Tb4b4b4)Tb4b4b4)Tb4b4b4)Tb4b4b4)Tb4b4b4)
Tb4b4b4)
Tb4b4b4(Td2a8ffdefault-value Tff7b72'Tb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4(Td2a8ffdescription Ta5d6ff"Ta5d6ffRun nix daemonTa5d6ff"Tb4b4b4)Tb4b4b4)Tb4b4b4)


And then I make a reference to that from the system services:

T282828
Tb4b4b4(Td2a8ffservices
Tb4b4b4(Tffa657cons*
Tb4b4b4(Td2a8ffservice Te6edf3nix-daemon-service-typeTb4b4b4)
Te6edf3%desktop-servicesTb4b4b4)Tb4b4b4)


rebuild the system

Provided the changes to T383838config.scm are syntactically valid, and the file is stored in T383838/etc this is how to rebuild:

sudo -i guix system reconfigure /etc/config.scm

add the channel

Depending on the desired version of nix to target, just add a channel for nixpkgs, for example:

nix-channel --add https://github.com/NixOS/nixpkgs/archive/refs/tags/25.11.tar.gz nixpkgs

update that channel

This is where things broke when I tried to use nix commands without having T383838nix-daemon running.

nix-channel --update

If there is a weird complaint about the nix store or a file not being found in the nix store, then maybe make a new one:

nix-store --init

Or was in just T383838init without the hyphens?

cheerfully build and use packages and shells

T282828
nix-shell -p figlet
Tffa657echo woot Tb4b4b4| figlet


conclusion

So far, everything I've tried to do with the nix command (granted, it's not a lot) has worked. Mostly I've just created ephemeral shells to run different software.

Tags: guix, nix

Tags
Navigation
Backlinks


created: 2026-05-10

(re)generated: 2026-07-17