5

So I want to replace pkgs.picom in my home-manager config with a newer fork. How can I do that?

I have a feeling it's something like:

let newPicom = pkgs.picom.override.src.url = "https://github.com/ibhagwan/picom";  
in 
services.picom.package = newPicom; 

But knowing Nix is probably actually some really long incantation with self: super: and so on.

Jonathan
  • 10,571
  • 13
  • 67
  • 103

2 Answers2

6

nixos.wiki has an example of overriding the source of a package.

You do need to provide a reproducible source. A github repo url is mutable, so you need to specify the revision.

{ pkgs, ... }:
let newPicom = pkgs.picom.overrideAttrs (old: {
      version = "git"; # usually harmless to omit
      src = /* put your source here; typically a local path or
               a fixed-output derivation produced by
               `fetchFromGitHub`.
               builtins.fetchGit is also an option. Doesn't run
               in parallel but does fetch private sources. */;
    });
in {
  services.picom.package = newPicom; 
}
Robert Hensing
  • 6,708
  • 18
  • 23
1

Overlays

let
  picom_overlay = (self: super: {
    picom = super.picom.overrideAttrs (prev: {
      version = "git";
      src = pkgs.fetchFromGitHub {
        owner = "yshui";
        repo = "picom";
        rev = "31e58712ec11b198340ae217d33a73d8ac73b7fe";
        sha256 = pkgs.lib.fakeSha256;
      };
    });
  });
in
  nixpkgs.overlays = [ picom_overlay ];

Of course, sha256 should be replaced with the relevant hash shown in the output error after building -- in this case:

sha256 = "sha256-VBnIzisg/7Xetd/AWVHlnaWXlxX+wqeYTpstO6+T5cE=";

picom-next

Note that there is also a picom-next package so one can alternatively do:

let
  picom_overlay = (self: super: {
    picom = super.picom.overrideAttrs (oldAttrs: rec {
      inherit (super.picom-next) pname version src;
    });
  });
in
  nixpkgs.overlays = [ picom_overlay ];

Or more simply with @RobertHensing's suggestion:

services.picom.package = pkgs.picom-next;
Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135