loadout/x/default.nix
2023-12-17 18:04:43 +01:00

44 lines
900 B
Nix

{
config,
}: rec {
pkgs = (import ../pkgs.nix).stable {};
innerEnv = pkgs.buildEnv {
name = "x-inner-env";
paths = [
pkgs.xorg.xorgserver
pkgs.xorg.xinit
pkgs.xorg.xauth
pkgs.xorg.xset
pkgs.xorg.xf86inputlibinput
(pkgs.runCommand "xorg-conf-inner" {} ''
mkdir -p "$out"/share/X11/xorg.conf.d/
cp ${./xorg.conf} "$out"/share/X11/xorg.conf.d/99-loadout.conf
'')
];
};
conf = pkgs.runCommand "xorg-conf" {} ''
cat >>"$out" <<EOF
Section "Files"
ModulePath "${innerEnv}/lib/xorg/modules"
EndSection
${config.xorgConfExtra}
EOF
for f in $(ls ${innerEnv}/share/X11/xorg.conf.d | sort); do
cat ${innerEnv}/share/X11/xorg.conf.d/"$f" >> "$out"
done
'';
startx = pkgs.writeShellScriptBin "startx" ''
export XORGCONFIG=${conf}
export PATH=${innerEnv}/bin:$PATH
exec startx
'';
}