summaryrefslogtreecommitdiffstats
path: root/makefu/3modules
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-07-28 22:24:15 +0200
committermakefu <github@syntax-fehler.de>2023-07-28 22:24:15 +0200
commit060a8f28fa1fc648bdf66afb31a5d1efac868837 (patch)
tree2b354eacc7897365ee45244fe7a51720e0d0333f /makefu/3modules
parentcbfcc890e3b76d942b927809bf981a5fa7289e6a (diff)
makefu: move out to own repo, add vacation-note
Diffstat (limited to 'makefu/3modules')
-rw-r--r--makefu/3modules/awesome-extra.nix36
-rw-r--r--makefu/3modules/bump-distrowatch.nix31
-rw-r--r--makefu/3modules/default.nix23
-rw-r--r--makefu/3modules/deluge.nix185
-rw-r--r--makefu/3modules/etherpad.nix155
-rw-r--r--makefu/3modules/forward-journal.nix50
-rw-r--r--makefu/3modules/logging-config.nix16
-rw-r--r--makefu/3modules/netdata.nix154
-rw-r--r--makefu/3modules/opentracker.nix55
-rw-r--r--makefu/3modules/populate.nix5
-rw-r--r--makefu/3modules/ps3netsrv.nix60
-rw-r--r--makefu/3modules/sane-extra.nix45
-rw-r--r--makefu/3modules/server-config.nix14
-rw-r--r--makefu/3modules/snapraid.nix126
-rw-r--r--makefu/3modules/state.nix16
-rw-r--r--makefu/3modules/torrent.nix13
-rw-r--r--makefu/3modules/udpt.nix58
17 files changed, 0 insertions, 1042 deletions
diff --git a/makefu/3modules/awesome-extra.nix b/makefu/3modules/awesome-extra.nix
deleted file mode 100644
index 9e9dfdfde..000000000
--- a/makefu/3modules/awesome-extra.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{config, lib, pkgs, ... }:
-
-with lib;
-let
- cfg = config.makefu.awesome;
- out = {
- options.makefu.awesome = api;
- config = lib.mkIf cfg.enable imp;
- };
- api = {
- enable = mkEnableOption "awesome custom config";
- modkey = mkOption {
- type = types.str;
- description = "Modkey to be used";
- default = "Mod4";
- };
- baseConfig = mkOption {
- type = types.path;
- description = ''
- rc.lua file to be used as default
- This module will use substituteAll to replace strings before writing to
- /etc/xdg/awesome/rc.lua
- '';
- default = pkgs.awesomecfg.full.override {
- locker = "${pkgs.i3lock}/bin/i3lock -i /var/lib/wallpaper/wallpaper";
- };
- };
- };
- imp = {
- home-manager.users.makefu.home.file.".config/awesome/rc.lua".source =
- cfg.baseConfig.override {
- inherit (cfg) modkey;
- };
-
- };
-in out
diff --git a/makefu/3modules/bump-distrowatch.nix b/makefu/3modules/bump-distrowatch.nix
deleted file mode 100644
index f8ba18ce4..000000000
--- a/makefu/3modules/bump-distrowatch.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-let
- cfg = config.makefu.distrobump;
-
- imp = {
- systemd.services.distrobump = {
- after = [ "network-online.target" ];
- wantedBy = [ "multi-user.target" ];
- path = [ pkgs.curl ];
- restartIfChanged = false;
- startAt = "daily";
- serviceConfig = {
- PrivateTmp = true;
- Type = "oneshot";
- ExecStart = pkgs.writeDash "bump-distrowatch" ''
- set -euf
- UA='Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0'
- curl -Lvc /tmp/cookie.jar -A "$UA" 'https://distrowatch.com/' >/dev/null
- sleep $(shuf -i 3-15 -n1).$(shuf -i 0-9 -n1)
- curl -Lvc /tmp/cookie.jar -A "$UA" -e 'https://distrowatch.com/' 'https://distrowatch.com/nixos?frphr' >/dev/null
- '';
- RandomizedDelaySec = 28800;
- };
- };
- };
-in
-{
- options.makefu.distrobump.enable = lib.mkEnableOption "distrobump";
- config = lib.mkIf cfg.enable imp;
-}
diff --git a/makefu/3modules/default.nix b/makefu/3modules/default.nix
deleted file mode 100644
index e7d3ecd58..000000000
--- a/makefu/3modules/default.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-_:
-
-{
- imports = [
- ./awesome-extra.nix
- ./bump-distrowatch.nix
- ./deluge.nix
- ./etherpad.nix
- ./forward-journal.nix
- ./netdata.nix
- ./opentracker.nix
- ./ps3netsrv.nix
- ./logging-config.nix
- ./populate.nix
- ./sane-extra.nix
- ./server-config.nix
- ./snapraid.nix
- ./state.nix
- ./torrent.nix
- ./udpt.nix
- ];
-}
-
diff --git a/makefu/3modules/deluge.nix b/makefu/3modules/deluge.nix
deleted file mode 100644
index bbdd18454..000000000
--- a/makefu/3modules/deluge.nix
+++ /dev/null
@@ -1,185 +0,0 @@
-{ config, lib, pkgs, ... }:
-# based on <nixpkgs>/nixos/modules/services/torrent/deluge.nix
-with import <stockholm/lib>;
-
-let
- cfg_daemon = config.makefu.deluge;
- homedir = cfg_daemon.homedir;
- delugedir = "${homedir}/.config/deluge";
- cfg_web = config.makefu.deluge.web;
- core_conf = pkgs.writeText "deluge-core-cfg" ''
- {
- "file": 1,
- "format": 1
- }${builtins.toJSON (default_core_cfg // cfg_daemon.cfg)}
- '';
-
- default_core_cfg = {
- # ports and networking
- daemon_port = 58846; allow_remote = false;
- listen_ports = [ 0 0 ]; # from -> to, 0 -> random
- outgoing_ports = [ 0 0 ];
- random_port = true;
- random_outgoing_ports = true;
- listen_interface = "";
- # folders
- move_completed_path = homedir +"/complete"; move_completed = false;
- autoadd_location = homedir + "/watch"; autoadd_enable = true;
- download_location = homedir + "/data";
- torrentfiles_location = homedir + "/torrents"; copy_torrent_file = false; del_copy_torrent_file = false;
- plugins_location = homedir + "/.config/deluge/plugins"; enabled_plugins = [];
- geoip_db_location = pkgs.geolite-legacy + "/share/GeoIP/GeoIP.dat";
- queue_new_to_top = false;
- info_sent = 0;
- send_info = false;
- compact_allocation = false;
- # peer discovery, extras
- lsd = true;
- natpmp = true;
- utpex = false;
- dht = false;
- upnp = true;
- peer_tos = "0x08";
- # active torrents
- dont_count_slow_torrents = false;
- max_active_limit = -1;
- max_active_downloading = -1;
- max_active_seeding = -1;
- max_upload_slots_global = -1;
- # seeding
- share_ratio_limit = -1;
- seed_time_ratio_limit = -1;
- seed_time_limit = 180;
- stop_seed_at_ratio = false;
- remove_seed_at_ratio = false;
- stop_seed_ratio = 2;
- # speed and connections
- rate_limit_ip_overhead = true;
- ignore_limits_on_local_network = true;
- max_download_speed = -1;
- max_upload_speed = -1;
- max_upload_speed_per_torrent = -1;
- max_download_speed_per_torrent = -1;
- max_half_open_connections = -1;
- max_connections_global = -1;
- max_connections_per_second = -1;
- max_connections_per_torrent = -1;
- max_upload_slots_per_torrent = -1;
- enc_in_policy = 1;
- enc_prefer_rc4 = true;
- enc_level = 2;
- enc_out_policy = 1;
- cache_size = 8192;
- cache_expiry = 60;
- prioritize_first_last_pieces = false;
- auto_managed = true;
- proxies = {
- peer = {
- username = "";
- password = "";
- hostname = "";
- type = 0;
- port = 8080;
- };
- web_seed = {
- username = "";
- password = "";
- hostname = "";
- type = 0;
- port = 8080;
- };
- tracker = {
- username = "";
- password = "";
- hostname = "";
- type = 0;
- port = 8080;
- };
- dht = {
- username = "";
- password = "";
- hostname = "";
- type = 0;
- port = 8080;
- };
- };
- add_paused = false;
- new_release_check = false;
- };
-
- api = {
- enable = mkEnableOption "deluge daemon";
-
- cfg = mkOption {
- default = default_core_cfg;
- type = types.attrsOf types.unspecified;
- description = ''
- for full configuration see defaults
- '';
- example = {
- "daemon_port"= 58846;
- "download_location"= "/var/download";
- };
- };
-
- auth = mkOption {
- default = [];
- example = ["alice:MyC0mpL3xPass:10"];
- type = types.lines;
- };
-
- homedir = mkOption {
- default = "/var/lib/deluge";
- description = "Home directory of deluge user";
- type = types.str;
- };
-
- web = {
- enable = mkEnableOption "deluge web";
- };
- };
- imp = {
-
- systemd.services.deluged = {
- after = [ "network.target" ];
- description = "Deluge BitTorrent Daemon";
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- ExecStart = "${pkgs.pythonPackages.deluge}/bin/deluged -d";
- ExecStartPre = let
- in pkgs.writeDash "deluged-init" ''
- mkdir -p ${delugedir}
- echo ${shell.escape cfg_daemon.auth} > ${delugedir}/auth
- cp -f ${core_conf} ${delugedir}/core.conf
- '';
- Restart = "on-success";
- User = "deluge";
- Group = "deluge";
- };
- };
-
- systemd.services.delugeweb = mkIf cfg_web.enable {
- after = [ "network.target" ];
- description = "Deluge BitTorrent WebUI";
- wantedBy = [ "multi-user.target" ];
- serviceConfig.ExecStart = "${pkgs.pythonPackages.deluge}/bin/deluge --ui web";
- serviceConfig.User = "deluge";
- serviceConfig.Group = "deluge";
- };
-
- environment.systemPackages = [ pkgs.pythonPackages.deluge ];
-
- users.extraUsers.deluge = {
- group = "deluge";
- uid = config.ids.uids.deluge;
- home = cfg_daemon.homedir;
- createHome = true;
- description = "Deluge Daemon user";
- };
-
- users.extraGroups.deluge.gid = config.ids.gids.deluge;
- };
-in {
- options.makefu.deluge = api;
- config = lib.mkIf cfg_daemon.enable imp;
-}
diff --git a/makefu/3modules/etherpad.nix b/makefu/3modules/etherpad.nix
deleted file mode 100644
index 1e8f426a3..000000000
--- a/makefu/3modules/etherpad.nix
+++ /dev/null
@@ -1,155 +0,0 @@
-{ lib, pkgs, config, ... }:
-let
- name = "etherpad-lite";
- cfg = config.services.etherpad-lite;
-in
-{
- options.services.etherpad-lite = {
- enable = lib.mkEnableOption "Enable Etherpad lite’s service";
- user = lib.mkOption {
- type = lib.types.str;
- default = name;
- description = "User account under which Etherpad lite runs";
- };
- group = lib.mkOption {
- type = lib.types.str;
- default = name;
- description = "Group under which Etherpad lite runs";
- };
- dataDir = lib.mkOption {
- type = lib.types.path;
- default = "/var/lib/${name}";
- description = ''
- The directory where Etherpad lite stores its data.
- '';
- };
- socketsDir = lib.mkOption {
- type = lib.types.path;
- default = "/run/${name}";
- description = ''
- The directory where Etherpad lite stores its sockets.
- '';
- };
- configFile = lib.mkOption {
- type = lib.types.path;
- description = ''
- The config file path for Etherpad lite.
- '';
- };
- sessionKeyFile = lib.mkOption {
- type = lib.types.path;
- description = ''
- The Session key file path for Etherpad lite.
- '';
- };
- apiKeyFile = lib.mkOption {
- type = lib.types.path;
- description = ''
- The API key file path for Etherpad lite.
- '';
- };
- package = lib.mkOption {
- type = lib.types.package;
- default = pkgs.webapps.etherpad-lite;
- description = ''
- Etherpad lite package to use.
- '';
- };
- modules = lib.mkOption {
- type = lib.types.listOf lib.types.package;
- default = [];
- description = ''
- Etherpad lite modules to use.
- '';
- };
- # Output variables
- workdir = lib.mkOption {
- type = lib.types.package;
- default = cfg.package.withModules cfg.modules;
- description = ''
- Adjusted Etherpad lite package with plugins
- '';
- readOnly = true;
- };
- systemdStateDirectory = lib.mkOption {
- type = lib.types.str;
- # Use ReadWritePaths= instead if varDir is outside of /var/lib
- default = assert lib.strings.hasPrefix "/var/lib/" cfg.dataDir;
- lib.strings.removePrefix "/var/lib/" cfg.dataDir;
- description = ''
- Adjusted Etherpad lite data directory for systemd
- '';
- readOnly = true;
- };
- systemdRuntimeDirectory = lib.mkOption {
- type = lib.types.str;
- # Use ReadWritePaths= instead if socketsDir is outside of /run
- default = assert lib.strings.hasPrefix "/run/" cfg.socketsDir;
- lib.strings.removePrefix "/run/" cfg.socketsDir;
- description = ''
- Adjusted Etherpad lite sockets directory for systemd
- '';
- readOnly = true;
- };
- sockets = lib.mkOption {
- type = lib.types.attrsOf lib.types.path;
- default = {
- node = "${cfg.socketsDir}/etherpad-lite.sock";
- };
- readOnly = true;
- description = ''
- Etherpad lite sockets
- '';
- };
- };
-
- config = lib.mkIf cfg.enable {
- systemd.services.etherpad-lite = {
- description = "Etherpad-lite";
- wantedBy = [ "multi-user.target" ];
- after = [ "network.target" "postgresql.service" ];
- wants = [ "postgresql.service" ];
-
- environment.NODE_ENV = "production";
- environment.HOME = cfg.workdir;
-
- path = [ pkgs.nodejs ];
-
- script = ''
- exec ${pkgs.nodejs}/bin/node ${cfg.workdir}/src/node/server.js \
- --sessionkey ${cfg.sessionKeyFile} \
- --apikey ${cfg.apiKeyFile} \
- --settings ${cfg.configFile}
- '';
-
- postStart = ''
- while [ ! -S ${cfg.sockets.node} ]; do
- sleep 0.5
- done
- chmod a+w ${cfg.sockets.node}
- '';
- serviceConfig = {
- DynamicUser = true;
- User = cfg.user;
- Group = cfg.group;
- WorkingDirectory = cfg.workdir;
- PrivateTmp = true;
- NoNewPrivileges = true;
- PrivateDevices = true;
- ProtectHome = true;
- ProtectControlGroups = true;
- ProtectKernelModules = true;
- Restart = "always";
- Type = "simple";
- TimeoutSec = 60;
- RuntimeDirectory = cfg.systemdRuntimeDirectory;
- StateDirectory= cfg.systemdStateDirectory;
- ExecStartPre = [
- "+${pkgs.coreutils}/bin/install -d -m 0755 -o ${cfg.user} -g ${cfg.group} ${cfg.dataDir}/ep_initialized"
- "+${pkgs.coreutils}/bin/chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir} ${cfg.configFile} ${cfg.sessionKeyFile} ${cfg.apiKeyFile}"
- ];
- };
- };
-
- };
-}
diff --git a/makefu/3modules/forward-journal.nix b/makefu/3modules/forward-journal.nix
deleted file mode 100644
index f501048be..000000000
--- a/makefu/3modules/forward-journal.nix
+++ /dev/null
@@ -1,50 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-let
- cfg = config.makefu.forward-journal;
-
- out = {
- options.makefu.forward-journal = api;
- config = lib.mkIf cfg.enable imp;
- };
-
- api = {
- enable = mkEnableOption "forward journal via syslog";
- src = mkOption {
- type = types.str;
- description = "syslog host identifier";
- default = config.networking.hostName;
- };
- dst = mkOption {
- type = types.str;
- description = "syslog host identifier";
- default = "";
- };
- proto = mkOption {
- type = types.str;
- default = "udp";
- };
- port = mkOption {
- type = types.int;
- description = "destination port";
- default = 514;
- };
-
- };
-
- imp = {
- services.syslog-ng = {
- enable = true;
- extraConfig = ''
- template t_remote { template("<$PRI>$DATE ${cfg.src} $PROGRAM[$PID]: $MSG\n"); };
- source s_all { system(); internal(); };
- destination d_loghost { udp("${cfg.dst}" port(${toString cfg.port}) template(t_remote)); };
- log { source(s_all); destination(d_loghost); };
- '';
- };
- };
-
-in
-out
-
diff --git a/makefu/3modules/logging-config.nix b/makefu/3modules/logging-config.nix
deleted file mode 100644
index a77e32e48..000000000
--- a/makefu/3modules/logging-config.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-{
- options.makefu.stats-server = lib.mkOption {
- type = types.str;
- default = "stats.makefu.r";
- description = "Central stats server (collectd)";
- };
- options.makefu.log-server = lib.mkOption {
- type = types.str;
- default = "logs.makefu.r";
- description = "Central logging server (logstash,elasticsearch)";
- };
-}
-
diff --git a/makefu/3modules/netdata.nix b/makefu/3modules/netdata.nix
deleted file mode 100644
index bfa6f404c..000000000
--- a/makefu/3modules/netdata.nix
+++ /dev/null
@@ -1,154 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-# fork of https://github.com/Mic92/dotfiles/blob/master/nixos/vms/modules/netdata.nix
-with lib;
-let
- cfg = config.makefu.netdata;
-in
-{
- options.makefu.netdata = {
- enable = mkEnableOption "netdata";
-
- # TODO only apikey from file, set remote host manually
- stream.file = mkOption {
- type = types.str;
- default = toString <secrets/netdata-stream.conf>;
- description = "path to stream data file";
- };
- stream.role = mkOption {
- type = types.enum [ "master" "slave" ];
- default = "slave";
- description = "Wether to stream data";
- };
-
- httpcheck.checks = mkOption {
- type = types.attrsOf (types.submodule ({
- options = {
- url = mkOption {
- type = types.str;
- example = "https://thalheim.io";
- description = "Url to check";
- };
- regex = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "My homepage";
- description = "Regex that is matched against the returned content";
- };
- statusAccepted = mkOption {
- type = types.listOf types.int;
- default = [ 200 ];
- example = [ 401 ];
- description = "Expected http status code";
- };
- };
- }));
- default = {};
- description = ''
- httpcheck plugin: https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/httpcheck/httpcheck.conf
- '';
- };
-
- portcheck.checks = mkOption {
- type = types.attrsOf (types.submodule ({
- options = {
- host = mkOption {
- type = types.str;
- default = "127.0.0.1";
- description = "Dns name/IP to check";
- };
- port = mkOption {
- type = types.int;
- description = "Tcp port number";
- };
- };
- }));
- default = {};
- description = ''
- portcheck plugin: https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/portcheck
- '';
- };
- };
- config = mkIf cfg.enable {
- systemd.services.netdata = {
- after = [
- config.krebs.secret.files.netdata-stream.service
- ];
- partOf = [
- config.krebs.secret.files.netdata-stream.service
- ];
- };
- krebs.secret.files.netdata-stream = {
- path = "/run/secret/netdata-stream.conf";
- owner.name = "netdata";
- source-path = cfg.stream.file;
- };
- environment.etc."netdata/stream.conf".source = "/run/secret/netdata-stream.conf";
-
- services.netdata = {
- enable = true;
- config = {
- global = {
- "bind to" = "0.0.0.0:19999 [::]:19999";
- "error log" = "stderr";
- "update every" = "5";
- };
- health.enable = if cfg.stream.role == "master" then "yes" else "no";
- };
- };
- services.netdata.python.extraPackages = ps: [
- ps.psycopg2 ps.docker ps.dnspython
- ];
-
- makefu.netdata.portcheck.checks.openssh.port = (lib.head config.services.openssh.ports);
-
- networking.firewall.allowedTCPPorts = [ 19999 ];
-
- environment.etc."netdata/python.d/httpcheck.conf".text = ''
- update_every: 30
- ${lib.concatStringsSep "\n" (mapAttrsToList (site: options:
- ''
- ${site}:
- url: '${options.url}'
- ${optionalString (options.regex != null) "regex: '${options.regex}'"}
- status_accepted: [ ${lib.concatStringsSep " " (map toString options.statusAccepted) } ]
- '') cfg.httpcheck.checks)
- }
- '';
-
- environment.etc."netdata/python.d/portcheck.conf".text = ''
- ${lib.concatStringsSep "\n" (mapAttrsToList (service: options:
- ''
- ${service}:
- host: '${options.host}'
- port: ${toString options.port}
- '') cfg.portcheck.checks)
- }
- '';
- systemd.services.netdata.restartTriggers = [
- config.environment.etc."netdata/python.d/httpcheck.conf".source
- config.environment.etc."netdata/python.d/portcheck.conf".source
- config.environment.etc."netdata/stream.conf".source
- ];
-
- environment.etc."netdata/health.d/httpcheck.conf".text = ''
- # taken from the original but warn only if a request is at least 300ms slow
- template: web_service_slow
- families: *
- on: httpcheck.responsetime
- lookup: average -3m unaligned of time
- units: ms
- every: 10s
- warn: ($this > ($1h_web_service_response_time * 4) && $this > 1000)
- crit: ($this > ($1h_web_service_response_time * 6) && $this > 1000)
- info: average response time over the last 3 minutes, compared to the average over the last hour
- delay: down 5m multiplier 1.5 max 1h
- options: no-clear-notification
- to: webmaster
- '';
-
- };
- # TODO: notification
- # environment.etc."netdata/health_alarm_notify.conf".source = "/run/keys/netdata-pushover.conf";
-
-}
diff --git a/makefu/3modules/opentracker.nix b/makefu/3modules/opentracker.nix
deleted file mode 100644
index 6c65b82b6..000000000
--- a/makefu/3modules/opentracker.nix
+++ /dev/null
@@ -1,55 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-let
- cfg = config.makefu.opentracker;
-
- out = {
- options.makefu.opentracker = api;
- config = lib.mkIf cfg.enable imp;
- };
-
- api = {
- enable = mkEnableOption "opentracker";
-
- package = mkOption {
- type = types.package;
- default = pkgs.opentracker;
- };
-
- args = mkOption {
- type = types.separatedString;
- description = ''
- see https://erdgeist.org/arts/software/opentracker/ for all params
- '';
- default = "";
- };
-
- user = mkOption {
- description = ''
- user which will run opentracker. by default opentracker drops all
- privileges and runs in chroot after starting up as root.
- '';
- type = types.str;
- default = "root";
- };
- };
-
- imp = {
- systemd.services.opentracker = {
- description = "opentracker server";
- after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
- restartIfChanged = true;
- serviceConfig = {
- Type = "simple";
- ExecStart = "${cfg.package}/bin/opentracker ${cfg.args}";
- PrivateTmp = true;
- WorkingDirectory = "/tmp";
- User = "${cfg.user}";
- };
- };
- };
-in
-out
-
diff --git a/makefu/3modules/populate.nix b/makefu/3modules/populate.nix
deleted file mode 100644
index 19d3b3690..000000000
--- a/makefu/3modules/populate.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{config, lib, pkgs, ... }:
-
-{
- options.makefu.full-populate = lib.mkEnableOption "always do a full clone of nixpkgs";
-}
diff --git a/makefu/3modules/ps3netsrv.nix b/makefu/3modules/ps3netsrv.nix
deleted file mode 100644
index a0a6eb1f4..000000000
--- a/makefu/3modules/ps3netsrv.nix
+++ /dev/null
@@ -1,60 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-let
- cfg = config.makefu.ps3netsrv;
-
- out = {
- options.makefu.ps3netsrv = api;
- config = lib.mkIf cfg.enable imp;
- };
-
- api = {
- enable = mkEnableOption "ps3netsrv";
-
- servedir = mkOption {
- description = "path to serve, must be set";
- type = types.str;
- };
-
- package = mkOption {
- type = types.package;
- default = pkgs.ps3netsrv;
- };
-
- user = mkOption {
- description = ''user which will run ps3netsrv'';
- type = types.str;
- default = "ps3netsrv";
- };
- };
-
- imp = {
- systemd.services.ps3netsrv = {
- description = "ps3netsrv server";
- after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
- restartIfChanged = true;
- unitConfig = {
- Documentation = "https://www.arm-blog.com/playing-ps3-games-from-your-nas/" ;
- ConditionPathExists = cfg.servedir;
- };
- serviceConfig = {
- Type = "simple";
- ExecStart = "${cfg.package}/bin/ps3netsrv ${shell.escape cfg.servedir}";
- PrivateTmp = true;
- User = "${cfg.user}";
- };
- };
-
- # TODO only create if user is ps3netsrv
- users.users.ps3netsrv = {
- uid = genid "ps3netsrv";
- isSystemUser = true;
- group = "ps3netsrv";
- };
- users.groups.ps3netsrv.gid = genid "ps3netsrv";
- };
-in
-out
-
diff --git a/makefu/3modules/sane-extra.nix b/makefu/3modules/sane-extra.nix
deleted file mode 100644
index 8cbed572c..000000000
--- a/makefu/3modules/sane-extra.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-{ config, lib, pkgs, ... }:
-# https://github.com/michalrus/dotfiles/blob/d943be3089aa436e07cea5f22d829402936a9229/.nixos-config.symlink/modules/sane-extra-config.nix
-# via https://github.com/NixOS/nixpkgs/issues/17411
-# via https://unix.stackexchange.com/questions/321954/install-epson-v39-on-nixos
-with lib;
-
-let
-
- cfg = config.hardware.sane;
-
- pkg = if cfg.snapshot
- then pkgs.sane-backends-git
- else pkgs.sane-backends;
-
- backends = [ pkg ] ++ cfg.extraBackends;
-
- saneConfig = pkgs.mkSaneConfig { paths = backends; };
-
- saneExtraConfig = pkgs.runCommand "sane-extra-config" {} ''
- cp -Lr '${pkgs.mkSaneConfig { paths = [ pkgs.sane-backends ]; }}'/etc/sane.d $out
- chmod +w $out
- ${concatMapStrings (c: ''
- f="$out/${c.name}.conf"
- [ ! -e "$f" ] || chmod +w "$f"
- cat ${builtins.toFile "outfile" (c.value + "\n")} >>"$f"
- chmod -w "$f"
- '') (mapAttrsToList nameValuePair cfg.extraConfig)}
- chmod -w $out
- '';
-
-in
-
-{
- options = {
- hardware.sane.extraConfig = mkOption {
- type = types.attrsOf types.lines;
- default = {};
- example = { "some-backend" = "# some lines to add to its .conf"; };
- };
- };
-
- config = mkIf (cfg.enable && cfg.extraConfig != {}) {
- hardware.sane.configDir = saneExtraConfig.outPath;
- };
-}
diff --git a/makefu/3modules/server-config.nix b/makefu/3modules/server-config.nix
deleted file mode 100644
index 9cac59205..000000000
--- a/makefu/3modules/server-config.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{config, lib, pkgs, ... }:
-
-with lib;{
- options.makefu.server.primary-itf = lib.mkOption {
- type = types.str;
- description = "Primary interface of the server";
- };
- options.makefu.gui.user = lib.mkOption {
- type = types.str;
- description = "GUI user";
- default = config.krebs.build.user.name;
- };
-}
-
diff --git a/makefu/3modules/snapraid.nix b/makefu/3modules/snapraid.nix
deleted file mode 100644
index 25254c142..000000000
--- a/makefu/3modules/snapraid.nix
+++ /dev/null
@@ -1,126 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-
-let
- # returns dirname without / , used as disk name
- dname = dir: replaceStrings ["/"] [""] (head (reverseList (splitString "/" dir)));
- snapraid-conf = ''
- # Disks
- ${concatMapStringsSep "\n" (d: "disk ${dname d} ${d}") cfg.disks}
- # Parity
- ${optionalString (cfg.parity != "") "parity ${cfg.parity}/snapraid.parity"}
-
- # content on Disks
- ${optionalString cfg.contentOnDisks
- concatMapStringsSep "\n" (d: "content ${d}/snapraid.content") cfg.disks}
-
- # content on Parity
- ${optionalString (cfg.contentOnParity && cfg.parity != "")
- "content ${cfg.parity}/snapraid.content"}
- # Default content file
- content ${cfg.defaultContentFile}
-
- # Extra Configuration
- ${cfg.extraConfig}
- '';
- cfg = config.makefu.snapraid;
-
- out = {
- options.makefu.snapraid = api;
- config = lib.mkIf cfg.enable imp;
- };
-
- api = {
- enable = mkEnableOption "snapraid";
-
- timerConfig = mkOption {
- type = with types;attrsOf str;
- description = ''
- Start snapraid service
- '';
- default = {
- OnCalendar = "daily";
- };
- };
- disks = mkOption {
- type = with types;listOf str;
- description = ''
- Disks to protect. Each disk is a path to the mounted directory of the
- disk.
- '';
- };
- parity = mkOption {
- type = types.str;
- description = ''
- Folder to store parity file.
- Set to empty