Skip to content

Commit

Permalink
review (SuperSandro2000): src + buildPhase
Browse files Browse the repository at this point in the history
* get rid of unnecessary `src` definition
* build wrapper lib in `buildPhase` instead of `postPatch`
  • Loading branch information
pitkling committed Dec 16, 2024
1 parent a792706 commit 9cdc4c3
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let
pname = "${espanso.pname}-capdacoverride";

wrapperLibName = "wrapper-lib.so";
wrapperLibSource = "wrapper-lib.c";

# On Wayland, Espanso requires the DAC_OVERRIDE capability. One can create a wrapper binary with this
# capability using the `config.security.wrappers.<name>` framework. However, this is not enough: the
Expand All @@ -20,15 +19,16 @@ let
wrapperLib = stdenv.mkDerivation {
name = "${pname}-${version}-wrapper-lib";

src = builtins.path {
name = "${pname}-${version}-wrapper-lib-source";
path = ./.;
filter = path: type: baseNameOf path == wrapperLibSource;
};
dontUnpack = true;

postPatch = ''
substitute ${wrapperLibSource} lib.c --subst-var-by to "${capDacOverrideWrapperDir}/espanso-wayland"
substitute ${./wrapper-lib.c} lib.c --subst-var-by to "${capDacOverrideWrapperDir}/espanso-wayland"
'';

buildPhase = ''
runHook preBuild
cc -fPIC -shared lib.c -o ${wrapperLibName}
runHook postBuild
'';

installPhase = ''
Expand Down

0 comments on commit 9cdc4c3

Please sign in to comment.