如何在 Nix 中覆盖包源?

Jon*_*han 6 nix

所以我想pkgs.picom用更新的叉子替换我的家庭管理器配置。我怎样才能做到这一点?

我有一种感觉,就像这样:

let newPicom = pkgs.picom.override.src.url = "https://github.com/ibhagwan/picom";  
in 
services.picom.package = newPicom; 
Run Code Online (Sandbox Code Playgroud)

但了解尼克斯实际上可能是一些很长的咒语等等self: super:

Rob*_*ing 8

nixos.wiki 有一个覆盖包源的示例。

您确实需要提供可重现的来源。github 存储库 url 是可变的,因此您需要指定修订版本。

{ 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; 
}
Run Code Online (Sandbox Code Playgroud)