fix: add option to not install package for sway / swaylock
avoid problems with nix on Debian
This commit is contained in:
parent
ce7338040e
commit
dea3740249
4 changed files with 42 additions and 6 deletions
|
@ -7,6 +7,12 @@ in
|
||||||
options.modules.desktop.sway = {
|
options.modules.desktop.sway = {
|
||||||
enable = mkEnableOption "enable Sway Windows Manager";
|
enable = mkEnableOption "enable Sway Windows Manager";
|
||||||
|
|
||||||
|
installPackage = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "install Package, if false relies on distribution packages";
|
||||||
|
};
|
||||||
|
|
||||||
kanshi = mkOption {
|
kanshi = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
|
@ -7,6 +7,14 @@ in
|
||||||
config = mkIf config.modules.desktop.sway.enable {
|
config = mkIf config.modules.desktop.sway.enable {
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
# Do not install sway package on other system that NixOS
|
||||||
|
# because performance issue
|
||||||
|
package =
|
||||||
|
if cfg.installPackage
|
||||||
|
then pkgs.sway
|
||||||
|
else null;
|
||||||
|
|
||||||
wrapperFeatures.gtk = true;
|
wrapperFeatures.gtk = true;
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
config = {
|
config = {
|
||||||
|
@ -61,7 +69,10 @@ in
|
||||||
"${mod}+Shift+q" = "kill";
|
"${mod}+Shift+q" = "kill";
|
||||||
"${mod}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel";
|
"${mod}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel";
|
||||||
"${mod}+Shift+c" = "reload";
|
"${mod}+Shift+c" = "reload";
|
||||||
"${mod}+Alt+l" = "exec ${pkgs.swaylock}/bin/swaylock";
|
"${mod}+Alt+l" =
|
||||||
|
if cfg.installPackage
|
||||||
|
then "exec ${pkgs.swaylock}/bin/swaylock"
|
||||||
|
else "exec swaylock";
|
||||||
"${mod}+${left} focus" = "left";
|
"${mod}+${left} focus" = "left";
|
||||||
"${mod}+${down} focus" = "down";
|
"${mod}+${down} focus" = "down";
|
||||||
"${mod}+${up} focus" = "up";
|
"${mod}+${up} focus" = "up";
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.desktop.sway;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config = mkIf config.modules.desktop.sway.enable {
|
config = mkIf config.modules.desktop.sway.enable {
|
||||||
services.swayidle = {
|
services.swayidle = {
|
||||||
|
@ -7,22 +10,34 @@ with lib;
|
||||||
timeouts = [
|
timeouts = [
|
||||||
{
|
{
|
||||||
timeout = 300;
|
timeout = 300;
|
||||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
command =
|
||||||
|
if cfg.installPackage
|
||||||
|
then "${pkgs.swaylock}/bin/swaylock -f"
|
||||||
|
else "swaylock -f";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 600;
|
timeout = 600;
|
||||||
command = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
|
command = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
|
||||||
resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
|
resumeCommand =
|
||||||
|
if cfg.installPackage
|
||||||
|
then ''${pkgs.sway}/bin/swaymsg "output * power on"''
|
||||||
|
else ''swaymsg "output * power on"'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
events = [
|
events = [
|
||||||
{
|
{
|
||||||
event = "before-sleep";
|
event = "before-sleep";
|
||||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
command =
|
||||||
|
if cfg.installPackage
|
||||||
|
then "${pkgs.swaylock}/bin/swaylock -f"
|
||||||
|
else "swaylock -f";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
event = "lock";
|
event = "lock";
|
||||||
command = "${pkgs.swaylock}/bin/swaylock -f";
|
command =
|
||||||
|
if cfg.installPackage
|
||||||
|
then "${pkgs.swaylock}/bin/swaylock -f"
|
||||||
|
else "swaylock -f";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.modules.desktop.sway;
|
cfg = config.modules.desktop.sway;
|
||||||
|
@ -7,6 +7,10 @@ in
|
||||||
config = mkIf config.modules.desktop.sway.enable {
|
config = mkIf config.modules.desktop.sway.enable {
|
||||||
programs.swaylock = {
|
programs.swaylock = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package =
|
||||||
|
if cfg.installPackage
|
||||||
|
then pkgs.swaylock
|
||||||
|
else pkgs.emptyDirectory;
|
||||||
settings = {
|
settings = {
|
||||||
image = "${cfg.wallpapers.lockscreen}";
|
image = "${cfg.wallpapers.lockscreen}";
|
||||||
scaling = "center";
|
scaling = "center";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue