added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 236b8c2a6b
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,37 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.strings) optionalString concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
sessionPath = optionalString (config.home.sessionPath != []) ''
export PATH=${concatStringsSep ":" config.home.sessionPath}:$PATH
'';
sessionVariables = concatStringsSep "\n" (mapAttrsToList (key: value: ''
export ${key}="${toString value}"
'')
config.home.sessionVariables);
apply-hm-env = pkgs.writeShellScript "apply-hm-env" ''
${sessionPath}
${sessionVariables}
${config.home.sessionVariablesExtra}
exec "$@"
'';
# runs processes as systemd transient services
run-as-service = pkgs.writeShellScriptBin "run-as-service" ''
exec ${pkgs.systemd}/bin/systemd-run \
--slice=app-manual.slice \
--property=ExitType=cgroup \
--user \
--wait \
bash -lc "exec ${apply-hm-env} $@"
'';
in {
home.packages = [run-as-service];
}