Giter Club home page Giter Club logo

nix-overlay-guix's Introduction

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.

nix-overlay-guix's People

Contributors

bqv avatar edmundmiller avatar foo-dogsquared avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nix-overlay-guix's Issues

Deprecate binary installation module and package

The binary installation is just added as an easy way to install Guix back when the Nix-built package is mostly unusable. Now that it works, its purpose is done. With some mindful testing for the package and the module, the binary installation is become less valuable.

It could be removed some time after Guix v1.4.0 is released. In this case, I think 4 years is generous enough.

guile-ssh fails to build

Describe the bug

guile-ssh fails to build, two tests don't pass (should it run tests at all?)

error: builder for '/nix/store/idbkbkhvgxrhq5q0kwlzl3ch4r8aj66p-guile-ssh-0.16.0.drv' failed with exit code 2;
       last 10 log lines:
       > See tests/test-suite.log
       > Please report to [email protected]
       > ============================================================================
       > make[3]: *** [Makefile:676: test-suite.log] Error 1
       > make[3]: Leaving directory '/build/source/tests'
       > make[2]: *** [Makefile:784: check-TESTS] Error 2
       > make[2]: Leaving directory '/build/source/tests'
       > make[1]: *** [Makefile:849: check-am] Error 2
       > make[1]: Leaving directory '/build/source/tests'
       > make: *** [Makefile:430: check-recursive] Error 1
       For full logs, run 'nix log /nix/store/idbkbkhvgxrhq5q0kwlzl3ch4r8aj66p-guile-ssh-0.16.0.drv'.
error (ignored): error: cannot unlink '/tmp/nix-build-gnutls-3.7.8.drv-1/gnutls-3.7.8': Directory not empty
error: 1 dependencies of derivation '/nix/store/fjlqjc71nc33y93amh50f5w9srawnqnw-guix-unstable-2022-08-22.drv' failed to build
error: 1 dependencies of derivation '/nix/store/638mdwfs5bbd931731rfh8l9qqdbkr95-nixos-system-tx-22.11.20221109.9f0f80b.drv' failed to build
$ nix log /nix/store/idbkbkhvgxrhq5q0kwlzl3ch4r8aj66p-guile-ssh-0.16.0.drv
....
============================================================================
Testsuite summary for Guile-SSH 0.16.0
============================================================================
# TOTAL: 11
# PASS:  9
# SKIP:  0
# XFAIL: 0
# FAIL:  2
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to [email protected]
============================================================================
make[3]: *** [Makefile:676: test-suite.log] Error 1
make[3]: Leaving directory '/build/source/tests'
make[2]: *** [Makefile:784: check-TESTS] Error 2
make[2]: Leaving directory '/build/source/tests'
make[1]: *** [Makefile:849: check-am] Error 2
make[1]: Leaving directory '/build/source/tests'
make: *** [Makefile:430: check-recursive] Error 1

To Reproduce

  1. Having flakes setup.
  2. service.guix.enable=true;
  3. Running sudo nixos-rebuild switch --flake '.#'

Expected behavior
guix installed

Additional context

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/master";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    guix-overlay.url = "github:foo-dogsquared/nix-overlay-guix";
  };

Errors when trying to rebuild Guix Home

Describe the bug

When I try to rebuild my config

$ cat a12l.scm
;; This "home-environment" file can be passed to 'guix home reconfigure'
;; to reproduce the content of your profile.  This is "symbolic": it only
;; specifies package names.  To reproduce the exact same profile, you also
;; need to capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(use-modules (gnu home)
             (gnu packages)
             (gnu services))

(home-environment
  ;; Below is the list of packages that will show up in your
  ;; Home profile, under ~/.guix-home/profile.
  (packages (specifications->packages (list "fd"
                                            "kakoune"
                                            "ripgrep")))

  ;; Below is the list of Home services.  To search for available
  ;; services, run 'guix home search KEYWORD' in a terminal.
  (services
   (list)))

I often get the build errors, for example

$ guix home reconfigure a12l.scm
guix home: warning: cannot determine provenance for current system
guix home: warning: cannot determine provenance of GNU Guix
Cleaning up symlinks from previous home at /var/guix/profiles/per-user/a12l/guix-home.

Skipping /home/a12l/.profile (not a symlink to store)... done
guix home: error: rmdir: Device or resource busy

Currently ~/ looks like

$ exa -a1 ~/
.bash_history
.bash_profile -> /nix/store/062rgvyml2yvp8a3qqqyhmd6hki2ykzf-home-manager-files/.bash_profile
.bashrc -> /nix/store/062rgvyml2yvp8a3qqqyhmd6hki2ykzf-home-manager-files/.bashrc
.guix-home -> /var/guix/profiles/per-user/a12l/guix-home
.guix-profile -> /var/guix/profiles/per-user/a12l/guix-profile
.nix-defexpr
.nix-profile -> /nix/var/nix/profiles/per-user/a12l/profile
.profile -> /nix/store/062rgvyml2yvp8a3qqqyhmd6hki2ykzf-home-manager-files/.profile

(with the irrelevant entries removed)

This problem doesn't seem to depend on the packages to install, because when I try to switch to a generation build using

$ cat a12l.scm
;; This "home-environment" file can be passed to 'guix home reconfigure'
;; to reproduce the content of your profile.  This is "symbolic": it only
;; specifies package names.  To reproduce the exact same profile, you also
;; need to capture the channels being used, as returned by "guix describe".
;; See the "Replicating Guix" section in the manual.

(use-modules (gnu home)
             (gnu packages)
             (gnu services))

(home-environment
  ;; Below is the list of packages that will show up in your
  ;; Home profile, under ~/.guix-home/profile.
  (packages (specifications->packages (list)))

  ;; Below is the list of Home services.  To search for available
  ;; services, run 'guix home search KEYWORD' in a terminal.
  (services
   (list)))

I get the same error

$ guix home reconfigure a12l.scm
guix home: warning: cannot determine provenance for current system
guix home: warning: cannot determine provenance of GNU Guix
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
The following derivations will be built:
  /gnu/store/yl858lmxxraxbnis9ymh3k0ac4534djz-home.drv
  /gnu/store/2rfsrvq5mz399vhimjab88i4hfciwj7c-profile.drv
  /gnu/store/r35xd51h9sialnnh47nsppz4v41zxnb4-provenance.drv

building /gnu/store/r35xd51h9sialnnh47nsppz4v41zxnb4-provenance.drv...
building CA certificate bundle...
listing Emacs sub-directories...
building fonts directory...
building directory of Info manuals...
building profile with 1 package...
building /gnu/store/yl858lmxxraxbnis9ymh3k0ac4534djz-home.drv...
Cleaning up symlinks from previous home at /var/guix/profiles/per-user/a12l/guix-home.

Skipping /home/a12l/.profile (not a symlink to store)... done
guix home: error: rmdir: Device or resource busy

I've solved this problem before by a mix of operations; e.g., removing the symlinks in ~/; rebooting the computer, etc. Not sure what things got this working.

No errors when I just build the configuration

$ guix home build a12l.scm
/gnu/store/lrr2sql3p6lyqhwhc29sylkm23icgl7g-home

I've asked on #guix on libera.chat if it's possible to get more detailed error logs when running guix home reconfigure, but I haven't received any replies.

To Reproduce
Steps to reproduce the behavior:

  1. Enter directory with my guix home configuration.
  2. Run guix home reconfigure a12l.scm

Expected behavior

When running guix home build a12l.scm builds my new configuration and switches the current profile from the old one to the new one.

Testing and more feedback

More feedback is required for the service module and the package. So if you're interested, please leave your feedback here if it works or not (for the most part).

Recreate .guix-profile; .guix-home; and .profile at startup

Describe the bug

I'm using ephemeral home and root[0], and the directories where I store my files are mounted at boot. This means that all files under ~/ is removed. After rebooting I don't have the links ~/.guix-profile; ~/.guix-home; and ~/.profile.

I'm trying to use guix home for configuring my home environment, instead of Home Manager. This is intended as a way to test out Guix; and potentially be a stepping stone to fully move over to Guix from NixOS on my desktop systems.

The link

.guix-profile -> /var/guix/profiles/per-user/a12l/guix-profile

seems to be created when I install a package into my profile with guix install kakoune, but not when I try to update my home environment by running guix home reconfigure a12l.scm. I also get warnings that ~/.profile doesn't exist when I open a shell.

$ exa -la
drwxr-xr-x  - a12l 13 Nov 15:12 .cache
drwxr-xr-x  - a12l 13 Nov 15:12 .config
lrwxrwxrwx 45 a12l 13 Nov 15:20 .guix-profile -> /var/guix/profiles/per-user/a12l/guix-profile
drwxr-xr-x  - a12l 13 Nov 14:41 .local
lrwxrwxrwx 71 a12l 13 Nov 15:12 .manpath -> /nix/store/p2i46958lc8ya7vbacaqbkw6ax9d3m56-home-manager-files/.manpath
drwxr-xr-x  - a12l 13 Nov 14:40 .nix-defexpr
lrwxrwxrwx 43 a12l 13 Nov 14:40 .nix-profile -> /nix/var/nix/profiles/per-user/a12l/profile
drwxr-xr-x  - a12l 27 Oct 13:00 .ssh

(removed irrelevant directories from the output)

To Reproduce
Steps to reproduce the behavior:

  1. Remove ~/.guix-profile and ~/.guix-home directories
  2. Reboot the machine

Expected behavior

The symbolic links ~/.guix-profile; ~/.guix-home; and ~/.profile are recreated at startup if missing.

[0] https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/

Disarchive package cannot be built

This one makes me scratch my head. It cannot be built even though the dependencies are there(?).

This package is not exactly required for the service to be functional but it is required for certain operations such as a fallback for downloads and guix perform-download.

If this is resolved, it will progress towards completion for #1.

Pass check phase for Guix package

For full confidence, Guix package should pass checking.

For more details, see Building from Git from the manual. And maybe the package definition from Guix's package repository as well (which should be in the same repo as the source code).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.