Compare commits
2 commits
a6f85e6d59
...
1731f5ea7d
| Author | SHA1 | Date | |
|---|---|---|---|
| 1731f5ea7d | |||
| 5b12e9360f |
3 changed files with 42 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{pkgs, ...}:
|
{pkgs, config, ...}:
|
||||||
let
|
let
|
||||||
globals = import ../../config/globals.nix;
|
globals = import ../../config/globals.nix;
|
||||||
in {
|
in {
|
||||||
|
|
@ -11,8 +11,14 @@ in {
|
||||||
networking.hostName = "pennsardin";
|
networking.hostName = "pennsardin";
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
boot.extraModulePackages = [ config.boot.kernelPackages.nct6687d ];
|
||||||
|
boot.kernelModules = [ "nct6683" "k10temp" "i2c-dev" ] ;
|
||||||
boot.swraid.enable = true;
|
boot.swraid.enable = true;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
lm_sensors
|
||||||
|
];
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-uuid/b1a1ae71-4277-45d5-a3d2-f49354f263d4";
|
device = "/dev/disk/by-uuid/b1a1ae71-4277-45d5-a3d2-f49354f263d4";
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,42 @@
|
||||||
_: {
|
{ config, pkgs, ... }: {
|
||||||
services.logind.settings.Login = {
|
services.logind.settings.Login = {
|
||||||
IdleAction = "suspend";
|
IdleAction = "suspend";
|
||||||
IdleActionSec = "5min";
|
IdleActionSec = "5min";
|
||||||
HandleLidSwitch = "suspend";
|
HandleLidSwitch = "suspend";
|
||||||
HandleLidSwitchDocked = "ignore";
|
HandleLidSwitchDocked = "ignore";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.ssh-suspend-inhibitor = {
|
||||||
|
description = "Prevent suspend when SSH sessions are active";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
Restart = "always";
|
||||||
|
ExecStart = pkgs.writeShellScript "ssh-inhibitor" ''
|
||||||
|
while true; do
|
||||||
|
# Vérifie s'il y a des sessions SSH actives
|
||||||
|
if ${pkgs.procps}/bin/pgrep -x sshd >/dev/null && \
|
||||||
|
[ $(${pkgs.procps}/bin/pgrep -P $(${pkgs.procps}/bin/pgrep -x sshd) | wc -l) -gt 0 ]; then
|
||||||
|
# Il y a des sessions SSH, on crée un inhibitor s'il n'existe pas
|
||||||
|
if [ ! -f /tmp/ssh-inhibitor.lock ]; then
|
||||||
|
${pkgs.systemd}/bin/systemd-inhibit --what=idle:sleep \
|
||||||
|
--who="SSH Session" \
|
||||||
|
--why="SSH session active" \
|
||||||
|
--mode=block \
|
||||||
|
sleep infinity &
|
||||||
|
echo $! > /tmp/ssh-inhibitor.lock
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Pas de sessions SSH, on retire l'inhibitor
|
||||||
|
if [ -f /tmp/ssh-inhibitor.lock ]; then
|
||||||
|
kill $(cat /tmp/ssh-inhibitor.lock) 2>/dev/null || true
|
||||||
|
rm /tmp/ssh-inhibitor.lock
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,4 @@
|
||||||
"radeon.cik_support=0"
|
"radeon.cik_support=0"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Si un module sonde "k10temp" gêne :
|
|
||||||
boot.blacklistedKernelModules = ["k10temp"];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue