How to "suid or sgid slock" outside NixOS?

Hi,

I installed slock with nix-env on Ubuntu, but get “slock: unable to disable OOM killer. Make sure to suid or sgid slock” when trying to run it.

Nixpkgs issue #9656 provides great info and at least two solutions, but those are only applicable for NixOS. From the latest entry from @srid:

security.wrappers.slock.source = "${pkgs.slock.out}/bin/slock";

The suckless-tools apt package has a usable slock, and there are other screen lock solutions, but wondering how one might resolve this outside of NixOS.

Thank you!

Nix itself is not going to provide a solution for this. The permissions of the files in the store should never have those permissions set, and if you have a single user install, they should never be owned by root. You’ll need to copy the binaries out somehow after adding a gc-root.

1 Like

Did you ever find a reasonable workaround? I have the same issue as we use Nixpkgs on CentOS.

Sorry for the delay. No, I haven’t found the solution for this; got too busy with other things, and simply forgot about it, sorry.

I could very much use a solution, too.