michas
michas

Reputation: 26545

How to modify a nixos package configuration

I am building a nixos system in a network that is only able to access the outside world through a web proxy. The nixos grub configuration tries to access the grub repository through a git:// URL which obviously does not work at my network.

Therefore I want to replace the git:// url by the corresponding http:// URL. (savannah supports both.) The corresponding nix documentation shows how to do it.

I created a file ~/.nixpkgs/config.nix containing the following content:

{
  packageOverrides = pkgs: rec {
    grub = pkgs.grub.override {
      src.url="http://git.savannah.gnu.org/grub.git";
    };
  };
}

Unfortunately nixos-rebuild switch still tries to use the old URL. What did I do wrong?


I also read the customising packages of the documentation. From that it seems like I could add the following to /etc/nixos/configuration.nix:

nixpkgs.config.packageOverrides = pkgs: {
    grub = pkgs.grub.overrideDerivation (pkgs.grub ( attrs: {
        url = "http://git.savannah.gnu.org/grub.git";
        rev = "2ae9457e6eb4c352051fb32bc6fc931a22528ab2";
        sha256 = "1ik60qgkymg0xdns5az1hbxasspah2vzxg334rpbk2yy3h3nx5ln";
    }));
};

However nixos-rebuild switchnixos-rebuild switch still uses the old url. I probably need to add fetchurl, but I have no idea how to make this available at this place.

Upvotes: 2

Views: 3322

Answers (1)

iElectric
iElectric

Reputation: 5819

pkgs.grub.override can override function at the top of the file. To override derivation parameters use overrideDerivation as described in http://nixos.org/nixos/manual/sec-package-management.html#sec-customising-packages

{
  packageOverrides = pkgs: rec {
    grub = pkgs.grub.override (attrs: {
      src = fetchurl { url = "http://git.savannah.gnu.org/grub.git";
                       sha256 = "";
      };
    });
  };
}

Upvotes: 2

Related Questions