lib: improve NixOS-like environment generation

This commit is contained in:
Gabriel Arazas 2024-07-08 13:32:01 +08:00
parent e3122bfd24
commit 9c345c5f4c
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -18,8 +18,7 @@
# set of applications and everything (except for overlapping NixOS services
# that will just add them into the NixOS environment itself).
mkNixoslikeEnvironment = config: args:
pkgs.buildEnv {
inherit (args) paths name;
pkgs.buildEnv (args // {
inherit (config.environment) pathsToLink extraOutputsToInstall;
ignoreCollisions = true;
postBuild =
@ -33,11 +32,12 @@
${config.environment.extraSetup}
'';
};
});
# Given an environment (built with `pkgs.buildEnv`), create a systemd
# environment attrset meant to be used as part of the desktop service.
mkSystemdDesktopEnvironment = env: {
PATH = "${lib.getBin env}\${PATH:+:$PATH}";
XDG_DATA_DIRS = "${env}/share\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}";
XDG_CONFIG_DIRS = "${env}/etc/xdg\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";
};