commit c88c54f58f5b31e63cd15e450e381ae9fa6966a1
parent ec7c6b2ef6c4fdc5f2d5ca3252764209fc92acef
Author: Vincent Demeester <vincent@sbr.pm>
Date: Tue, 30 Nov 2021 17:00:24 +0100
systems/modules: define a sway modules…
… preparing the future 😛
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
7 files changed, 118 insertions(+), 2 deletions(-)
diff --git a/systems/hosts/naruhodo.nix b/systems/hosts/naruhodo.nix
@@ -112,6 +112,7 @@ in
profiles = {
externalbuilder.enable = true;
desktop.i3.enable = true;
+ # desktop.sway.enable = true;
laptop.enable = true;
home = true;
dev.enable = true;
diff --git a/systems/modules/profiles/default.nix b/systems/modules/profiles/default.nix
@@ -25,6 +25,7 @@
./scanning.nix
./ssh.nix
./syncthing.nix
+ ./sway.nix
./virtualization.nix
./wireguard.server.nix
./yubikey.nix
diff --git a/systems/modules/profiles/sway.nix b/systems/modules/profiles/sway.nix
@@ -0,0 +1,96 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.profiles.desktop.sway;
+in
+{
+ options = {
+ profiles.desktop.sway = {
+ enable = mkEnableOption "Enable sway desktop profile";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ #profiles = {
+ # desktop.enable = true;
+ #};
+ profiles.avahi.enable = true;
+ profiles.printing.enable = true;
+ profiles.pulseaudio.enable = true;
+ profiles.scanning.enable = true;
+ profiles.syncthing.enable = true;
+
+ hardware.bluetooth.enable = true;
+
+ networking.networkmanager = {
+ enable = true;
+ unmanaged = [
+ "interface-name:br-*"
+ "interface-name:ve-*"
+ "interface-name:veth*"
+ "interface-name:wg0"
+ "interface-name:docker0"
+ "interface-name:virbr*"
+ ]; # FIXME: add unmanaged depending on profiles (wg0, docker0, …)
+ packages = with pkgs; [ networkmanager-openvpn ];
+ };
+
+ # configuring sway itself (assmung a display manager starts it)
+ systemd.user.targets.sway-session = {
+ description = "Sway compositor session";
+ documentation = [ "man:systemd.special(7)" ];
+ bindsTo = [ "graphical-session.target" ];
+ wants = [ "graphical-session-pre.target" ];
+ after = [ "graphical-session-pre.target" ];
+ };
+ programs.sway = {
+ enable = true;
+ wrapperFeatures.gtk = true;
+ extraPackages = with pkgs; [
+ alacritty
+ swaylock
+ swayidle
+ dmenu
+ wofi
+ xwayland
+ mako
+ kanshi
+ grim
+ slurp
+ wl-clipboard
+ wf-recorder
+ ];
+ extraSessionCommands = ''
+ export SDL_VIDEODRIVER=wayland
+ export QT_QPA_PLATFORM=wayland
+ export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
+ export _JAVA_AWT_WM_NONREPARENTING=1
+ export MOZ_ENABLE_WAYLAND=1
+ '';
+ };
+ # configuring kanshi
+ #systemd.user.services.kanshi = {
+ # description = "Kanshi output autoconfig ";
+ # wantedBy = [ "graphical-session.target" ];
+ # partOf = [ "graphical-session.target" ];
+ # environment = { XDG_CONFIG_HOME = "/home/vincent/.config"; };
+ # serviceConfig = {
+ # # kanshi doesn't have an option to specifiy config file yet, so it looks
+ # # at .config/kanshi/config
+ # ExecStart = ''
+ # ${pkgs.kanshi}/bin/kanshi
+ # '';
+ # RestartSec = 5;
+ # Restart = "always";
+ # };
+ #};
+
+ services.xserver.enable = true;
+ services.xserver.displayManager.defaultSession = "sway";
+ services.xserver.layout = "fr";
+ services.xserver.xkbVariant = "bepo";
+ services.xserver.displayManager.sddm.enable = true;
+ services.xserver.libinput.enable = true;
+ };
+}
diff --git a/users/vincent/core/zsh.nix b/users/vincent/core/zsh.nix
@@ -75,6 +75,7 @@ in
alias -s {ape,avi,flv,m4a,mkv,mov,mp3,mp4,mpeg,mpg,ogg,ogm,wav,webm}=mpv
alias -s org=emacs
(( $+commands[jq] )) && alias -g MJ="| jq -C '.'" || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool"
+ (( $+functions[zshz] )) && compdef _zshz j
'';
loginExtra = ''
export GOPATH=${config.home.homeDirectory}
diff --git a/users/vincent/desktop/default.nix b/users/vincent/desktop/default.nix
@@ -9,7 +9,8 @@
./keyboard.nix
./mpv.nix
./spotify.nix
- ] ++ lib.optionals nixosConfig.profiles.desktop.i3.enable [ ./i3.nix ];
+ ] ++ lib.optionals nixosConfig.profiles.desktop.i3.enable [ ./i3.nix ]
+ ++ lib.optionals nixosConfig.profiles.desktop.sway.enable [ ./sway.nix ];
home.sessionVariables = { WEBKIT_DISABLE_COMPOSITING_MODE = 1; };
home.packages = with pkgs; [
diff --git a/users/vincent/desktop/sway.nix b/users/vincent/desktop/sway.nix
@@ -0,0 +1,16 @@
+{ config, nixosConfig, lib, pkgs, ... }:
+
+{
+ wayland.windowManager.sway.enable = true;
+ wayland.windowManager.sway.config = {
+ gaps = {
+ inner = 2;
+ outer = 2;
+ };
+ modifier = "Mod4";
+ };
+ home.packages = with pkgs; [
+ alacritty
+ kitty
+ ];
+}
diff --git a/users/vincent/mails/default.nix b/users/vincent/mails/default.nix
@@ -6,7 +6,7 @@ in
imports = [ ../../modules ];
profiles.mails = {
enable = true;
- sync = true;
+ sync = sync;
};
home.file.".gmailctl/config.jsonnet".source = ./config.jsonnet;
home.file.".gmailctl/gmailctl.jsonnet".source = ./gmailctl.libsonnet;