nix: add screen tty systemd service?

maybe
This commit is contained in:
Oystein Kristoffer Tveit 2023-01-29 03:53:13 +01:00
parent 2a0193f034
commit b96921de98
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 67 additions and 30 deletions

View File

@ -42,36 +42,76 @@
default = ./conf.py; default = ./conf.py;
}; };
}; };
config = {
config = let
screen = "${pkgs.screen}/bin/screen";
in {
nixpkgs.overlays = [ self.overlays.default ]; nixpkgs.overlays = [ self.overlays.default ];
users.users.dibbler = { boot = {
group = "dibbler"; consoleLogLevel = 0;
isNormalUser = true; enableContainers = false;
shell = "${cfg.package.override { conf = cfg.config; }}/bin/dibbler"; loader.grub.enable = false;
};
users = {
groups.dibbler = { };
users.dibbler = {
group = "dibbler";
isNormalUser = true;
shell = "${screen} -x dibbler";
};
};
systemd.services.screen-daemon = {
description = "Dibbler service screen";
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStartPre = "-${screen} -X -S dibbler kill";
ExecStart = "${screen} -dmS dibbler -O -l /home/dibbler/dibbler/text_based.py";
ExecStartPost = "${screen} -X -S dibbler width 42 80";
User = "dibbler";
Group = "dibbler";
Type = "forking";
RemainAfterExit = false;
Restart = "always";
RestartSec = "5s";
SuccessExitStatus = 1;
};
};
# https://github.com/NixOS/nixpkgs/issues/84105
systemd.services."serial-getty@ttyUSB0" = {
enable = true;
wantedBy = [ "getty.target" ];
serviceConfig.Restart = "always";
};
services = {
openssh = {
enable = true;
permitRootLogin = "yes";
};
getty.autologinUser = lib.mkForce "dibbler";
udisks2.enable = false;
}; };
networking.firewall.logRefusedConnections = false; networking.firewall.logRefusedConnections = false;
console.keyMap = "no"; console.keyMap = "no";
boot.consoleLogLevel = 0;
services.openssh.enable = true;
services.openssh.permitRootLogin = "yes";
users.groups.dibbler = { };
services.getty.autologinUser = lib.mkForce "dibbler";
i18n.supportedLocales = ["en_US.UTF-8/UTF-8"];
documentation.info.enable = false;
documentation.man.enable = false;
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
security.polkit.enable = lib.mkForce false; i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" ];
security.audit.enable = false;
services.udisks2.enable = false;
boot.enableContainers = false;
boot.loader.grub.enable = false;
environment.noXlibs = true; environment.noXlibs = true;
documentation = {
info.enable = false;
man.enable = false;
};
security = {
polkit.enable = lib.mkForce false;
audit.enable = false;
};
}; };
}; };
} // } //
@ -84,6 +124,7 @@
self.nixosModules.default self.nixosModules.default
({...}: { ({...}: {
system.stateVersion = "22.05"; system.stateVersion = "22.05";
networking = { networking = {
hostName = "skrot"; hostName = "skrot";
domain = "pvv.ntnu.no"; domain = "pvv.ntnu.no";
@ -91,14 +132,10 @@
defaultGateway = "129.241.210.129"; defaultGateway = "129.241.210.129";
interfaces.eth0 = { interfaces.eth0 = {
useDHCP = false; useDHCP = false;
ipv4 = { ipv4.addresses = [{
addresses = [ address = "129.241.210.235";
{ prefixLength = 25;
address = "129.241.210.235"; }];
prefixLength = 25;
}
];
};
}; };
}; };
# services.resolved.enable = true; # services.resolved.enable = true;