mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
Derp
This commit is contained in:
parent
f64b06a3e0
commit
ce36b58e21
@ -1,7 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (config.security) permissionsWrapperDir;
|
inherit (config.security) run-permissionsWrapperDir permissionsWrapperDir;
|
||||||
|
|
||||||
isNotNull = v: if v != null then true else false;
|
isNotNull = v: if v != null then true else false;
|
||||||
|
|
||||||
@ -132,6 +132,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
security.run-permissionsWrapperDir = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/run/permissions-wrapper-dirs";
|
||||||
|
internal = true;
|
||||||
|
description = ''
|
||||||
|
This option defines the run path to the permissions
|
||||||
|
wrappers. It should not be overriden.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -158,8 +168,8 @@ in
|
|||||||
# programs to be wrapped.
|
# programs to be wrapped.
|
||||||
PERMISSIONS_WRAPPER_PATH=${config.system.path}/bin:${config.system.path}/sbin
|
PERMISSIONS_WRAPPER_PATH=${config.system.path}/bin:${config.system.path}/sbin
|
||||||
|
|
||||||
mkdir -p /run/permissions-wrapper-dirs
|
mkdir -p ${run-permissionsWrapperDir}
|
||||||
permissionsWrapperDir=$(mktemp --directory --tmpdir=/run/permissions-wrapper-dirs permissions-wrappers.XXXXXXXXXX)
|
permissionsWrapperDir=$(mktemp --directory --tmpdir=${run-permissionsWrapperDir} permissions-wrappers.XXXXXXXXXX)
|
||||||
chmod a+rx $permissionsWrapperDir
|
chmod a+rx $permissionsWrapperDir
|
||||||
|
|
||||||
${lib.concatMapStrings configureSetcapWrapper (builtins.filter isNotNull cfg.setcap)}
|
${lib.concatMapStrings configureSetcapWrapper (builtins.filter isNotNull cfg.setcap)}
|
||||||
|
@ -12,7 +12,7 @@ let
|
|||||||
source=/nix/var/nix/profiles/default/bin/${program}
|
source=/nix/var/nix/profiles/default/bin/${program}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gcc -Wall -O2 -DWRAPPER_SETCAP=1 -DSOURCE_PROG=\"$source\" -DWRAPPER_DIR=\"${config.security.permissionsWrapperDir}\" \
|
gcc -Wall -O2 -DWRAPPER_SETCAP=1 -DSOURCE_PROG=\"$source\" -DWRAPPER_DIR=\"${cfg.run-permissionsWrapperDir}\" \
|
||||||
-lcap-ng -lcap ${./permissions-wrapper.c} -o $out/bin/${program}.wrapper -L ${pkgs.libcap.lib}/lib -L ${pkgs.libcap_ng}/lib \
|
-lcap-ng -lcap ${./permissions-wrapper.c} -o $out/bin/${program}.wrapper -L ${pkgs.libcap.lib}/lib -L ${pkgs.libcap_ng}/lib \
|
||||||
-I ${pkgs.libcap.dev}/include -I ${pkgs.libcap_ng}/include -I ${pkgs.linuxHeaders}/include
|
-I ${pkgs.libcap.dev}/include -I ${pkgs.libcap_ng}/include -I ${pkgs.linuxHeaders}/include
|
||||||
'';
|
'';
|
||||||
|
@ -12,7 +12,7 @@ let
|
|||||||
source=/nix/var/nix/profiles/default/bin/${program}
|
source=/nix/var/nix/profiles/default/bin/${program}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gcc -Wall -O2 -DWRAPPER_SETUID=1 -DSOURCE_PROG=\"$source\" -DWRAPPER_DIR=\"${config.security.permissionsWrapperDir}\" \
|
gcc -Wall -O2 -DWRAPPER_SETUID=1 -DSOURCE_PROG=\"$source\" -DWRAPPER_DIR=\"${cfg.run-permissionsWrapperDir}\" \
|
||||||
-lcap-ng -lcap ${./permissions-wrapper.c} -o $out/bin/${program}.wrapper -L ${pkgs.libcap.lib}/lib -L ${pkgs.libcap_ng}/lib \
|
-lcap-ng -lcap ${./permissions-wrapper.c} -o $out/bin/${program}.wrapper -L ${pkgs.libcap.lib}/lib -L ${pkgs.libcap_ng}/lib \
|
||||||
-I ${pkgs.libcap.dev}/include -I ${pkgs.libcap_ng}/include -I ${pkgs.linuxHeaders}/include
|
-I ${pkgs.libcap.dev}/include -I ${pkgs.libcap_ng}/include -I ${pkgs.linuxHeaders}/include
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user