I would like to install the driver for my Brother MFC-J995DW printer/scanner. I see that there are many packages for different models of Brother printers in nixpkgs, but not this one. The other packages all look very similar, so it should not be hard to adapt one of them for this model, but I am unsure how to proceed. It would probably take an experienced person 5 minutes, but I am not an experienced person in this regard, so I could use some help if anyone is willing to assist me with this process. Thanks.
I think you’re asking for help on adding this to nixpkgs. If that’s the case here’s how I’d approach it:
Find a similar driver: NixOS Search - Loading...
Click the “Source” link on the driver you chose, pay attention to the path, for example pkgs/misc/cups/drivers/hl1110/default.nix
.
Get nixpkgs locally:
git clone git@github.com:NixOS/nixpkgs.git
cd nixpkgs
Make a new folder for your new driver in the same location as the previous driver:
mkdir pkgs/misc/cups/drivers/mfcj995dw
Copy the existing driver’s nix file to the folder you just created:
cp pkgs/misc/cups/drivers/hl1110/default.nix pkgs/misc/cups/drivers/mfcj995dw
Add the new package to pkgs/top-level/all-packages.nix
, search in the file for the existing driver name to see how it’s done and where to place it.
Now edit the values in your new driver package at pkgs/misc/cups/drivers/mfcj995dw/default.nix
. When you’re ready to try building, run nix-build -A cups-brother-mfcj995dw
and see what you get.
I’ve never added a printer driver and this is just a rough approximation off the top of my head, but it’s about what I do when adding something.
Hi @autin. Thanks for the instructions. It’s very helpful, and seems pretty straightforward (except for the part about actually modifying the previous driver, but nonetheless). Just out of curiosity, when I clone nixpkgs, how much disk space is that going to take?
Looks like about 1.45 GB.
Forgot to mention, you should probably fork the nixpkgs repo first, then clone your fork. Then when you’re ready you can create a pull request on the main nixpkgs repo.
Ouch! That’s what I was afraid of. I guess there is no way to download just the minimum parts I need? It needs to be the whole thing?
Haven’t tried it myself, but you could try a shallow clone:
git clone -b master git@github.com:NixOS/nixpkgs.git --depth=1
Replace NixOS
there with your own GitHub username (assuming you’ve forked the repo at this point).
Some background on this: Get up to speed with partial clone and shallow clone | The GitHub Blog
Definitely much smaller at least:
❯ git clone -b master git@github.com:NixOS/nixpkgs.git --depth=1
Cloning into 'nixpkgs'...
remote: Enumerating objects: 42377, done.
remote: Counting objects: 100% (42377/42377), done.
remote: Compressing objects: 100% (28059/28059), done.
remote: Total 42377 (delta 1135), reused 32296 (delta 799), pack-reused 0
Receiving objects: 100% (42377/42377), 27.19 MiB | 3.59 MiB/s, done.
Resolving deltas: 100% (1135/1135), done.
Updating files: 100% (25704/25704), done.
/tmp on took 20s at 15:46:37
❯ dua nixpkgs
194.19 MB nixpkgs