2024-12-02 21:12:45 +03:00
|
|
|
# Use `nixos-container login jobber` as root and empty pw.
|
|
|
|
{
|
2024-12-18 09:40:11 +03:00
|
|
|
__findFile,
|
|
|
|
const,
|
|
|
|
lib,
|
|
|
|
pkgsJobber,
|
|
|
|
poetry2nixJobber,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
script = import <package/jobber> {
|
|
|
|
pkgs = pkgsJobber;
|
|
|
|
poetry2nix = poetry2nixJobber;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
networking.nat = {
|
|
|
|
enable = true;
|
|
|
|
externalInterface = "enp8s0";
|
|
|
|
internalInterfaces = [ "ve-+" ];
|
|
|
|
};
|
2024-12-02 21:12:45 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
containers.jobber = {
|
|
|
|
autoStart = true;
|
|
|
|
enableTun = true;
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "188.242.247.132";
|
|
|
|
localAddress = "10.1.0.2";
|
2024-12-02 21:12:45 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
bindMounts = {
|
|
|
|
"/data" = {
|
|
|
|
hostPath = "/storage/hot/data/jobber";
|
|
|
|
isReadOnly = true;
|
|
|
|
};
|
|
|
|
};
|
2024-12-15 21:38:16 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
config =
|
|
|
|
{ ... }:
|
|
|
|
let
|
|
|
|
packages =
|
|
|
|
[ script ]
|
|
|
|
++ (with pkgsJobber; [
|
|
|
|
firefox
|
|
|
|
geckodriver
|
|
|
|
openvpn
|
|
|
|
python311
|
|
|
|
]);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
boot.isContainer = true;
|
|
|
|
system.stateVersion = const.stateVersion;
|
|
|
|
users = {
|
|
|
|
users.root.password = "";
|
|
|
|
mutableUsers = false;
|
|
|
|
};
|
|
|
|
networking = {
|
|
|
|
useHostResolvConf = lib.mkForce false;
|
|
|
|
nameservers = [ "10.30.218.2" ];
|
|
|
|
};
|
2024-12-02 21:12:45 +03:00
|
|
|
|
2024-12-18 09:40:11 +03:00
|
|
|
systemd.services.jobber = {
|
|
|
|
description = "My job is pushing the button.";
|
|
|
|
enable = true;
|
|
|
|
path = packages;
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = {
|
|
|
|
PYTHONDONTWRITEBYTECODE = "1";
|
|
|
|
PYTHONUNBUFFERED = "1";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${script}/bin/jobber -u";
|
|
|
|
Restart = "on-failure";
|
|
|
|
Type = "simple";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-12-02 21:12:45 +03:00
|
|
|
}
|