Nixpkgs/Patching Nixpkgs: Difference between revisions
m fix indent of example code |
Add more versatile way of using applyPatches. |
||
| Line 28: | Line 28: | ||
redirect to https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/344917.patch. We can use the latter. | redirect to https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/344917.patch. We can use the latter. | ||
< | <syntaxhighlight lang="nix"> | ||
let | let | ||
nixpkgs-unstable' = | |||
(import nixpkgs-unstable { | ((import nixpkgs-unstable { | ||
system = "x86_64-linux"; | system = "x86_64-linux"; | ||
}).applyPatches | }).applyPatches | ||
| Line 43: | Line 43: | ||
}) | }) | ||
]; | ]; | ||
}; | }).src; | ||
pkgs-unstable = import | patched-lib = nixpkgs-unstable'.lib; | ||
pkgs-unstable = import nixpkgs-unstable' { | |||
system = "x86_64-linux"; | system = "x86_64-linux"; | ||
}; | }; | ||
# ... | # ... | ||
</ | </syntaxhighlight> | ||
In the above example we create a derivation with the patch applied, called <code> | In the above example we create a derivation with the patch applied, called <code>nixpkgs-unstable'</code>. Pay attention we take the <code>src</code> attribute to get back the top-level nixpkgs. We can then access <code>lib</code> functions normally. We then import that new | ||
derivation which we assign to <code>pkgs-unstable</code>. Now we can use <code>pkgs-unstable</code> to access the | derivation which we assign to <code>pkgs-unstable</code>. Now we can use <code>pkgs-unstable</code> to access the | ||
Ghidra 11.2 package, as well as any other packages normally available in nixpkgs. | Ghidra 11.2 package, as well as any other packages normally available in nixpkgs. | ||