Skip to content

Instantly share code, notes, and snippets.

@timclassic
Created August 20, 2018 03:19
Show Gist options
  • Save timclassic/242e01f1a3768af1b1d3d418a940bff0 to your computer and use it in GitHub Desktop.
Save timclassic/242e01f1a3768af1b1d3d418a940bff0 to your computer and use it in GitHub Desktop.
Dummy setcap(8)
# Various package modifications to work around bugs or lack of
# features in lx-brand. Ideally I will upstream proper fixes for
# all of these.
nixpkgs.config.packageOverrides = pkgs: rec {
# No capability support, so we override the libcap package to
# provide a dummy setcap(8)
libcap = let
setcap-noop = pkgs.writeTextFile {
name = "setcap-noop";
text = ''
#!/bin/sh
echo "WARNING: Treating setcap(8) as a no-op on lx-brand" >/dev/stderr
'';
};
in pkgs.libcap.overrideAttrs (oldAttrs: {
postFixup = ''
mv "$out"/bin/setcap "$out"/bin/setcap.DISABLED
cp ${setcap-noop} "$out"/bin/setcap
chmod a+x "$out"/bin/setcap
'';
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment