Skip to content

foo-dogsquared/nix-overlay-guix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guix overlay for NixOS

It’s an overlay for installing Guix in NixOS. Forked originally from Emiller88’s Guix overlay.

Migrating to nixpkgs' version

As of 2023-12-04, most of the things over here has been upstreamed into nixpkgs including the module. This means development will now take place over at nixpkgs and any issues and discussions should be filed over there (be sure to ping me as well). I recommend to use nixpkgs' version as it is also actively maintained and has more options (such as services.guix.gc) compared to here.

As for this Git repo, it will stay the way it is indefinitely (considering to archive it to make it more obvious).

To get started (if applicable):

  • Remove the flake input entirely.

  • Remove the overlay (if you use it) since Guix is available from nixpkgs now.

  • Remove the imported module from this flake.

  • Remove the reference of the package from this flake in services.guix.package.

As for the module itself, there should be no changes from the user side. Just set services.guix.enable = true; somewhere in your NixOS configuration and it’s all set.

What’s in the flake?

To quickly show the goods, just run nix flake show ${FLAKE}.

Here’s what the flake should contain from the most interesting to the most boring.

  • overlays.default which contains the overlay for the Guix (and its dependencies) as a Nix package.

  • packages.${system}.${package} containing derivations of Guix and the dependencies.

  • nixosModules contains various NixOS modules exported for this project. The most useful (and only) modules are for enabling Guix daemon (either with the Nix-built version or the binary installation).

Please see ./flake.nix for more details.

Warning
While the flake offers a way to install the binary installation for ease of use, it is deprecated and will be removed in 4 years after Guix v1.4.0 has been released. It is recommended to use the modules with Nix-built package instead.

Getting started

Warning

While the Guix package is usable, it isn’t fully functional with some missing dependencies and no proper testing so expect some bugs to pop up. It just so happens to be usable with the most basic use cases (e.g., installing and upgrading packages, managing Guix installation). I haven’t used Guix to its full capabilities so if you use Guix extensively, please file an issue.

Some prerequisites:

  • You need NixOS installed, of course. The minimum version required is at least 22.05. Whether or not this works at unstable branches is a game of gamble and only minimally tested.

  • If you have Nix with flakes experimental feature enabled, you need Nix 2.8 and above as well with the new command line interface enabled (i.e., experimental-features = nix-command flakes from your Nix configuration).

This project also has a binary cache available in case you want to speed up your installation.

Here’s one way to set it up in your NixOS configuration.

{
  nix.settings = {
    substituters = [ "https://foo-dogsquared.cachix.org" ];
    trusted-public-keys = [ "foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E=" ];
  };
}

Or you can use cachix use foo-dogsquared if you have cachix installed.

Using with Nix flakes

This is the recommended installation method.

Now, add it in your flake configuration…​

inputs.guix-overlay.url = "github:foo-dogsquared/nix-overlay-guix";

…​and add the overlay in nixpkgs.overlays.

nixpkgs.overlays = [
  # Your overlays...

  # The guix overlay.
  inputs.guix-overlay.overlays.default
];

You can now add Guix as a additional package to your NixOS system. Though, there is a NixOS module that already sets up most of the things to make Guix work with NixOS nicely.

{
  imports = [
    inputs.guix-overlay.nixosModules.guix
  ];

 # Enabling the Guix daemon and install the package manager in your system.
  services.guix.enable = true;
}

Using with channels

This project tries to be easy to use with Nix channels but it is not there yet. Though, I recommend using something like niv to ease channel management (i.e., niv add foo-dogsquared/nix-overlay-guix).

For now, you’ll have to keep in mind about the requirements of this being supporting mainly NixOS 22.05.

As root, add the project as part of the channel list.

nix-channel --add https://github.com/foo-dogsquared/nix-overlay-guix/archive/master.tar.gz guix-overlay
nix-channel --update

In your NixOS configuration, you have to add the Guix package set as an overlay.

nixpkgs.overlays = [
  (final: prev: import <guix-overlay/pkgs> { pkgs = prev; })
];

Now, import the NixOS module and enable the imported service.

{
  imports = [
    <guix-overlay/modules/nixos/guix.nix>
  ];

  services.guix.enable = true;
}

Post-installation

You might want to do these things after installation:

  • Follow the Application Setup guide from the Guix manual more specifically on locales (i.e., guix install glib-locales). This is to ensure Guix-managed applications use the appropriate locale data. However, you don’t need to setup GUIX_LOCPATH environment variable as the module already does this.

Development guidelines

Non-exhaustive list of guidelines when developing this project.

  • This project follows the Semantic Versioning scheme for its stable version.

  • Follow the conventions in most NixOS modules from nixpkgs as of the appropriate version.

  • Keep in mind about the main nixpkgs branch to be followed. This is seen in ./flake.nix.

  • For other stable versions, this should be kept at a separate branch similar to how nixpkgs and home-manager does it.

Why fork it?

  • First and foremost, I want to explore how to make an overlay like this. I want the two package manager work together without much trouble (in the side of NixOS anyways).

  • Try to make Guix work on a NixOS-based system. I want it to make my Guix workflow works without resorting to virtual machines. My workstation is just a potato ran by a hamster that is nearing its life expectancy and I cannot afford it any longer. I WANT IT TO JUST WORK!

  • Well, the original repository doesn’t see much additional commits in the last year. In that timeframe, Guix v1.3.0 has been released and more features is yet to be seen such as the Guix home configurations and additional fixes and small-scale features. I don’t want to miss out with another clunky virtual machine that is just further making my battery drain more.

TODO

  • ✓ Cleanup the codebase.

    • ✓ Cleanup the additional Guile modules.

    • ✓ Format with nixfmt.

  • ✓ Document the flake and its outputs.

  • ✓ Make it easy to use if installed with traditional channels. Or at least document it.

  • ✓ Cache the package set of this project.

  • ✓ Make use of a CI system to automate building and updating.

  • ✓ Create packages for Guix with the binary installation.

    • ❏ Create the binary installation with various versions just for fun ;p (This aged well considering I’ll be deprecating the binary installation now.)

    • ❏ Make the same with Nix-built Guix with offering the various versions.

About

A package and module for using GNU Guix on Nix(OS).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •