summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-04-25 17:21:09 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-04-26 21:12:52 +0200
commita1ffabe4de458517e64b091e0aa4664464a36839 (patch)
tree9f081283cfb52e4e8c57b9e5921fc3c9c0814209
parent5d2775156b5fe781895528ffa08513a22822127d (diff)
downloadnixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar.gz
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar.bz2
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar.lz
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar.xz
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.tar.zst
nixpkgs-a1ffabe4de458517e64b091e0aa4664464a36839.zip
nixos/window-managers/i3: write config file to `/etc/i3/config`
The default config of i3 provides a key binding to reload, so changes
take effect immediately:

```
bindsym $mod+Shift+c reload
```

Unfortunately the current module uses the store path of the `configFile`
option. So when I change the config in NixOS, a store path will be
created, but the current i3 process will continue to use the old one,
hence a restart of i3 is required currently.

This change links the config to `/etc/i3/config` and alters the X
startup script accordingly so after each rebuild, the config can be
reloaded.
-rw-r--r--nixos/modules/services/x11/window-managers/i3.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix
index c9b0669e7ba..0ef55d5f2c0 100644
--- a/nixos/modules/services/x11/window-managers/i3.nix
+++ b/nixos/modules/services/x11/window-managers/i3.nix
@@ -60,12 +60,15 @@ in
         ${cfg.extraSessionCommands}
 
         ${cfg.package}/bin/i3 ${optionalString (cfg.configFile != null)
-          "-c \"${cfg.configFile}\""
+          "-c /etc/i3/config"
         } &
         waitPID=$!
       '';
     }];
     environment.systemPackages = [ cfg.package ] ++ cfg.extraPackages;
+    environment.etc."i3/config" = mkIf (cfg.configFile != null) {
+      source = cfg.configFile;
+    };
   };
 
   imports = [