fixing sshd and suspend problems

This commit is contained in:
Ingolf Wagner 2021-03-05 17:42:00 +01:00
parent 22dbeab3f8
commit a94e8afe34
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
4 changed files with 40 additions and 27 deletions

View file

@ -29,6 +29,8 @@
programs.custom.steam.enable = false; programs.custom.steam.enable = false;
programs.custom.video.enable = true; programs.custom.video.enable = true;
system.custom.suspend.enable = false;
services.printing.enable = true; services.printing.enable = true;
# fonts # fonts

View file

@ -26,6 +26,8 @@
./wtf.nix ./wtf.nix
]; ];
system.custom.suspend.enable = lib.mkDefault true;
backup.dirs = backup.dirs =
[ "/home/palo/.password-store" "/home/palo/.task" "/home/palo/.vit" ]; [ "/home/palo/.password-store" "/home/palo/.task" "/home/palo/.vit" ];

View file

@ -1,7 +1,6 @@
{ config, ... }: { config, ... }: {
{
# make sure ssh is only available trough the tinc # make sure ssh is only available trough the tinc
#networking.firewall.extraCommands = '' networking.firewall.extraCommands = ''
# iptables -t nat -A PREROUTING ! -i tinc.private -p tcp -m tcp --dport 22 -j REDIRECT --to-ports 0 iptables --table nat --append PREROUTING ! --in-interface tinc.+ --protocol tcp --match tcp --dport 22 --jump REDIRECT --to-ports 0
#''; '';
} }

View file

@ -1,27 +1,37 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
with lib;
{ let
systemd.services.screenlock = {
before = [ "sleep.target" ]; cfg = config.system.custom.suspend;
requiredBy = [ "sleep.target" ]; in {
environment = let
display = if (config.services.xserver.display != null) then options.system.custom.suspend.enable = mkEnableOption "use xlock in suspend";
config.services.xserver.display
else config = mkIf cfg.enable {
0;
in { DISPLAY = ":${toString display}"; }; systemd.services.screenlock = {
script = '' before = [ "sleep.target" ];
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 & requiredBy = [ "sleep.target" ];
sleep 1 environment = let
''; display = if (config.services.xserver.display != null) then
serviceConfig = { config.services.xserver.display
SyslogIdentifier = "screenlock"; else
#Type = "simple"; 0;
Type = "forking"; in { DISPLAY = ":${toString display}"; };
User = config.users.users.mainUser.name; script = ''
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 &
sleep 1
'';
serviceConfig = {
SyslogIdentifier = "screenlock";
#Type = "simple";
Type = "forking";
User = config.users.users.mainUser.name;
};
}; };
services.logind.lidSwitch = "suspend";
}; };
services.logind.lidSwitch = "suspend";
} }