nixify some more bots

This commit is contained in:
Rouven Seifert 2023-09-12 11:09:32 +02:00
parent 970ddcdacb
commit 5cbf915808
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
7 changed files with 120 additions and 39 deletions

View file

@ -88,11 +88,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1686747123, "lastModified": 1694158470,
"narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=", "narHash": "sha256-yWx9eBDHt6WR3gr65+J85KreHdMypty/P6yM35tIYYM=",
"owner": "serokell", "owner": "serokell",
"repo": "deploy-rs", "repo": "deploy-rs",
"rev": "724463b5a94daa810abfc64a4f87faef4e00f984", "rev": "d0cfc042eba92eb206611c9e8784d41a2c053bab",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -236,11 +236,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1693915360, "lastModified": 1694479651,
"narHash": "sha256-jYvS4GTZ2xLvC5VOWshjMHEaK17qZhlIpV+291GPjdM=", "narHash": "sha256-X8G8vOZXLnPZ6ktH+Q2CueS3IZS1twotcZy2A2h7fgs=",
"owner": "helix-editor", "owner": "helix-editor",
"repo": "helix", "repo": "helix",
"rev": "65c3cca3cc0d0956f4ce8d40ce9e72ba5c9c8e87", "rev": "ccabfee3811bdcc8372beaae777a98fd36e2657e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -255,11 +255,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693895999, "lastModified": 1694469544,
"narHash": "sha256-yN1XVFltQxiwle833KCqWkZNfBuRLWkXyEnOD+ljoYY=", "narHash": "sha256-eqZng5dZnAUyb7xXyFk5z871GY/++KVv3Gyld5mVh20=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "3c0e381fef63e4fbc6c3292c9e9cbcf479c01794", "rev": "5171f5ef654425e09d9c2100f856d887da595437",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -356,11 +356,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693711723, "lastModified": 1694430658,
"narHash": "sha256-5QmlVzskLciJ0QzYmZ6ULvKA7bP6pgV9wwrLBB0V3j0=", "narHash": "sha256-8+OZ98kD63e/GaOiJimXHR/VYiTYwr25jTYGEHHOfq4=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "aca56a79afb82208af2b39d8459dd29c10989135", "rev": "9a5c4996d0918a151269600dfdf6ad3b3748f6a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -371,11 +371,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1693718952, "lastModified": 1694432324,
"narHash": "sha256-+nGdJlgTk0MPN7NygopipmyylVuAVi7OItIwTlwtGnw=", "narHash": "sha256-bo3Gv6Cp40vAXDBPi2XiDejzp/kyz65wZg4AnEWxAcY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "793de77d9f83418b428e8ba70d1e42c6507d0d35", "rev": "ca41b8a227dd235b1b308217f116c7e6e84ad779",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -448,11 +448,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1693663421, "lastModified": 1694183432,
"narHash": "sha256-ImMIlWE/idjcZAfxKK8sQA7A1Gi/O58u5/CJA+mxvl8=", "narHash": "sha256-YyPGNapgZNNj51ylQMw9lAgvxtM2ai1HZVUu3GS8Fng=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e56990880811a451abd32515698c712788be5720", "rev": "db9208ab987cdeeedf78ad9b4cf3c55f5ebd269b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -461,6 +461,26 @@
"type": "indirect" "type": "indirect"
} }
}, },
"pfersel": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1694162494,
"narHash": "sha256-VbgzfheTTfu7FiPfO7RhFkNmyivpsvQIzK+Rb4Y2DmM=",
"owner": "therealr5",
"repo": "pfersel",
"rev": "08726054ecda287311618178d0d98de097d4c4b8",
"type": "github"
},
"original": {
"owner": "therealr5",
"repo": "pfersel",
"type": "github"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -523,6 +543,7 @@
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"pfersel": "pfersel",
"purge": "purge", "purge": "purge",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"trucksimulatorbot": "trucksimulatorbot" "trucksimulatorbot": "trucksimulatorbot"
@ -586,11 +607,11 @@
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
"lastModified": 1693898833, "lastModified": 1694495315,
"narHash": "sha256-OIrMAGNYNeLs6IvBynxcXub7aSW3GEUvWNsb7zx6zuU=", "narHash": "sha256-sZEYXs9T1NVHZSSbMqBEtEm2PGa7dEDcx0ttQkArORc=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "faf21ac162173c2deb54e5fdeed002a9bd6e8623", "rev": "ea208e55f8742fdcc0986b256bdfa8986f5e4415",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -37,6 +37,10 @@
url = "github:therealr5/TruckSimulatorBot"; url = "github:therealr5/TruckSimulatorBot";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
pfersel = {
url = "github:therealr5/pfersel";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = { lanzaboote = {
url = "github:nix-community/lanzaboote/v0.3.0"; url = "github:nix-community/lanzaboote/v0.3.0";
@ -58,6 +62,7 @@
, lanzaboote , lanzaboote
, purge , purge
, trucksimulatorbot , trucksimulatorbot
, pfersel
, helix , helix
, ... , ...
}@attrs: { }@attrs: {
@ -123,6 +128,7 @@
sops-nix.nixosModules.sops sops-nix.nixosModules.sops
purge.nixosModules.default purge.nixosModules.default
trucksimulatorbot.nixosModules.default trucksimulatorbot.nixosModules.default
pfersel.nixosModules.default
]; ];
}; };
vm = nixpkgs.lib.nixosSystem { vm = nixpkgs.lib.nixosSystem {

View file

@ -212,6 +212,55 @@ in
enable = true; enable = true;
postfix.enable = true; postfix.enable = true;
locals = { locals = {
"neural.conf".text = ''
servers = "127.0.0.1:6379";
enabled = true
rules {
"LONG" {
train {
max_trains = 5000;
max_usages = 200;
max_iterations = 25;
learning_rate = 0.01,
}
symbol_spam = "NEURAL_SPAM_LONG";
symbol_ham = "NEURAL_HAM_LONG";
ann_expire = 100d;
}
"SHORT" {
train {
max_trains = 100;
max_usages = 2;
max_iterations = 25;
learning_rate = 0.01,
}
symbol_spam = "NEURAL_SPAM_SHORT";
symbol_ham = "NEURAL_HAM_SHORT";
ann_expire = 1d;
}
}
'';
"neural_group.conf".text = ''
symbols = {
"NEURAL_SPAM_LONG" {
weight = 1.0; # sample weight
description = "Neural network spam (long)";
}
"NEURAL_HAM_LONG" {
weight = -1.0; # sample weight
description = "Neural network ham (long)";
}
"NEURAL_SPAM_SHORT" {
weight = 1.0; # sample weight
description = "Neural network spam (short)";
}
"NEURAL_HAM_SHORT" {
weight = -0.5; # sample weight
description = "Neural network ham (short)";
}
}
'';
"worker-controller.inc".text = '' "worker-controller.inc".text = ''
password = "$2$g1jh7t5cxschj11set5wksd656ixd5ie$cgwrj53hfb87xndqbh5r3ow9qfi1ejii8dxok1ihbnhamccn1rxy"; password = "$2$g1jh7t5cxschj11set5wksd656ixd5ie$cgwrj53hfb87xndqbh5r3ow9qfi1ejii8dxok1ihbnhamccn1rxy";
''; '';
@ -219,6 +268,16 @@ in
read_servers = "127.0.0.1"; read_servers = "127.0.0.1";
write_servers = "127.0.0.1"; write_servers = "127.0.0.1";
''; '';
"dmarc.conf".text = ''
reporting {
# Required attributes
enabled = true; # Enable reports in general
email = 'reports@rfive.de'; # Source of DMARC reports
domain = 'rfive.de'; # Domain to serve
org_name = 'rfive.de'; # Organisation
from_name = 'DMARC Aggregate Report';
}
'';
}; };
}; };
redis = { redis = {

View file

@ -1,12 +1,10 @@
{ ... }: { config, ... }:
{ {
# currently quite ugly and stateful. #todo nixify sops.secrets."pfersel/token".owner = "pfersel";
systemd.services.pfersel = { services.pfersel = {
after = [ "network-online.target" ]; enable = true;
wantedBy = [ "multi-user.target" ]; discord = {
serviceConfig = { tokenFile = config.sops.secrets."pfersel/token".path;
WorkingDirectory = "/root/Pfersel";
ExecStart = "/root/Pfersel/venv/bin/python3 bot.py";
}; };
}; };
} }

View file

@ -1,5 +1,7 @@
purge: purge:
token: ENC[AES256_GCM,data:mCK0xAgF4Q8DOTPVRg/O5L8kpDItNj8U0ikoKOOZC3Dv50Yt/nqvq4j4fM0CQ836pxCutir6FkTKbS5xS5XqKoSzu8E/0Q==,iv:JDqyeG+g3RAHmMD4uxS6eyQYYI50X6Bwutp+/v2ngq8=,tag:JkqLWoSwwghNUCD2+I6Njg==,type:str] token: ENC[AES256_GCM,data:mCK0xAgF4Q8DOTPVRg/O5L8kpDItNj8U0ikoKOOZC3Dv50Yt/nqvq4j4fM0CQ836pxCutir6FkTKbS5xS5XqKoSzu8E/0Q==,iv:JDqyeG+g3RAHmMD4uxS6eyQYYI50X6Bwutp+/v2ngq8=,tag:JkqLWoSwwghNUCD2+I6Njg==,type:str]
pfersel:
token: ENC[AES256_GCM,data:MFxzpT6sqzhDpZya4/eI77LbHXekzfTQWZrjd/aot2MzRXicaCUabEUqnR40QnW9HujOTW0+A+9Be5mDX6OqVDt2ioKVxg==,iv:UTTWL7uSVgpkLnXTkvojC/fotkDISdyBrGDiegXqMuQ=,tag:+8+Th/M9U9mJX6i2YCPBbg==,type:str]
wireguard: wireguard:
dorm: dorm:
private: ENC[AES256_GCM,data:3DMW+sZ1qEcfithXj8/7CUbKotJ2Ld23Fa6cf9ijLRvJPk5+VZOt8j5AIVY=,iv:pY/uAkkUOyFqEmWqoP8qC418VtbbX/Ws7BMuyGbvlXE=,tag:/u2akzXjchYlKR59Skk4aA==,type:str] private: ENC[AES256_GCM,data:3DMW+sZ1qEcfithXj8/7CUbKotJ2Ld23Fa6cf9ijLRvJPk5+VZOt8j5AIVY=,iv:pY/uAkkUOyFqEmWqoP8qC418VtbbX/Ws7BMuyGbvlXE=,tag:/u2akzXjchYlKR59Skk4aA==,type:str]
@ -22,8 +24,8 @@ sops:
NGlZbU8rcWJRbGE5OEFHdUNqZ2xUS2sK/r7qJHfTP0REcM2PYM95XT0onnCYXzam NGlZbU8rcWJRbGE5OEFHdUNqZ2xUS2sK/r7qJHfTP0REcM2PYM95XT0onnCYXzam
20BgfynX3PJE2QVcgl8rr7ssuKxESi+tY/1VB0l8Tryxe6hr/p5IVg== 20BgfynX3PJE2QVcgl8rr7ssuKxESi+tY/1VB0l8Tryxe6hr/p5IVg==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2023-07-30T17:37:40Z" lastmodified: "2023-09-08T08:32:30Z"
mac: ENC[AES256_GCM,data:ZoYr+oUDweb5o01qbYVT2b4DITDtfAtsiJBOP1XCU+YZeEOLzMQzCGdcI7X+ho1M6u2sWT5WX0e1SwWBkuxOqs7vF6SeyDKFSmZpSx6Cg6KJDqxFJf2Jy7Ll0X5DkE7m+r1tQjggsVTNKTLMEVXONsZVIzGa0If3kuFVAzSlv9Y=,iv:0XxrIIjL71tNy5PEoxQ62MPJ4QmryMljUX20/LYV7C4=,tag:pD109s/GgbxZmprBpIooNQ==,type:str] mac: ENC[AES256_GCM,data:TaU+dHkgaaI/YD15CL/n2drdYRxQ1OlfqwaZrNmCOHCiSgDoAxx90HuRBE2z1v6y0TlQQ/An6/ZwS7qpd99awlBlYEj1M63R20VGqRpsKBk+5W2ISjRWrwTZlFrHllR78PJf4cpxfDRl+RGeODTSHTmuA1D3p06EbdO+xABw0nk=,iv:O4syFBWTciV8YCFmaweihyvhwz7EKw58AyGtbsOJb0Y=,tag:eKbW8Ey3Ux6LHMMwhUk8VQ==,type:str]
pgp: pgp:
- created_at: "2023-04-12T15:47:07Z" - created_at: "2023-04-12T15:47:07Z"
enc: |- enc: |-

View file

@ -4,7 +4,7 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# fzf # fzf
bat bat
exa eza
duf duf
trash-cli trash-cli
nix-output-monitor nix-output-monitor
@ -18,7 +18,7 @@
enable = true; enable = true;
shellAliases = { shellAliases = {
rm = "trash"; rm = "trash";
ls = "exa --icons"; ls = "eza --icons";
l = "ls -l"; l = "ls -l";
ll = "ls -la"; ll = "ls -la";
la = "ls -a"; la = "ls -a";

View file

@ -234,11 +234,6 @@ in
farPattern = "Drafts"; farPattern = "Drafts";
extraConfig.Create = "near"; extraConfig.Create = "near";
}; };
channels.spamtrain = {
nearPattern = "Spamtrain";
farPattern = "Spamtrain";
extraConfig.Create = "near";
};
}; };
extraConfig = { extraConfig = {
account = { account = {
@ -252,7 +247,7 @@ in
{ {
enable = true; enable = true;
mailboxName = " iFSR"; mailboxName = " iFSR";
extraMailboxes = lib.lists.forEach [ c.admin c.sent c.spamtrain c.trash c.junk c.drafts ] (x: x.nearPattern); extraMailboxes = lib.lists.forEach [ c.admin c.sent c.trash c.junk c.drafts ] (x: x.nearPattern);
}; };
}; };
"gmail" = rec { "gmail" = rec {