2017-10-18 00:12:57 +00:00
|
|
|
{
|
|
|
|
|
2023-08-13 19:34:14 +00:00
|
|
|
config,
|
|
|
|
|
2017-10-18 00:12:57 +00:00
|
|
|
}: rec {
|
|
|
|
|
2023-08-13 19:34:14 +00:00
|
|
|
pkgs = (import ../pkgs.nix).stable {};
|
|
|
|
pkgs2305 = (import ../pkgs.nix).stable2305 {};
|
|
|
|
|
2023-12-27 17:37:54 +00:00
|
|
|
xorgInnerEnv = pkgs.buildEnv {
|
|
|
|
name = "xorg-inner-env";
|
|
|
|
paths = [
|
|
|
|
pkgs.xorg.xorgserver
|
|
|
|
|
|
|
|
(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
|
|
|
|
'')
|
2024-01-06 14:43:21 +00:00
|
|
|
] ++ (
|
|
|
|
config.awesome.xorgInputDrivers pkgs
|
|
|
|
);
|
2023-12-27 17:37:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
xorgConf = pkgs.runCommand "xorg-conf" {} ''
|
|
|
|
cat >>"$out" <<EOF
|
|
|
|
Section "Files"
|
|
|
|
ModulePath "${xorgInnerEnv}/lib/xorg/modules"
|
|
|
|
EndSection
|
|
|
|
|
2024-01-06 14:43:21 +00:00
|
|
|
${config.awesome.xorgConfExtra}
|
2023-12-27 17:37:54 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
for f in $(ls ${xorgInnerEnv}/share/X11/xorg.conf.d | sort); do
|
|
|
|
cat ${xorgInnerEnv}/share/X11/xorg.conf.d/"$f" >> "$out"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-08-13 19:34:14 +00:00
|
|
|
# nativeWrap is used for apps which are not installed via nix which don't play
|
|
|
|
# nicely with it.
|
|
|
|
nativeWrap = pkgs.writeScriptBin "native-wrap" ''
|
|
|
|
#!${pkgs.bash}/bin/bash
|
|
|
|
|
|
|
|
unset XDG_CONFIG_DIRS
|
|
|
|
unset XDG_DATA_DIRS
|
|
|
|
unset GDK_PIXBUF_MODULE_FILE
|
|
|
|
|
|
|
|
exec "$@"
|
|
|
|
'';
|
|
|
|
|
2017-10-18 00:12:57 +00:00
|
|
|
wp = ../wallpapers;
|
|
|
|
|
|
|
|
dirsLua = pkgs.writeTextDir "dirs.lua" ''
|
|
|
|
home_dir = os.getenv("HOME").."/"
|
2023-08-13 19:34:14 +00:00
|
|
|
bin_dir = "${./bin}/"
|
|
|
|
share_dir = "${./share}/"
|
2017-10-18 00:12:57 +00:00
|
|
|
wp_dir = "${wp}/"
|
|
|
|
'';
|
|
|
|
|
2024-01-06 12:06:41 +00:00
|
|
|
# awesomeInner is what is started up by startx, within an X session.
|
|
|
|
awesomeInner = pkgs.writeScript "awesome" ''
|
2017-10-18 00:12:57 +00:00
|
|
|
#!${pkgs.bash}/bin/bash
|
2021-10-04 20:27:19 +00:00
|
|
|
|
2023-12-16 17:28:36 +00:00
|
|
|
set -e -x
|
|
|
|
|
2023-08-13 19:34:14 +00:00
|
|
|
# Turn off powersaving (fuck the environment)
|
2024-01-06 12:06:41 +00:00
|
|
|
${pkgs.xorg.xset}/bin/xset -dpms
|
|
|
|
${pkgs.xorg.xset}/bin/xset s off
|
2023-08-13 19:34:14 +00:00
|
|
|
|
|
|
|
${config.awesome.startupExtra}
|
|
|
|
|
|
|
|
# HACK: This sleep is here because phwmon actually creates a separate tray
|
|
|
|
# icon for each thing it monitors, and if the process runs at the same time
|
|
|
|
# as another process which creates a tray icon they can get interleaved.
|
|
|
|
(sleep 5 && phwmon.py) &
|
2021-10-04 20:27:19 +00:00
|
|
|
|
2023-08-13 19:34:14 +00:00
|
|
|
############################################################################
|
|
|
|
# Init awesome
|
|
|
|
|
|
|
|
data_dir="$HOME/.local/share/awesome";
|
2023-12-16 17:28:36 +00:00
|
|
|
mkdir -p "$data_dir"
|
2023-08-13 19:34:14 +00:00
|
|
|
|
|
|
|
log_dir="$data_dir"/logs
|
|
|
|
mkdir -p $log_dir
|
|
|
|
|
|
|
|
# only keep last N awesome.log files
|
|
|
|
ls "$log_dir" | sort -n | head -n -5 | while read f; do rm "$log_dir"/"$f"; done
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
# Exec
|
|
|
|
|
|
|
|
this_log=$log_dir/awesome.$(date '+%Y%m%d.%H%M%S').log
|
|
|
|
|
|
|
|
echo "New awesome session starting" > $this_log
|
|
|
|
|
2024-01-06 11:27:30 +00:00
|
|
|
exec ${pkgs.awesome}/bin/awesome \
|
2023-08-13 19:34:14 +00:00
|
|
|
-c ${./rc.lua} \
|
2017-10-18 00:12:57 +00:00
|
|
|
--search ${dirsLua} \
|
2023-08-13 19:34:14 +00:00
|
|
|
--search ${./share} \
|
2024-01-06 11:27:30 +00:00
|
|
|
--search ${pkgs.awesome}/share/awesome/themes \
|
2023-08-13 19:34:14 +00:00
|
|
|
2>&1 2>>$this_log
|
2017-10-18 00:12:57 +00:00
|
|
|
'';
|
2024-01-06 11:27:30 +00:00
|
|
|
|
2024-01-06 12:06:41 +00:00
|
|
|
awesome = pkgs.writeShellScriptBin "awesome" ''
|
|
|
|
export XORGCONFIG=${xorgConf}
|
|
|
|
exec startx ${awesomeInner}
|
|
|
|
'';
|
|
|
|
|
2024-01-06 11:27:30 +00:00
|
|
|
env = pkgs.buildEnv {
|
|
|
|
name = "awesome-env";
|
|
|
|
paths = [
|
|
|
|
pkgs.tela-icon-theme
|
|
|
|
|
|
|
|
# We only include utilities in here which are directly used by awesome.
|
|
|
|
# General purpose applications go in the root default.nix env.
|
2024-01-06 12:06:41 +00:00
|
|
|
pkgs.xorg.xinit
|
2024-01-06 11:27:30 +00:00
|
|
|
pkgs.scrot
|
|
|
|
pkgs.feh
|
|
|
|
pkgs.brightnessctl
|
|
|
|
pkgs.cbatticon
|
|
|
|
pkgs.phwmon
|
|
|
|
|
|
|
|
xorgInnerEnv
|
|
|
|
nativeWrap
|
|
|
|
awesome
|
|
|
|
];
|
|
|
|
};
|
2017-10-18 00:12:57 +00:00
|
|
|
}
|