diff options
Diffstat (limited to 'home-manager/tests/modules/services')
37 files changed, 1028 insertions, 4 deletions
diff --git a/home-manager/tests/modules/services/dropbox/basic-configuration.nix b/home-manager/tests/modules/services/dropbox/basic-configuration.nix new file mode 100644 index 00000000000..96a17cd7384 --- /dev/null +++ b/home-manager/tests/modules/services/dropbox/basic-configuration.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + config = { + services.dropbox = { + enable = true; + path = "${config.home.homeDirectory}/dropbox"; + }; + + nixpkgs.overlays = [ + (self: super: { + dropbox-cli = pkgs.writeScriptBin "dummy-dropbox-cli" "" // { + outPath = "@dropbox-cli@"; + }; + }) + ]; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/dropbox.service + + assertFileExists $serviceFile + ''; + + }; +} diff --git a/home-manager/tests/modules/services/dropbox/default.nix b/home-manager/tests/modules/services/dropbox/default.nix new file mode 100644 index 00000000000..ad519790355 --- /dev/null +++ b/home-manager/tests/modules/services/dropbox/default.nix @@ -0,0 +1 @@ +{ dropbox-basic-configuration = ./basic-configuration.nix; } diff --git a/home-manager/tests/modules/services/emacs/default.nix b/home-manager/tests/modules/services/emacs/default.nix new file mode 100644 index 00000000000..af27538d99d --- /dev/null +++ b/home-manager/tests/modules/services/emacs/default.nix @@ -0,0 +1,5 @@ +{ + emacs-service = ./emacs-service.nix; + emacs-socket-26 = ./emacs-socket-26.nix; + emacs-socket-27 = ./emacs-socket-27.nix; +} diff --git a/home-manager/tests/modules/services/emacs/emacs-emacsclient.desktop b/home-manager/tests/modules/services/emacs/emacs-emacsclient.desktop new file mode 100644 index 00000000000..ab9849bb6b9 --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-emacsclient.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Exec=@emacs@/bin/emacsclient -c %F +Terminal=false +Name=Emacs Client +Icon=emacs +Comment=Edit text +GenericName=Text Editor +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; +Categories=Utility;TextEditor; +StartupWMClass=Emacs + diff --git a/home-manager/tests/modules/services/emacs/emacs-service-emacs.service b/home-manager/tests/modules/services/emacs/emacs-service-emacs.service new file mode 100644 index 00000000000..d8a618a2671 --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-service-emacs.service @@ -0,0 +1,12 @@ +[Install] +WantedBy=default.target + +[Service] +ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon" +ExecStop=@emacs@/bin/emacsclient --eval '(kill-emacs 0)' +Restart=on-failure + +[Unit] +Description=Emacs: the extensible, self-documenting text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ +X-RestartIfChanged=false diff --git a/home-manager/tests/modules/services/emacs/emacs-service.nix b/home-manager/tests/modules/services/emacs/emacs-service.nix new file mode 100644 index 00000000000..be27e9ab33d --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-service.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nixpkgs.overlays = [ + (self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = _: + makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + }) + ]; + + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + + nmt.script = '' + assertPathNotExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop + + assertFileContent home-files/.config/systemd/user/emacs.service \ + ${ + pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-service-emacs.service; + } + } + assertFileContent home-path/share/applications/emacsclient.desktop \ + ${./emacs-emacsclient.desktop} + ''; + }; +} diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.service b/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.service new file mode 100644 index 00000000000..2d731c7ee1a --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.service @@ -0,0 +1,9 @@ +[Service] +ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon='%T/emacs%U/server'" +ExecStop=@emacs@/bin/emacsclient --eval '(kill-emacs 0)' +Restart=on-failure + +[Unit] +Description=Emacs: the extensible, self-documenting text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ +X-RestartIfChanged=false diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.socket b/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.socket new file mode 100644 index 00000000000..d2fa78e2265 --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-26-emacs.socket @@ -0,0 +1,12 @@ +[Install] +WantedBy=sockets.target + +[Socket] +DirectoryMode=0700 +FileDescriptorName=server +ListenStream=%T/emacs%U/server +SocketMode=0600 + +[Unit] +Description=Emacs: the extensible, self-documenting text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-26.nix b/home-manager/tests/modules/services/emacs/emacs-socket-26.nix new file mode 100644 index 00000000000..65f06159e4c --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-26.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + nixpkgs.overlays = [ + (self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-26.3" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = _: + makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + }) + ]; + + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + services.emacs.socketActivation.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop + + assertFileContent home-files/.config/systemd/user/emacs.socket \ + ${./emacs-socket-26-emacs.socket} + assertFileContent home-files/.config/systemd/user/emacs.service \ + ${ + pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-socket-26-emacs.service; + } + } + assertFileContent home-path/share/applications/emacsclient.desktop \ + ${./emacs-emacsclient.desktop} + ''; + }; +} diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.service b/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.service new file mode 100644 index 00000000000..408a5d24b5c --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.service @@ -0,0 +1,9 @@ +[Service] +ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon='%t/emacs/server'" +ExecStop=@emacs@/bin/emacsclient --eval '(kill-emacs 0)' +Restart=on-failure + +[Unit] +Description=Emacs: the extensible, self-documenting text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ +X-RestartIfChanged=false diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.socket b/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.socket new file mode 100644 index 00000000000..8fa68bf5911 --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-27-emacs.socket @@ -0,0 +1,12 @@ +[Install] +WantedBy=sockets.target + +[Socket] +DirectoryMode=0700 +FileDescriptorName=server +ListenStream=%t/emacs/server +SocketMode=0600 + +[Unit] +Description=Emacs: the extensible, self-documenting text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ diff --git a/home-manager/tests/modules/services/emacs/emacs-socket-27.nix b/home-manager/tests/modules/services/emacs/emacs-socket-27.nix new file mode 100644 index 00000000000..213dedca51c --- /dev/null +++ b/home-manager/tests/modules/services/emacs/emacs-socket-27.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + +in { + config = { + nixpkgs.overlays = [ + (self: super: rec { + emacs = pkgs.writeShellScriptBin "dummy-emacs-27.0.91" "" // { + outPath = "@emacs@"; + }; + emacsPackagesFor = _: + makeScope super.newScope (_: { emacsWithPackages = _: emacs; }); + }) + ]; + + programs.emacs.enable = true; + services.emacs.enable = true; + services.emacs.client.enable = true; + services.emacs.socketActivation.enable = true; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/emacs.socket + assertFileExists home-files/.config/systemd/user/emacs.service + assertFileExists home-path/share/applications/emacsclient.desktop + + assertFileContent home-files/.config/systemd/user/emacs.socket \ + ${./emacs-socket-27-emacs.socket} + assertFileContent home-files/.config/systemd/user/emacs.service \ + ${ + pkgs.substituteAll { + inherit (pkgs) runtimeShell; + src = ./emacs-socket-27-emacs.service; + } + } + assertFileContent home-path/share/applications/emacsclient.desktop \ + ${./emacs-emacsclient.desktop} + ''; + }; +} diff --git a/home-manager/tests/modules/services/fluidsynth/default.nix b/home-manager/tests/modules/services/fluidsynth/default.nix new file mode 100644 index 00000000000..58e9c5dcc33 --- /dev/null +++ b/home-manager/tests/modules/services/fluidsynth/default.nix @@ -0,0 +1 @@ +{ fluidsynth = import ./service.nix; } diff --git a/home-manager/tests/modules/services/fluidsynth/service.nix b/home-manager/tests/modules/services/fluidsynth/service.nix new file mode 100644 index 00000000000..8d53e75c032 --- /dev/null +++ b/home-manager/tests/modules/services/fluidsynth/service.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: { + config = { + services.fluidsynth.enable = true; + services.fluidsynth.soundFont = "/path/to/soundFont"; + services.fluidsynth.extraOptions = [ "--sample-rate 96000" ]; + + nixpkgs.overlays = [ + (self: super: { + fluidsynth = pkgs.writeScriptBin "dummy-fluidsynth" "" // { + outPath = "@fluidsynth@"; + }; + }) + ]; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/fluidsynth.service + + assertFileExists $serviceFile + + assertFileContains $serviceFile \ + 'ExecStart=@fluidsynth@/bin/fluidsynth -a pulseaudio -si --sample-rate 96000 /path/to/soundFont' + ''; + }; +} diff --git a/home-manager/tests/modules/services/kanshi/basic-configuration.conf b/home-manager/tests/modules/services/kanshi/basic-configuration.conf new file mode 100644 index 00000000000..9d6442b985b --- /dev/null +++ b/home-manager/tests/modules/services/kanshi/basic-configuration.conf @@ -0,0 +1,15 @@ +profile desktop { + output "eDP-1" disable + output "Iiyama North America PLE2483H-DP" enable position 0,0 + output "Iiyama North America PLE2483H-DP 1158765348486" enable mode 1920x1080 position 1920,0 scale 2.100000 transform flipped-270 + exec echo "1 two 3" +} + +profile nomad { + output "eDP-1" enable +} + +profile test { + output "*" enable +} + diff --git a/home-manager/tests/modules/services/kanshi/basic-configuration.nix b/home-manager/tests/modules/services/kanshi/basic-configuration.nix new file mode 100644 index 00000000000..15fbbb9ceb1 --- /dev/null +++ b/home-manager/tests/modules/services/kanshi/basic-configuration.nix @@ -0,0 +1,52 @@ +{ config, pkgs, ... }: { + config = { + services.kanshi = { + enable = true; + package = pkgs.writeScriptBin "dummy-kanshi" ""; + profiles = { + nomad = { + outputs = [{ + criteria = "eDP-1"; + status = "enable"; + }]; + }; + desktop = { + exec = ''echo "1 two 3"''; + outputs = [ + { + criteria = "eDP-1"; + status = "disable"; + } + { + criteria = "Iiyama North America PLE2483H-DP"; + status = "enable"; + position = "0,0"; + } + { + criteria = "Iiyama North America PLE2483H-DP 1158765348486"; + status = "enable"; + position = "1920,0"; + scale = 2.1; + mode = "1920x1080"; + transform = "flipped-270"; + } + ]; + }; + }; + extraConfig = '' + profile test { + output "*" enable + } + ''; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/kanshi.service + assertFileExists $serviceFile + + assertFileExists home-files/.config/kanshi/config + assertFileContent home-files/.config/kanshi/config \ + ${./basic-configuration.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/kanshi/default.nix b/home-manager/tests/modules/services/kanshi/default.nix new file mode 100644 index 00000000000..cb6b2a6b79f --- /dev/null +++ b/home-manager/tests/modules/services/kanshi/default.nix @@ -0,0 +1 @@ +{ kanshi-basic-configuration = ./basic-configuration.nix; } diff --git a/home-manager/tests/modules/services/lieer/default.nix b/home-manager/tests/modules/services/lieer/default.nix new file mode 100644 index 00000000000..1d6b435a1ca --- /dev/null +++ b/home-manager/tests/modules/services/lieer/default.nix @@ -0,0 +1 @@ +{ lieer-service = ./lieer-service.nix; } diff --git a/home-manager/tests/modules/services/lieer/lieer-service-expected.service b/home-manager/tests/modules/services/lieer/lieer-service-expected.service new file mode 100644 index 00000000000..1110e85c475 --- /dev/null +++ b/home-manager/tests/modules/services/lieer/lieer-service-expected.service @@ -0,0 +1,8 @@ +[Service] +ExecStart=@lieer@/bin/gmi sync +Type=oneshot +WorkingDirectory=/home/hm-user/Mail/hm@example.com + +[Unit] +ConditionPathExists=/home/hm-user/Mail/hm@example.com/.gmailieer.json +Description=lieer Gmail synchronization for hm@example.com diff --git a/home-manager/tests/modules/services/lieer/lieer-service-expected.timer b/home-manager/tests/modules/services/lieer/lieer-service-expected.timer new file mode 100644 index 00000000000..cb059ea47c4 --- /dev/null +++ b/home-manager/tests/modules/services/lieer/lieer-service-expected.timer @@ -0,0 +1,9 @@ +[Install] +WantedBy=timers.target + +[Timer] +OnCalendar=*:0/5 +RandomizedDelaySec=30 + +[Unit] +Description=lieer Gmail synchronization for hm@example.com diff --git a/home-manager/tests/modules/services/lieer/lieer-service.nix b/home-manager/tests/modules/services/lieer/lieer-service.nix new file mode 100644 index 00000000000..03dcdc749b1 --- /dev/null +++ b/home-manager/tests/modules/services/lieer/lieer-service.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + services.lieer.enable = true; + + accounts.email.accounts = { + "hm@example.com".lieer.enable = true; + "hm@example.com".lieer.sync.enable = true; + }; + + nixpkgs.overlays = [ + (self: super: { + gmailieer = pkgs.writeScriptBin "dummy-gmailieer" "" // { + outPath = "@lieer@"; + }; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service + assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.timer + + assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.service \ + ${./lieer-service-expected.service} + assertFileContent home-files/.config/systemd/user/lieer-hm-example-com.timer \ + ${./lieer-service-expected.timer} + ''; + }; +} diff --git a/home-manager/tests/modules/services/polybar/basic-configuration.conf b/home-manager/tests/modules/services/polybar/basic-configuration.conf new file mode 100644 index 00000000000..54448a705fc --- /dev/null +++ b/home-manager/tests/modules/services/polybar/basic-configuration.conf @@ -0,0 +1,21 @@ +[bar/top] +height=3% +modules-center=date +monitor=${env:MONITOR:eDP1} +radius=0 +width=100% + +[module/date] +date=%d.%m.%y +internal=5 +label=%time% %date% +time=%H:%M +type=internal/date + +[module/date] +type = internal/date +interval = 5 +date = "%d.%m.%y" +time = %H:%M +format-prefix-foreground = ${colors.foreground-alt} +label = %time% %date% diff --git a/home-manager/tests/modules/services/polybar/basic-configuration.nix b/home-manager/tests/modules/services/polybar/basic-configuration.nix new file mode 100644 index 00000000000..a8886dab6d5 --- /dev/null +++ b/home-manager/tests/modules/services/polybar/basic-configuration.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: + +{ + config = { + services.polybar = { + enable = true; + package = pkgs.writeScriptBin "dummy-polybar" ""; + script = "polybar bar &"; + config = { + "bar/top" = { + monitor = "\${env:MONITOR:eDP1}"; + width = "100%"; + height = "3%"; + radius = 0; + modules-center = "date"; + }; + "module/date" = { + type = "internal/date"; + internal = 5; + date = "%d.%m.%y"; + time = "%H:%M"; + label = "%time% %date%"; + }; + }; + extraConfig = '' + [module/date] + type = internal/date + interval = 5 + date = "%d.%m.%y" + time = %H:%M + format-prefix-foreground = ''${colors.foreground-alt} + label = %time% %date% + ''; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/polybar.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf' + assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' + + assertFileExists home-files/.config/polybar/config + assertFileContent home-files/.config/polybar/config \ + ${./basic-configuration.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/polybar/default.nix b/home-manager/tests/modules/services/polybar/default.nix new file mode 100644 index 00000000000..94d5d3cde20 --- /dev/null +++ b/home-manager/tests/modules/services/polybar/default.nix @@ -0,0 +1 @@ +{ polybar-basic-configuration = ./basic-configuration.nix; } diff --git a/home-manager/tests/modules/services/sxhkd/configuration.nix b/home-manager/tests/modules/services/sxhkd/configuration.nix index 992c4b18a94..03206a8d52b 100644 --- a/home-manager/tests/modules/services/sxhkd/configuration.nix +++ b/home-manager/tests/modules/services/sxhkd/configuration.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{ config, pkgs, ... }: { config = { services.sxhkd = { enable = true; @@ -19,8 +19,11 @@ ''; }; + nixpkgs.overlays = + [ (self: super: { sxhkd = pkgs.writeScriptBin "dummy-sxhkd" ""; }) ]; + nmt.script = '' - local sxhkdrc=home-files/.config/sxhkd/sxhkdrc + sxhkdrc=home-files/.config/sxhkd/sxhkdrc assertFileExists $sxhkdrc diff --git a/home-manager/tests/modules/services/sxhkd/service.nix b/home-manager/tests/modules/services/sxhkd/service.nix index 46ce259a718..9b4fd70cc55 100644 --- a/home-manager/tests/modules/services/sxhkd/service.nix +++ b/home-manager/tests/modules/services/sxhkd/service.nix @@ -7,7 +7,7 @@ }; nmt.script = '' - local serviceFile=home-files/.config/systemd/user/sxhkd.service + serviceFile=home-files/.config/systemd/user/sxhkd.service assertFileExists $serviceFile diff --git a/home-manager/tests/modules/services/window-managers/i3/default.nix b/home-manager/tests/modules/services/window-managers/i3/default.nix index e239d6c07f1..c523dfcd04b 100644 --- a/home-manager/tests/modules/services/window-managers/i3/default.nix +++ b/home-manager/tests/modules/services/window-managers/i3/default.nix @@ -1 +1,4 @@ -{ i3-keybindings = ./i3-keybindings.nix; } +{ + i3-followmouse = ./i3-followmouse.nix; + i3-keybindings = ./i3-keybindings.nix; +} diff --git a/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf b/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf new file mode 100644 index 00000000000..729605be469 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf @@ -0,0 +1,105 @@ +font pango:monospace 8 +floating_modifier Mod1 +new_window normal 2 +new_float normal 2 +hide_edge_borders none +force_focus_wrapping no +focus_follows_mouse no +focus_on_window_activation smart +mouse_warping output +workspace_layout default +workspace_auto_back_and_forth no + +client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #222222 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +client.background #ffffff + +bindsym Mod1+0 workspace number 10 +bindsym Mod1+1 workspace number 1 +bindsym Mod1+2 workspace number 2 +bindsym Mod1+3 workspace number 3 +bindsym Mod1+4 workspace number 4 +bindsym Mod1+5 workspace number 5 +bindsym Mod1+6 workspace number 6 +bindsym Mod1+7 workspace number 7 +bindsym Mod1+8 workspace number 8 +bindsym Mod1+9 workspace number 9 +bindsym Mod1+Down focus down +bindsym Mod1+Left focus left +bindsym Mod1+Return exec i3-sensible-terminal +bindsym Mod1+Right focus right +bindsym Mod1+Shift+0 move container to workspace number 10 +bindsym Mod1+Shift+1 move container to workspace number 1 +bindsym Mod1+Shift+2 move container to workspace number 2 +bindsym Mod1+Shift+3 move container to workspace number 3 +bindsym Mod1+Shift+4 move container to workspace number 4 +bindsym Mod1+Shift+5 move container to workspace number 5 +bindsym Mod1+Shift+6 move container to workspace number 6 +bindsym Mod1+Shift+7 move container to workspace number 7 +bindsym Mod1+Shift+8 move container to workspace number 8 +bindsym Mod1+Shift+9 move container to workspace number 9 +bindsym Mod1+Shift+Down move down +bindsym Mod1+Shift+Left move left +bindsym Mod1+Shift+Right move right +bindsym Mod1+Shift+Up move up +bindsym Mod1+Shift+c reload +bindsym Mod1+Shift+e exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit' +bindsym Mod1+Shift+minus move scratchpad +bindsym Mod1+Shift+q kill +bindsym Mod1+Shift+r restart +bindsym Mod1+Shift+space floating toggle +bindsym Mod1+Up focus up +bindsym Mod1+a focus parent +bindsym Mod1+d exec @dmenu@/bin/dmenu_run +bindsym Mod1+e layout toggle split +bindsym Mod1+f fullscreen toggle +bindsym Mod1+h split h +bindsym Mod1+minus scratchpad show +bindsym Mod1+r mode resize +bindsym Mod1+s layout stacking +bindsym Mod1+space focus mode_toggle +bindsym Mod1+v split v +bindsym Mod1+w layout tabbed + +mode "resize" { +bindsym Down resize grow height 10 px or 10 ppt +bindsym Escape mode default +bindsym Left resize shrink width 10 px or 10 ppt +bindsym Return mode default +bindsym Right resize grow width 10 px or 10 ppt +bindsym Up resize shrink height 10 px or 10 ppt +} + + +bar { + + font pango:monospace 8 + mode dock + hidden_state hide + position bottom + status_command @i3status@/bin/i3status + i3bar_command @i3@/bin/i3bar + workspace_buttons yes + strip_workspace_numbers no + tray_output primary + colors { + background #000000 + statusline #ffffff + separator #666666 + focused_workspace #4c7899 #285577 #ffffff + active_workspace #333333 #5f676a #ffffff + inactive_workspace #333333 #222222 #888888 + urgent_workspace #2f343a #900000 #ffffff + binding_mode #2f343a #900000 #ffffff + } + +} + + + + + + diff --git a/home-manager/tests/modules/services/window-managers/i3/i3-followmouse.nix b/home-manager/tests/modules/services/window-managers/i3/i3-followmouse.nix new file mode 100644 index 00000000000..8d51e348877 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/i3/i3-followmouse.nix @@ -0,0 +1,29 @@ +{ config, lib, ... }: + +with lib; + +{ + config = { + xsession.windowManager.i3 = { + enable = true; + + config.focus.followMouse = false; + }; + + nixpkgs.overlays = [ + (self: super: { + dmenu = super.dmenu // { outPath = "@dmenu@"; }; + + i3 = super.i3 // { outPath = "@i3@"; }; + + i3status = super.i3status // { outPath = "@i3status@"; }; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/i3/config + assertFileContent home-files/.config/i3/config \ + ${./i3-followmouse-expected.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/window-managers/sway/default.nix b/home-manager/tests/modules/services/window-managers/sway/default.nix new file mode 100644 index 00000000000..b9c0ab5e099 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/default.nix @@ -0,0 +1,6 @@ +{ + sway-default = ./sway-default.nix; + sway-post-2003 = ./sway-post-2003.nix; + sway-followmouse = ./sway-followmouse.nix; + sway-followmouse-legacy = ./sway-followmouse-legacy.nix; +} diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-default.conf b/home-manager/tests/modules/services/window-managers/sway/sway-default.conf new file mode 100644 index 00000000000..da5b1f47eef --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-default.conf @@ -0,0 +1,117 @@ +font pango:monospace 8 +floating_modifier Mod1 +default_border pixel 2 +default_floating_border pixel 2 +hide_edge_borders none +focus_wrapping no +focus_follows_mouse yes +focus_on_window_activation smart +mouse_warping output +workspace_layout default +workspace_auto_back_and_forth no + +client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #222222 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +client.background #ffffff + +bindsym Mod1+1 workspace number 1 +bindsym Mod1+2 workspace number 2 +bindsym Mod1+3 workspace number 3 +bindsym Mod1+4 workspace number 4 +bindsym Mod1+5 workspace number 5 +bindsym Mod1+6 workspace number 6 +bindsym Mod1+7 workspace number 7 +bindsym Mod1+8 workspace number 8 +bindsym Mod1+9 workspace number 9 +bindsym Mod1+Down focus down +bindsym Mod1+Left focus left +bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Right focus right +bindsym Mod1+Shift+1 move container to workspace number 1 +bindsym Mod1+Shift+2 move container to workspace number 2 +bindsym Mod1+Shift+3 move container to workspace number 3 +bindsym Mod1+Shift+4 move container to workspace number 4 +bindsym Mod1+Shift+5 move container to workspace number 5 +bindsym Mod1+Shift+6 move container to workspace number 6 +bindsym Mod1+Shift+7 move container to workspace number 7 +bindsym Mod1+Shift+8 move container to workspace number 8 +bindsym Mod1+Shift+9 move container to workspace number 9 +bindsym Mod1+Shift+Down move down +bindsym Mod1+Shift+Left move left +bindsym Mod1+Shift+Right move right +bindsym Mod1+Shift+Up move up +bindsym Mod1+Shift+c reload +bindsym Mod1+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' +bindsym Mod1+Shift+h move left +bindsym Mod1+Shift+j move down +bindsym Mod1+Shift+k move up +bindsym Mod1+Shift+l move right +bindsym Mod1+Shift+minus move scratchpad +bindsym Mod1+Shift+q kill +bindsym Mod1+Shift+space floating toggle +bindsym Mod1+Up focus up +bindsym Mod1+a focus parent +bindsym Mod1+b splith +bindsym Mod1+d exec @dmenu@/bin/dmenu_run +bindsym Mod1+e layout toggle split +bindsym Mod1+f fullscreen toggle +bindsym Mod1+h focus left +bindsym Mod1+j focus down +bindsym Mod1+k focus up +bindsym Mod1+l focus right +bindsym Mod1+minus scratchpad show +bindsym Mod1+r mode resize +bindsym Mod1+s layout stacking +bindsym Mod1+space focus mode_toggle +bindsym Mod1+v splitv +bindsym Mod1+w layout tabbed + + + +mode "resize" { +bindsym Down resize grow height 10 px +bindsym Escape mode default +bindsym Left resize shrink width 10 px +bindsym Return mode default +bindsym Right resize grow width 10 px +bindsym Up resize shrink height 10 px +bindsym h resize shrink width 10 px +bindsym j resize grow height 10 px +bindsym k resize shrink height 10 px +bindsym l resize grow width 10 px +} + + +bar { + + font pango:monospace 8 + mode dock + hidden_state hide + position bottom + status_command @i3status@/bin/i3status + swaybar_command @sway/bin/swaybar + workspace_buttons yes + strip_workspace_numbers no + tray_output primary + colors { + background #000000 + statusline #ffffff + separator #666666 + focused_workspace #4c7899 #285577 #ffffff + active_workspace #333333 #5f676a #ffffff + inactive_workspace #333333 #222222 #888888 + urgent_workspace #2f343a #900000 #ffffff + binding_mode #2f343a #900000 #ffffff + } + +} + + + + + + +exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-default.nix b/home-manager/tests/modules/services/window-managers/sway/sway-default.nix new file mode 100644 index 00000000000..09c388c1c51 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-default.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + wayland.windowManager.sway = { + enable = true; + package = pkgs.runCommandLocal "dummy-package" { } "mkdir $out" // { + outPath = "@sway"; + }; + # overriding findutils causes issues + config.menu = "${pkgs.dmenu}/bin/dmenu_run"; + }; + + nixpkgs.overlays = [ + (self: super: { + dummy-package = super.runCommandLocal "dummy-package" { } "mkdir $out"; + dmenu = self.dummy-package // { outPath = "@dmenu@"; }; + rxvt-unicode-unwrapped = self.dummy-package // { + outPath = "@rxvt-unicode-unwrapped@"; + }; + i3status = self.dummy-package // { outPath = "@i3status@"; }; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent home-files/.config/sway/config \ + ${./sway-default.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf new file mode 100644 index 00000000000..198ce4bd37f --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -0,0 +1,94 @@ +font pango:monospace 8 +floating_modifier Mod1 +default_border pixel 2 +default_floating_border pixel 2 +hide_edge_borders none +focus_wrapping no +focus_follows_mouse always +focus_on_window_activation smart +mouse_warping output +workspace_layout default +workspace_auto_back_and_forth no + +client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #222222 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +client.background #ffffff + +bindsym Mod1+1 workspace number 1 +bindsym Mod1+2 workspace number 2 +bindsym Mod1+3 workspace number 3 +bindsym Mod1+4 workspace number 4 +bindsym Mod1+5 workspace number 5 +bindsym Mod1+6 workspace number 6 +bindsym Mod1+7 workspace number 7 +bindsym Mod1+8 workspace number 8 +bindsym Mod1+9 workspace number 9 +bindsym Mod1+Down focus down +bindsym Mod1+Left focus left +bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Right focus right +bindsym Mod1+Shift+1 move container to workspace number 1 +bindsym Mod1+Shift+2 move container to workspace number 2 +bindsym Mod1+Shift+3 move container to workspace number 3 +bindsym Mod1+Shift+4 move container to workspace number 4 +bindsym Mod1+Shift+5 move container to workspace number 5 +bindsym Mod1+Shift+6 move container to workspace number 6 +bindsym Mod1+Shift+7 move container to workspace number 7 +bindsym Mod1+Shift+8 move container to workspace number 8 +bindsym Mod1+Shift+9 move container to workspace number 9 +bindsym Mod1+Shift+Down move down +bindsym Mod1+Shift+Left move left +bindsym Mod1+Shift+Right move right +bindsym Mod1+Shift+Up move up +bindsym Mod1+Shift+c reload +bindsym Mod1+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' +bindsym Mod1+Shift+h move left +bindsym Mod1+Shift+j move down +bindsym Mod1+Shift+k move up +bindsym Mod1+Shift+l move right +bindsym Mod1+Shift+minus move scratchpad +bindsym Mod1+Shift+q kill +bindsym Mod1+Shift+space floating toggle +bindsym Mod1+Up focus up +bindsym Mod1+a focus parent +bindsym Mod1+b splith +bindsym Mod1+d exec @dmenu@/bin/dmenu_run +bindsym Mod1+e layout toggle split +bindsym Mod1+f fullscreen toggle +bindsym Mod1+h focus left +bindsym Mod1+j focus down +bindsym Mod1+k focus up +bindsym Mod1+l focus right +bindsym Mod1+minus scratchpad show +bindsym Mod1+r mode resize +bindsym Mod1+s layout stacking +bindsym Mod1+space focus mode_toggle +bindsym Mod1+v splitv +bindsym Mod1+w layout tabbed + + + +mode "resize" { +bindsym Down resize grow height 10 px +bindsym Escape mode default +bindsym Left resize shrink width 10 px +bindsym Return mode default +bindsym Right resize grow width 10 px +bindsym Up resize shrink height 10 px +bindsym h resize shrink width 10 px +bindsym j resize grow height 10 px +bindsym k resize shrink height 10 px +bindsym l resize grow width 10 px +} + + + + + + + + +exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf new file mode 100644 index 00000000000..cbc55722a01 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -0,0 +1,94 @@ +font pango:monospace 8 +floating_modifier Mod1 +default_border pixel 2 +default_floating_border pixel 2 +hide_edge_borders none +focus_wrapping no +focus_follows_mouse no +focus_on_window_activation smart +mouse_warping output +workspace_layout default +workspace_auto_back_and_forth no + +client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +client.unfocused #333333 #222222 #888888 #292d2e #222222 +client.urgent #2f343a #900000 #ffffff #900000 #900000 +client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +client.background #ffffff + +bindsym Mod1+1 workspace number 1 +bindsym Mod1+2 workspace number 2 +bindsym Mod1+3 workspace number 3 +bindsym Mod1+4 workspace number 4 +bindsym Mod1+5 workspace number 5 +bindsym Mod1+6 workspace number 6 +bindsym Mod1+7 workspace number 7 +bindsym Mod1+8 workspace number 8 +bindsym Mod1+9 workspace number 9 +bindsym Mod1+Down focus down +bindsym Mod1+Left focus left +bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Right focus right +bindsym Mod1+Shift+1 move container to workspace number 1 +bindsym Mod1+Shift+2 move container to workspace number 2 +bindsym Mod1+Shift+3 move container to workspace number 3 +bindsym Mod1+Shift+4 move container to workspace number 4 +bindsym Mod1+Shift+5 move container to workspace number 5 +bindsym Mod1+Shift+6 move container to workspace number 6 +bindsym Mod1+Shift+7 move container to workspace number 7 +bindsym Mod1+Shift+8 move container to workspace number 8 +bindsym Mod1+Shift+9 move container to workspace number 9 +bindsym Mod1+Shift+Down move down +bindsym Mod1+Shift+Left move left +bindsym Mod1+Shift+Right move right +bindsym Mod1+Shift+Up move up +bindsym Mod1+Shift+c reload +bindsym Mod1+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' +bindsym Mod1+Shift+h move left +bindsym Mod1+Shift+j move down +bindsym Mod1+Shift+k move up +bindsym Mod1+Shift+l move right +bindsym Mod1+Shift+minus move scratchpad +bindsym Mod1+Shift+q kill +bindsym Mod1+Shift+space floating toggle +bindsym Mod1+Up focus up +bindsym Mod1+a focus parent +bindsym Mod1+b splith +bindsym Mod1+d exec @dmenu@/bin/dmenu_run +bindsym Mod1+e layout toggle split +bindsym Mod1+f fullscreen toggle +bindsym Mod1+h focus left +bindsym Mod1+j focus down +bindsym Mod1+k focus up +bindsym Mod1+l focus right +bindsym Mod1+minus scratchpad show +bindsym Mod1+r mode resize +bindsym Mod1+s layout stacking +bindsym Mod1+space focus mode_toggle +bindsym Mod1+v splitv +bindsym Mod1+w layout tabbed + + + +mode "resize" { +bindsym Down resize grow height 10 px +bindsym Escape mode default +bindsym Left resize shrink width 10 px +bindsym Return mode default +bindsym Right resize grow width 10 px +bindsym Up resize shrink height 10 px +bindsym h resize shrink width 10 px +bindsym j resize grow height 10 px +bindsym k resize shrink height 10 px +bindsym l resize grow width 10 px +} + + + + + + + + +exec "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix new file mode 100644 index 00000000000..9b80a63bc59 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + wayland.windowManager.sway = { + enable = true; + + config = { + focus.followMouse = false; + menu = "${pkgs.dmenu}/bin/dmenu_run"; + bars = [ ]; + }; + }; + + nixpkgs.overlays = [ + (self: super: { + dmenu = super.dmenu // { outPath = "@dmenu@"; }; + rxvt-unicode-unwrapped = super.rxvt-unicode-unwrapped // { + outPath = "@rxvt-unicode-unwrapped@"; + }; + sway-unwrapped = + pkgs.runCommandLocal "dummy-sway-unwrapped" { version = "1"; } + "mkdir $out"; + swaybg = pkgs.writeScriptBin "dummy-swaybg" ""; + xwayland = pkgs.writeScriptBin "xwayland" ""; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent home-files/.config/sway/config \ + ${./sway-followmouse-legacy-expected.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix new file mode 100644 index 00000000000..e05b4e56fc9 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-followmouse.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + wayland.windowManager.sway = { + enable = true; + + config = { + focus.followMouse = "always"; + menu = "${pkgs.dmenu}/bin/dmenu_run"; + bars = [ ]; + }; + }; + + nixpkgs.overlays = [ + (self: super: { + dmenu = super.dmenu // { outPath = "@dmenu@"; }; + rxvt-unicode-unwrapped = super.rxvt-unicode-unwrapped // { + outPath = "@rxvt-unicode-unwrapped@"; + }; + sway-unwrapped = + pkgs.runCommandLocal "dummy-sway-unwrapped" { version = "1"; } + "mkdir $out"; + swaybg = pkgs.writeScriptBin "dummy-swaybg" ""; + xwayland = pkgs.writeScriptBin "xwayland" ""; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent home-files/.config/sway/config \ + ${./sway-followmouse-expected.conf} + ''; + }; +} diff --git a/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix b/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix new file mode 100644 index 00000000000..3eab6538e42 --- /dev/null +++ b/home-manager/tests/modules/services/window-managers/sway/sway-post-2003.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + home.stateVersion = "20.09"; + + wayland.windowManager.sway = { + enable = true; + package = pkgs.runCommandLocal "dummy-package" { } "mkdir $out" // { + outPath = "@sway"; + }; + # overriding findutils causes issues + config.menu = "${pkgs.dmenu}/bin/dmenu_run"; + }; + + nixpkgs.overlays = [ + (self: super: { + dummy-package = super.runCommandLocal "dummy-package" { } "mkdir $out"; + dmenu = self.dummy-package // { outPath = "@dmenu@"; }; + rxvt-unicode-unwrapped = self.dummy-package // { + outPath = "@rxvt-unicode-unwrapped@"; + }; + i3status = self.dummy-package // { outPath = "@i3status@"; }; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/sway/config + assertFileContent home-files/.config/sway/config \ + ${./sway-default.conf} + ''; + }; +} |