Hello people, I just started the nix journey 3 weeks ago and right now am trying to get my aged printer/scanner running.
So i picked the packages of the successor from nixpkgs#brscan4 and tried to modify it.
I looks promising so far, but i’ve a lot of files that do not get linked from the store to the corresponding places in /etc and /usr/local/ while /bin/ works.
I do callPackage in an nixpkgs.overlays directive in my nixos/configuration.nix.
So I can’t help myself finding the reason that files do not get their link to the store.
I’ve tried to workaround with environment.etc.“filename”.source and also environment.pathsToLink… all without any success.
Just adding a package to environment.systemPackages doesn’t make its files show up in /etc. That’s what environment.etc is for. You said you’ve tried this; it should have worked. What did you try?
You will want to add the environment directives in a NixOS module, rather than the package. (maybe under programs.brscan4.enable or elsewhere, or you’ll have to patch out the uses of the absolute /etc to be relative to $out somehow if it’s not something that should be configurable).
Lots of debs try to install stuff to /etc, but there is an explicit separation of concerns in NixOS between system modules being able to place stuff in /etc because that’s where /etc is built and the package ending up in the store because that’s where the software goes. Does that make sense?
oh wow, i didnt expect replies that quick - thank you guys! @ElvishJerricco
nixos/configuration.nix (here i got to admit, thats stumbling around, it was already obvious that wouldnt be the place to be… :):
One thing you may also try if you’re after the udev rules is services.udev.packages which could be activated by your hypothetical NixOS module and pick up the rules from your package.
Edit: maybe hardware.sane.extraBackends too. The permission issue may simply be that you’re trying to link something into another derivation that’s already been symlinked into etc. (Maybe check how hardware.sane.brscan4 and brscan5 work too!)
What you did will likely fail to build due to sandboxing, and even if it didn’t, it would result in unpredictably broken systems as these paths change as the configuration and dependencies change.
@ElvishJerricco
→ yeah got it! still i do get with environment.etc configuration.
But is it the path to go along? i couldn*t imagine to clutter up my nixos/config.nix with those details for packaging. I would rather apply environment.etc for i.e. vim configuration
let me know in case my approach is a wrongthinking
ln: failed to create symbolic link '/nix/store/7gl3g28qpxqpni5clp4d88v6wpx0xnnv-etc/etc/sane-config/dll.d/brscan3.conf': Permission denied
error: builder for '/nix/store/1d0vdss0k37c9wjrgx2nwdcc6byij3bh-etc.drv' failed with exit code 1
edit: oooh i shall put that into the package expression itself, shall I?
@numinit i dont need the udev stuff, since i dont use the usb bits. thanks for the headsup though!
i checked in with brscan4 how it does stuff and i also included the modules from config.hardware.sane. to my brscan3 config. That part is working since I dont need my package in env.systemPackages anymore.
Hence my hardware.sane.brscan3.enable pulls that on its own.
I do some progress but still files do not get linked to /etc as I would expect it to. and now comes the twist:
@all brscan4 is actually also a broken package in the same way as my own package. it fails the same way as my own does, so brscan4 is nowadays disfunctional.
shell: brsaneconfig4 -q
sh: line 1: /opt/brother/scanner/brscan4/brscan_cnetconfig: No such file or directory
i gotta quit for today working on this stuff, but i am dedicated to get it working
Question: do you maybe have some readups on how nix does /etc different than i would expect from other distros? i found there is /etc/sane-config and /etc/static - both directories that wouldnt be there on any other distro i know about.
@numinit:
i just meant to say, the brscan4 package for reference to my own pkg is not 100% helpful since its broken its own way
i gotta crush that task, just a matter of time.