I know that I can use environment.etc to declaratively add files to /etc. How would I declaratively add files to /usr/local/etc? Is there a way to configure GNU Rush without adding files to /usr/local/etc?
That answer was helpful, but unfortunately it didn’t work:
$ cat /usr/local/etc/rush.rc
rush 2.0
rule test-rule
match $command == "echo hi"
$ # These two commands work as expected:
$ rush --test /usr/local/etc/rush.rc -c 'echo hi'; echo "$?"
0
$ rush --test /usr/local/etc/rush.rc -c 'echo bye'; echo "$?"
rush: Error: no matching rule for "echo bye", user jayman
1
$ # These don’t:
$ rush -c 'echo hi'; echo "$?"
You are not permitted to execute this command.
Contact the systems administrator for further assistance.
1
$ rush -c 'echo bye'; echo "$?"
You are not permitted to execute this command.
Contact the systems administrator for further assistance.
1
I noticed that man rush.rc says “[t]he file /etc/rush.rc contains a set of rules that[…]” I tried putting an identical config file in /etc/rush.rc, but I got the same results.
Here’s what I ended up doing:
environment.etc."rush.rc".text = "whatever";
environment.systemPackages = let
customRushPkg = pkgs.rush.overrideAttrs (previousAttrs: {
configureFlags = [ "--sysconfdir=/etc" ];
# Prevent “make install” from trying to copy something to /etc/rush.rc:
installFlags = [ "sysconfdir=$(out)" ];
});
in [
customRushPkg
];
I still feel like I’m missing something, though. GNU Rush has been in nixpkgs since 2010. I would think that there would be a better way to configure it at this point.
Consider upstreaming that change to the package, and/or writing a module for it. I can see this being a packaging bug that simply nobody has cared to fix for the last 12 years.