parent
99b75f99df
commit
6dc68b1d16
|
@ -193,6 +193,21 @@ let
|
|||
else
|
||||
"") + "\n" + cfg.extraConfig);
|
||||
|
||||
# Validates the i3 configuration
|
||||
checkI3Config =
|
||||
pkgs.runCommandLocal "i3-config" { buildInputs = [ cfg.package ]; } ''
|
||||
# We have to make sure the wrapper does not start a dbus session
|
||||
export DBUS_SESSION_BUS_ADDRESS=1
|
||||
|
||||
# A zero exit code means i3 succesfully validated the configuration
|
||||
i3 -c ${configFile} -C -d all || {
|
||||
echo "i3 configuration validation failed"
|
||||
echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'"
|
||||
exit 1
|
||||
};
|
||||
cp ${configFile} $out
|
||||
'';
|
||||
|
||||
in {
|
||||
options = {
|
||||
xsession.windowManager.i3 = {
|
||||
|
@ -229,7 +244,7 @@ in {
|
|||
home.packages = [ cfg.package ];
|
||||
xsession.windowManager.command = "${cfg.package}/bin/i3";
|
||||
xdg.configFile."i3/config" = {
|
||||
source = configFile;
|
||||
source = checkI3Config;
|
||||
onChange = ''
|
||||
i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
|
||||
if [ -S $i3Socket ]; then
|
||||
|
|
|
@ -14,7 +14,9 @@ with lib;
|
|||
(self: super: {
|
||||
dmenu = super.dmenu // { outPath = "@dmenu@"; };
|
||||
|
||||
i3 = super.i3 // { outPath = "@i3@"; };
|
||||
i3 = super.writeScriptBin "i3" "" // { outPath = "@i3@"; };
|
||||
|
||||
i3-gaps = super.writeScriptBin "i3" "" // { outPath = "@i3-gaps@"; };
|
||||
|
||||
i3status = super.i3status // { outPath = "@i3status@"; };
|
||||
})
|
||||
|
|
|
@ -19,9 +19,10 @@ with lib;
|
|||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
dmenu = super.dmenu // { outPath = "@dmenu@"; };
|
||||
|
||||
i3 = super.i3 // { outPath = "@i3@"; };
|
||||
|
||||
i3 = super.writeScriptBin "i3" "" // { outPath = "@i3@"; };
|
||||
i3-gaps = super.writeScriptBin "i3-gaps" "" // {
|
||||
outPath = "@i3-gaps@";
|
||||
};
|
||||
i3status = super.i3status // { outPath = "@i3status@"; };
|
||||
})
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue