Compare commits
No commits in common. "7b5f9e40161c01b41c97e5e1743f653d890ff836" and "7bdfcc58e715d740cfee960e6d9f650d4f32c67d" have entirely different histories.
7b5f9e4016
...
7bdfcc58e7
14 changed files with 48 additions and 156 deletions
|
|
@ -36,7 +36,6 @@ in {
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
calc
|
calc
|
||||||
curl
|
|
||||||
dysk
|
dysk
|
||||||
fd
|
fd
|
||||||
file
|
file
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,5 @@
|
||||||
./pass.nix
|
./pass.nix
|
||||||
./halloy.nix
|
./halloy.nix
|
||||||
./ai.nix
|
./ai.nix
|
||||||
./programming.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ in {
|
||||||
zed.enable = true;
|
zed.enable = true;
|
||||||
terminal.enable = true;
|
terminal.enable = true;
|
||||||
ai.enable = true;
|
ai.enable = true;
|
||||||
programming.enable = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib; let
|
|
||||||
cfg = config.local.programs.programming;
|
|
||||||
in {
|
|
||||||
options.local.programs.programming = {
|
|
||||||
enable = mkEnableOption "programming";
|
|
||||||
debugging = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
binutils
|
|
||||||
cmake
|
|
||||||
gcc
|
|
||||||
gnumake
|
|
||||||
pkg-config
|
|
||||||
python314
|
|
||||||
rustup
|
|
||||||
uv
|
|
||||||
] ++ optionals cfg.debugging [
|
|
||||||
gdb
|
|
||||||
valgrind
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
13
home/platforms/fabian@posixlycorrect/shenvs/c.nix
Normal file
13
home/platforms/fabian@posixlycorrect/shenvs/c.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
static = true;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
binutils
|
||||||
|
cmake
|
||||||
|
curl
|
||||||
|
gdb
|
||||||
|
gnumake
|
||||||
|
rustup
|
||||||
|
valgrind
|
||||||
|
];
|
||||||
|
}
|
||||||
11
home/platforms/fabian@posixlycorrect/shenvs/python.nix
Normal file
11
home/platforms/fabian@posixlycorrect/shenvs/python.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
static = true;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
pipenv
|
||||||
|
(python310.withPackages (packages:
|
||||||
|
with packages; [
|
||||||
|
setuptools
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
||||||
13
home/platforms/fabian@t14/shenvs/c.nix
Normal file
13
home/platforms/fabian@t14/shenvs/c.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
static = true;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
binutils
|
||||||
|
cmake
|
||||||
|
curl
|
||||||
|
gdb
|
||||||
|
gnumake
|
||||||
|
rustup
|
||||||
|
valgrind
|
||||||
|
];
|
||||||
|
}
|
||||||
11
home/platforms/fabian@t14/shenvs/python.nix
Normal file
11
home/platforms/fabian@t14/shenvs/python.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
static = true;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
pipenv
|
||||||
|
(python310.withPackages (packages:
|
||||||
|
with packages; [
|
||||||
|
setuptools
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,5 @@
|
||||||
./borgsync.nix
|
./borgsync.nix
|
||||||
./dufs.nix
|
./dufs.nix
|
||||||
./defaultDesktopPack.nix
|
./defaultDesktopPack.nix
|
||||||
./task-force-beta-bot.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib; let
|
|
||||||
cfg = config.local.sys.task-force-beta-bot;
|
|
||||||
|
|
||||||
allowedChatsFile = pkgs.writeText "task-force-beta-bot-allowed-chats" (
|
|
||||||
lib.concatMapStringsSep "\n" toString cfg.allowedChats
|
|
||||||
);
|
|
||||||
|
|
||||||
package = pkgs.rustPlatform.buildRustPackage {
|
|
||||||
pname = "task-force-beta-bot";
|
|
||||||
version = "0.1.0";
|
|
||||||
|
|
||||||
src = pkgs.fetchgit {
|
|
||||||
url = "https://git.posixlycorrect.com/fabian/task-force-beta-bot";
|
|
||||||
rev = "FIXME";
|
|
||||||
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "General-purpose modular Telegram bot";
|
|
||||||
mainProgram = "task_force_beta_bot";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
options.local.sys.task-force-beta-bot = {
|
|
||||||
enable = lib.mkEnableOption "the Task Force Beta Telegram bot";
|
|
||||||
|
|
||||||
tokenFile = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Path to the Telegram bot token file.";
|
|
||||||
};
|
|
||||||
|
|
||||||
allowedChats = lib.mkOption {
|
|
||||||
type = lib.types.listOf lib.types.int;
|
|
||||||
description = "List of Telegram chat IDs allowed to use the bot.";
|
|
||||||
};
|
|
||||||
|
|
||||||
user = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "task-force-beta-bot";
|
|
||||||
description = "User to run the bot as.";
|
|
||||||
};
|
|
||||||
|
|
||||||
group = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "task-force-beta-bot";
|
|
||||||
description = "Group for the bot service.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
systemd.services.task-force-beta-bot = {
|
|
||||||
after = ["network.target"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${lib.getExe package} ${cfg.tokenFile} ${allowedChatsFile}";
|
|
||||||
User = cfg.user;
|
|
||||||
Group = cfg.group;
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = "5s";
|
|
||||||
|
|
||||||
# Hardening
|
|
||||||
CapabilityBoundingSet = "";
|
|
||||||
LockPersonality = true;
|
|
||||||
MemoryDenyWriteExecute = true;
|
|
||||||
NoNewPrivileges = true;
|
|
||||||
PrivateDevices = true;
|
|
||||||
PrivateTmp = true;
|
|
||||||
PrivateUsers = true;
|
|
||||||
ProtectClock = true;
|
|
||||||
ProtectControlGroups = true;
|
|
||||||
ProtectHome = true;
|
|
||||||
ProtectHostname = true;
|
|
||||||
ProtectKernelLogs = true;
|
|
||||||
ProtectKernelModules = true;
|
|
||||||
ProtectKernelTunables = true;
|
|
||||||
ProtectSystem = "strict";
|
|
||||||
RestrictAddressFamilies = ["AF_INET" "AF_INET6"];
|
|
||||||
RestrictNamespaces = true;
|
|
||||||
RestrictRealtime = true;
|
|
||||||
RestrictSUIDSGID = true;
|
|
||||||
SystemCallArchitectures = "native";
|
|
||||||
SystemCallFilter = ["@system-service" "~@privileged"];
|
|
||||||
|
|
||||||
# Token and allowed chats file access
|
|
||||||
BindReadOnlyPaths = [builtins.storeDir cfg.tokenFile "${allowedChatsFile}"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users = {
|
|
||||||
users.task-force-beta-bot = lib.mkIf (cfg.user == "task-force-beta-bot") {
|
|
||||||
group = cfg.group;
|
|
||||||
isSystemUser = true;
|
|
||||||
};
|
|
||||||
groups.task-force-beta-bot = lib.mkIf (cfg.group == "task-force-beta-bot") {};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -19,6 +19,5 @@ with lib; {
|
||||||
./isso.nix
|
./isso.nix
|
||||||
./miniflux.nix
|
./miniflux.nix
|
||||||
./radicale.nix
|
./radicale.nix
|
||||||
./task-force-beta-bot.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib; {
|
|
||||||
local.sys.task-force-beta-bot = {
|
|
||||||
enable = true;
|
|
||||||
tokenFile = "/var/trust/task_force_beta_bot/telegram_token";
|
|
||||||
allowedChats = [ 2186489671 ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue