{ config, }: rec { pkgs = (import ../pkgs.nix).stable {}; # 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 "$@" ''; wp = ../wallpapers; startupAppsLua = builtins.toString ( builtins.map (a: ''"${a}",'') config.awesome.startupApps ); configLua = pkgs.writeTextDir "config.lua" '' home_dir = os.getenv("HOME").."/" bin_dir = "${./bin}/" share_dir = "${./share}/" wp_dir = "${wp}/" startupApps = { ${startupAppsLua} } ''; # awesomeInner is what is started up by startx, within an X session. awesomeInner = pkgs.writeScript "awesome" '' #!${pkgs.bash}/bin/bash set -e -x # Set during startup of X server, but we don't want it inherited by # everything downstream. unset LD_LIBRARY_PATH # 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. # TODO find a replacement for phwmon #(sleep 5 && phwmon.py) & ############################################################################ # Init awesome data_dir="$HOME/.local/share/awesome"; mkdir -p "$data_dir" 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 exec ${pkgs.awesome}/bin/awesome \ -c ${./rc.lua} \ --search ${configLua} \ --search ${./share} \ --search ${pkgs.awesome}/share/awesome/themes \ 2>&1 2>>$this_log ''; awesome = pkgs.writeShellScriptBin "awesome" '' exec startx ${awesomeInner} ''; 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. pkgs.scrot pkgs.feh pkgs.brightnessctl pkgs.cbatticon #pkgs.phwmon # https://github.com/NixOS/nixpkgs/issues/75478 nativeWrap awesome ]; }; }