by 96bcaa76-0f27-45e7-9aa3-65c535e53a05

Nixos Always Latest

Nixos often has the latest versions of packages. Especially if you pull from unstable or directly from github, but there are times when the most bleeding edge of software has not been packaged yet. Nix does provide an easy fix though. For example I want to run the latest version of prusa-slicer I can do this easily by doing the following.

let
  mog_prusa-slicer = pkgs.unstable.prusa-slicer.overrideAttrs (oldAttrs: rec {
    version = "2.6.1-rc2";
    src = pkgs.fetchFromGitHub {
      owner = "prusa3d";
      repo = "PrusaSlicer";
      hash =
        "sha256-eSAKQNNNh4sDHwBTl0AmETlM+eFbC3PL5we5O5oOXfI="; # lib.fakeHash;
      rev = "version_${version}";
    };
  });
in {
  environment.systemPackages = with pkgs; [
    mog_prusa-slicer
  ];
}

this is altering the standard nixos package which is at 2.6.0 to build from the 2.6.1-rc2 version. Given the depdencies haven’t changed it just worked. To find the hash value you need you can use lib.fakeHash it will cause nix to give you the correct hash for the new version of the software you are trying to build.