1

I'm trying to download a package with a version that is not on nixpkgs. To do so, I'm using builtins.fetchGit. Here's a summary of the file where I use fetchGit (/etc/nixos/home/core.nix) for a better idea:

{ pkgs, username, homeDirectory }:

############################
# Custom package snapshots #
############################

let custom-ver-pkgs = {
  # Haskell Language Server
  hls = let pkgsSnapshot = import (builtins.fetchGit {
      name = "custom hls version";
      url = "https://github.com/nixos/nixpkgs-channels/";
      ref = "refs/heads/nixpkgs-unstable";                     
      rev = "2c162d49cd5b979eb66ff1653aecaeaa01690fcc";
    }) {}; in pkgsSnapshot.haskellPackages.haskell-language-server;
};

in

{
  # Actual config
}

And here's the point where I use the hls keyword defined above:

  # Packages
  home.packages = with pkgs; [
    ... # Normal packages
  ] ++

  # Packages with custom version (See start of file)
  (with custom-ver-pkgs; [
    hls
  ]);

As you can see, I also use home-manager. The above-mentioned .../core.nix file is imported directly into /etc/nixos/configuration.nix.

As the title says, if I run sudo nixos-rebuild switch, the terminal freezes (in the sense that the command goes on forever without doing anything). What could my problem be?

knedlsepp
  • 6,065
  • 3
  • 20
  • 41
Dincio
  • 1,010
  • 1
  • 13
  • 25
  • 1
    Nix shouldn't just stop. Which version of Nix are you using? Please try with one or more `-v` flags to figure out what Nix was doing before it stopped. – Robert Hensing Dec 18 '20 at 07:33
  • 1
    I ran `sudo nixos-rebuild -v switch` and the terminal froze (or at least it went without doing anything for 10 min) after this line: `fetching Git repository 'https://github.com/nixos/nixpkgs-channels/'...` – Dincio Dec 18 '20 at 17:10
  • Just kidding... immediately after I wrote the terminal continued with something along the lines of `error: malformed name fields; no spaces allowed`. I will from now on always use the `-v` flag... tank you for your time. – Dincio Dec 18 '20 at 17:12
  • Have you tried just using an overlay to redefine the package source? – nrdxp Mar 02 '21 at 07:26

0 Answers0