commit 609ffc65ac5591af11f976edb044c64f74d53e06
parent eb1f481d0e26ad43af98b70699f34572f9ba7ace
Author: Vincent Demeester <vincent@sbr.pm>
Date: Fri, 19 Aug 2022 16:43:06 +0200
systems/wakasu: configure sway and wakasu
Lot's of stuff going on there :D
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
6 files changed, 178 insertions(+), 17 deletions(-)
diff --git a/systems/hosts/wakasu.nix b/systems/hosts/wakasu.nix
@@ -82,13 +82,20 @@ in
};
};
+ # TODO Migrate to modules
profiles.ssh.enable = true;
+ profiles.home = true;
+ profiles.avahi.enable = true;
+ profiles.syncthing.enable = true;
+
environment.systemPackages = with pkgs; [
docker-client
];
services = {
+ # automatic login is "safe" as we ask for the encryption passphrase anyway..
+ getty.autologinUser = "vincent";
wireguard = {
enable = true;
ips = [ "${metadata.hosts.wakasu.wireguard.addrs.v4}/24" ];
diff --git a/systems/modules/desktop/sway.nix b/systems/modules/desktop/sway.nix
@@ -12,6 +12,28 @@ in
config = mkIf cfg.enable {
# Enable wayland desktop modules if not already
modules.desktop.wayland.enable = true;
+
+ xdg = {
+ portal = {
+ enable = true;
+ extraPortals = with pkgs; [
+ xdg-desktop-portal-wlr
+ xdg-desktop-portal-gtk
+ ];
+ };
+ };
+
+ # Allow swaylock to unlock the computer for us
+ security.pam.services.swaylock = {
+ text = "auth include login";
+ };
+
+ # FIXME are those needed
+ programs.dconf.enable = true;
+ services.dbus = {
+ enable = true;
+ packages = [ pkgs.dconf ];
+ };
};
}
diff --git a/users/vincent/core/zsh.nix b/users/vincent/core/zsh.nix
@@ -80,6 +80,9 @@ in
'';
loginExtra = ''
# export GOPATH=${config.home.homeDirectory}
+ if [[ -z $DISPLAY && $TTY = /dev/tty1 ]]; then
+ exec sway
+ fi
'';
profileExtra = ''
if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi
diff --git a/users/vincent/default.nix b/users/vincent/default.nix
@@ -74,6 +74,7 @@ in
++ optionals config.modules.editors.emacs.enable [
(import ./dev/emacs.nix)
]
+ ++ optionals config.modules.desktop.enable [ (import ./desktop) ]
++ optionals config.profiles.dev.enable [
(import ./dev)
(import ./containers)
@@ -86,8 +87,6 @@ in
}
]
++ optionals config.profiles.desktop.enable [ (import ./desktop) ]
- ++ optionals config.profiles.desktop.gnome.enable [ (import ./desktop/gnome.nix) ]
- # ++ optionals config.profiles.desktop.i3.enable [ (import ./desktop/i3.nix) ]
++ optionals (config.networking.hostName == "wakasu") [
{
home.packages = with pkgs; [
@@ -102,9 +101,9 @@ in
home.packages = with pkgs; [ docker docker-compose dive ];
}
]
- ++ optionals config.profiles.redhat.enable [{
- home.file.".local/share/applications/redhat-vpn.desktop".source = ./redhat/redhat-vpn.desktop;
- home.packages = with pkgs; [ gnome3.zenity oathToolkit ];
- }]
+ #++ optionals config.profiles.redhat.enable [{
+ # home.file.".local/share/applications/redhat-vpn.desktop".source = ./redhat/redhat-vpn.desktop;
+ # home.packages = with pkgs; [ gnome3.zenity oathToolkit ];
+ #}]
);
}
diff --git a/users/vincent/desktop/default.nix b/users/vincent/desktop/default.nix
@@ -1,5 +1,8 @@
{ config, lib, pkgs, nixosConfig, ... }:
+let
+ inherit (lib) optionals;
+in
{
imports = [
# autorandr
@@ -9,8 +12,11 @@
./keyboard.nix
./mpv.nix
./spotify.nix
- ] ++ lib.optionals nixosConfig.profiles.desktop.i3.enable [ ./i3.nix ]
- ++ lib.optionals nixosConfig.profiles.desktop.sway.enable [ ./sway.nix ];
+ ]
+ ++ optionals nixosConfig.modules.desktop.xorg.enable [ ./xorg.nix ]
+ ++ optionals nixosConfig.profiles.desktop.i3.enable [ ./i3.nix ./xorg.nix ]
+ ++ optionals nixosConfig.modules.desktop.wayland.sway.enable [ ./sway.nix ]
+ ++ optionals nixosConfig.profiles.desktop.gnome.enable [ (import ./gnome.nix) ];
home.sessionVariables = { WEBKIT_DISABLE_COMPOSITING_MODE = 1; };
home.packages = with pkgs; [
@@ -37,10 +43,7 @@
thunderbird
];
- programs.autorandr.enable = nixosConfig.profiles.laptop.enable;
-
home.file.".XCompose".source = ./xorg/XCompose;
- # home.file.".Xmodmap".source = ./xorg/Xmodmap;
xdg.configFile."xorg/emoji.compose".source = ./xorg/emoji.compose;
xdg.configFile."xorg/parens.compose".source = ./xorg/parens.compose;
xdg.configFile."xorg/modletters.compose".source = ./xorg/modletters.compose;
diff --git a/users/vincent/desktop/sway.nix b/users/vincent/desktop/sway.nix
@@ -1,16 +1,143 @@
{ config, nixosConfig, lib, pkgs, ... }:
+let
+ emacs-in-folder = pkgs.writeScript "emacs-in-folder" ''
+ #!/usr/bin/env bash
+ fd . -d 3 --type d ~/src | ${pkgs.wofi}/bin/wofi -dmenu | xargs -I {} zsh -i -c "cd {}; emacs ."
+ '';
+in
{
- wayland.windowManager.sway.enable = true;
- wayland.windowManager.sway.config = {
- gaps = {
- inner = 2;
- outer = 2;
+ wayland.windowManager.sway = {
+ enable = true;
+ wrapperFeatures.gtk = true;
+ systemdIntegration = true;
+ extraSessionCommands = ''
+ export SDL_VIDEODRIVER=wayland
+ export QT_QPA_PLATFORM=wayland
+ export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
+ export _JAVA_AWT_WM_NONREPARTENTING=1
+ export MOZ_ENABLE_WAYLAND=1
+ '';
+ config = {
+ # left = "c";
+ # down = "t";
+ # up = "s";
+ # right = "r";
+ gaps = {
+ inner = 2;
+ outer = 2;
+ };
+ modifier = "Mod4";
+ terminal = "${pkgs.kitty}/bin/kitty";
+ menu = "${pkgs.wofi}/bin/wofi --show drun -modi 'drun,run,window,ssh'";
+ bindkeysToCode = true;
+ input = {
+ "type:keyboard" = {
+ xkb_layout = "fr";
+ xkb_variant = "bepo";
+ xkb_options = "grp:menu_toggle,grp_led:caps,compose:caps";
+ };
+ };
+ keybindings =
+ let
+ mod = config.wayland.windowManager.sway.config.modifier;
+ inherit (config.wayland.windowManager.sway.config) left down up right menu terminal;
+ in
+ {
+ "${mod}+p" = "exec ${menu}";
+ "${mod}+Return" = "exec ${terminal}";
+
+ "${mod}+Shift+q" = "kill";
+
+ "${mod}+Shift+Return" = "exec emacsclient -c";
+ "${mod}+Control+Return" = "exec emacs";
+ "${mod}+Control+Shift+Return" = "exec ${emacs-in-folder}";
+
+ "${mod}+${left}" = "focus left";
+ "${mod}+${down}" = "focus down";
+ "${mod}+${up}" = "focus up";
+ "${mod}+${right}" = "focus right";
+
+ "${mod}+Left" = "focus left";
+ "${mod}+Down" = "focus down";
+ "${mod}+Up" = "focus up";
+ "${mod}+Right" = "focus right";
+
+ "${mod}+Shift+${left}" = "move left";
+ "${mod}+Shift+${down}" = "move down";
+ "${mod}+Shift+${up}" = "move up";
+ "${mod}+Shift+${right}" = "move right";
+
+ "${mod}+Shift+Left" = "move left";
+ "${mod}+Shift+Down" = "move down";
+ "${mod}+Shift+Up" = "move up";
+ "${mod}+Shift+Right" = "move right";
+
+ "${mod}+b" = "splith";
+ "${mod}+v" = "splitv";
+ "${mod}+f" = "fullscreen toggle";
+ "${mod}+a" = "focus parent";
+
+ "${mod}+s" = "layout stacking";
+ "${mod}+w" = "layout tabbed";
+ "${mod}+e" = "layout toggle split";
+
+ "${mod}+Shift+space" = "floating toggle";
+ "${mod}+space" = "focus mode_toggle";
+
+ "${mod}+Shift+minus" = "move scratchpad";
+ "${mod}+minus" = "scratchpad show";
+
+ "${mod}+Shift+c" = "reload";
+ "${mod}+Shift+e" =
+ "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
+
+ "${mod}+o" = "mode resize";
+ };
};
- modifier = "Mod4";
+ extraConfig =
+ let
+ mod = config.wayland.windowManager.sway.config.modifier;
+ in
+ ''
+ # switch to workspace
+ bindcode ${mod}+10 workspace number 1
+ bindcode ${mod}+11 workspace number 2
+ bindcode ${mod}+12 workspace number 3
+ bindcode ${mod}+13 workspace number 4
+ bindcode ${mod}+14 workspace number 5
+ bindcode ${mod}+15 workspace number 6
+ bindcode ${mod}+16 workspace number 7
+ bindcode ${mod}+17 workspace number 8
+ bindcode ${mod}+18 workspace number 9
+ bindcode ${mod}+19 workspace number 10
+
+ # move focused container to workspace
+ bindcode ${mod}+Shift+10 move container to workspace number 1
+ bindcode ${mod}+Shift+11 move container to workspace number 2
+ bindcode ${mod}+Shift+12 move container to workspace number 3
+ bindcode ${mod}+Shift+13 move container to workspace number 4
+ bindcode ${mod}+Shift+14 move container to workspace number 5
+ bindcode ${mod}+Shift+15 move container to workspace number 6
+ bindcode ${mod}+Shift+16 move container to workspace number 7
+ bindcode ${mod}+Shift+17 move container to workspace number 8
+ bindcode ${mod}+Shift+18 move container to workspace number 9
+ bindcode ${mod}+Shift+19 move container to workspace number 0
+
+ # bindcode ${mod}+25 layout tabbed
+ '';
};
home.packages = with pkgs; [
+ swaylock
+ swayidle
+ wl-clipboard
+ mako
+ wofi
+ waybar
+ # terminals
+ # FIXME move this away, they work on both Xorg and Wayland/Sway
alacritty
kitty
];
}
+