I am trying to package the driver for my printer (Brother DCP2520DW) to upstream it after testing it but after adding it by following the steps given in the wiki as such :
let
my_printer = pkgs.callPackage ../../pkgs/printer/dcp2520dw.nix {};
in
# ... [ non relevant part of the configuration ]
services.printing = {
enable = true;
drivers =
[ my_printer # Enable my Brother DCP2520DW configuration
];
};
Could you show us the tree of your build (tree ./result)? Maybe there’s a problem with the file’s layout which makes services.printing.drivers not include it in your /etc/cups or whatever…
So actually, the mystery deepens :
I figured that if I wanted the driver to work at least with CUPS, I would have to use the CUPS wrapper (whose the source is included in the spoiler at the end of this post) but when building I do not get the same files (cf log down) as when I do with the same URL ! I am baffled at that and trying to make sense of that now… Of course I am doing something dumb but I do not see what.
Log from the build
building '/nix/store/42wnj5ly9capmw46c75m9x1w0gqppipg-dcpl2520dwcupswrapper-3.2.0-1.drv'...
unpacking sources
./
./usr/
./usr/share/
./usr/share/doc/
./opt/
./opt/brother/
./opt/brother/Printers/
./opt/brother/Printers/BrGenML1/
./opt/brother/Printers/BrGenML1/cupswrapper/
./opt/brother/Printers/BrGenML1/cupswrapper/brother-BrGenML1-cups-en.ppd
./opt/brother/Printers/BrGenML1/cupswrapper/brother_lpdwrapper_BrGenML1
./opt/brother/Printers/BrGenML1/cupswrapper/paperconfigml1
patching sources
substitute(): ERROR: file 'opt/brother/Printers/DCPL2520DW/cupswrapper/brother_lpdwrapper_DCPL2520DW' does not exist
I am really talking about the same source file (check both "src" from the first and "path" from the second).
The hash from the derivation of the source is not the same as the one given in the script posted above (quoted below)
Why am I seeing those discrepancies ? Am I making the wrong assumptions about the hash of derivations and their sources ?
This would explain why the extracted source is the not the same as the one I am seeing by doing it downloading and extracting manually… but does not tell me how to package the drivers for NixOS…
Yes, it’s a fixed output derivation.
So the store hash doesn’t depend on the inputs, it merely depends on the hash that you gave.
The advantage is, that we can get the same output in multiple different ways.
In your case the URL was already downloaded and cached, so nix assumes it’s the same for the other URL, where the output hash is the same.