Jump to content

Overlays: Difference between revisions

761 bytes added ,  15 September 2021
add rust example
imported>Artturin
(better scope example)
imported>Artturin
(add rust example)
Line 120: Line 120:
   nix.nixPath =
   nix.nixPath =
     # Prepend default nixPath values.
     # Prepend default nixPath values.
     options.nix.nixPath.default ++  
     options.nix.nixPath.default ++
     # Append our nixpkgs-overlays.
     # Append our nixpkgs-overlays.
     [ "nixpkgs-overlays=/etc/nixos/overlays-compat/" ]
     [ "nixpkgs-overlays=/etc/nixos/overlays-compat/" ]
Line 184: Line 184:
         sha256 = "07sx98d422589gxr8wflfpkdd0k44kbagxl3b51i56ky2wfix7rc";
         sha256 = "07sx98d422589gxr8wflfpkdd0k44kbagxl3b51i56ky2wfix7rc";
       })
       })
       # alternatively if you have a local patch,  
       # alternatively if you have a local patch,
       /path/to/file.patch
       /path/to/file.patch
       # or a relative path (relative to the current nix file)
       # or a relative path (relative to the current nix file)
Line 198: Line 198:
self: super:
self: super:
{
{
   pass = super.pass.override { x11Support = false; };  
   pass = super.pass.override { x11Support = false; };
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 326: Line 326:
</syntaxhighlight>
</syntaxhighlight>


=== Rust packages ===
Due to https://github.com/NixOS/nixpkgs/issues/107070
it is not possible to just override <code>cargoSha256</code>, instead cargoDeps has to be overriden
<syntaxhighlight lang="nix">
self: super: {
  rnix-lsp = super.rnix-lsp.overrideAttrs (oldAttrs: rec {
    version = "master";
 
    src = super.fetchFromGitHub {
      owner = "nix-community";
      repo = "rnix-lsp";
      rev = "1fdd7cf9bf56b8ad2dddcfd27354dae8aef2b453";
      sha256 = "sha256-w0hpyFXxltmOpbBKNQ2tfKRWELQzStc/ho1EcNyYaWc=";
    };
 
    cargoDeps = oldAttrs.cargoDeps.overrideAttrs (lib.const {
      name = "rnix-lsp-vendor.tar.gz";
      inherit src;
      outputHash = "sha256-6ZaaWYajmgPXQ5sbeRQWzsbaf0Re3F7mTPOU3xqY02g=";
    });
  });
}
</syntaxhighlight>


==== References ====
==== References ====
Anonymous user