Skip to content

nbljaved/guix-config

Repository files navigation

Assuming one is running Guix as their operating system, then to update the contents of this folder run:

make
# sudo guix system reconfigure -L ~/guix-config/nbl /etc/config.scm
sudo guix system reconfigure

Guix Home

https://guix.gnu.org/manual/devel/en/html_node/Declaring-the-Home-Environment.html

# The guix home import command reads some of the “dot files” such as ~/.bashrc found in your home directory and copies them to the given directory, ~/guix-config/guix-home in this case; it also reads the contents of your profile, ~/.guix-profile, and, based on that, it populates ~/guix-config/guix-home/home-configuration.scm with a Home configuration that resembles your current configuration. 

guix home import ~/guix-config/guix-home
guix home reconfigure ~/guix-config/guix-home/home-configuration.scm
guix home container path-to-home-config.scm

Nix

I use Nix for packages that aren’t currently available in Guix, or those I might need at a moments notice.

(see Guix Miscellaneous Services)

;; Add this service in services /etc/config.scm
(service nix-service-type)

After guix system reconfigure configure Nix for your user:

ln -s "/nix/var/nix/profiles/per-user/$USER/profile" ~/.nix-profile
source /run/current-system/profile/etc/profile.d/nix.sh

Nix Channel setup

## Common nix-channel commands

# Listing current channels
nix-channel --list

# Adding a primary channel
nix-channel --add https://nixos.org/channels/channel-name nixos
# For eg: nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs

# Adding other channels
nix-channel --add https://some.channel/url my-alias

# Remove a channel
nix-channel --remove channel-alias

# Updating a channel
nix-channel --update channel-alias

# Updating all channels
nix-channel --update

# Note that updating channels won't cause a rebuild in itself; if you
# want to update channels and rebuild, you can use nixos-rebuild with
# the --upgrade flag to do both in one step.

# Also need to load the nixpkgs channel
nix-channel --add channel-url nixpkgs

nix-env cheatsheet

curl cheat.sh/nix-env

nix-env quickstart

# See what installable packages are currently available in the channel:
nix-env --query --available --attr-path

# Install a package from the channel
nix-env --install --attr nixpkgs.hello

# Uninstall a package:
nix-env --uninstall hello

# Test packages without installing them
nix-shell --packages hello

# To keep up-to-date with the channel, do:
nix-channel --update nixpkgs
nix-env --upgrade '*'

# The latter command will upgrade each installed package for which
# there is a “newer” version (as determined by comparing the version
# numbers).

# If you're unhappy with the result of a nix-env action (e.g., an
# upgraded package turned out not to work properly), you can go back:

nix-env --rollback

You should periodically run the Nix garbage collector to get rid of unused packages, since uninstalls or upgrades don't actually delete them:

 nix-collect-garbage --delete-old

About

GNU guix configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published