Initial commit

This commit is contained in:
Ciapa 2023-04-12 14:47:22 +02:00
commit d4dab40a9a
77 changed files with 1685 additions and 0 deletions

35
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,35 @@
image: nixos/nix
variables:
NIXOS_VERSION: "unstable"
NIXPKGS_ALLOW_UNFREE: "1"
NIXPKGS_ALLOW_INSECURE: "1"
stages:
- test
- deploy
before_script:
- mv .gitlab/passwd /etc/passwd
- mv .gitlab/group /etc/group
- mv nix.conf /etc/nix/nix.conf
- nix-channel --add https://nixos.org/channels/nixos-${NIXOS_VERSION} nixos
- nix-channel --update
test:
stage: test
script:
- nix flake check
deploy:
stage: deploy
script:
# Init OpenSSH
- nix-env -iA nixos.openssh
- eval "$(ssh-agent -s)"
- chmod 0600 $SSH_PRIVATE_KEY
- ssh-add $SSH_PRIVATE_KEY
# Deploy everything
- nix develop --command deploy
rules:
- if: $CI_COMMIT_BRANCH == "master"

3
.gitlab/group Normal file
View File

@ -0,0 +1,3 @@
nixbld:x:30000:nixbld1,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld2,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld3,nixbld30,nixbld31,nixbld32,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9
nobody:x:65534:nobody
root:x:0:root

34
.gitlab/passwd Normal file
View File

@ -0,0 +1,34 @@
nixbld1:x:30001:30000:Nix build user 1:/var/empty:/bin/false
nixbld10:x:30010:30000:Nix build user 10:/var/empty:/bin/false
nixbld11:x:30011:30000:Nix build user 11:/var/empty:/bin/false
nixbld12:x:30012:30000:Nix build user 12:/var/empty:/bin/false
nixbld13:x:30013:30000:Nix build user 13:/var/empty:/bin/false
nixbld14:x:30014:30000:Nix build user 14:/var/empty:/bin/false
nixbld15:x:30015:30000:Nix build user 15:/var/empty:/bin/false
nixbld16:x:30016:30000:Nix build user 16:/var/empty:/bin/false
nixbld17:x:30017:30000:Nix build user 17:/var/empty:/bin/false
nixbld18:x:30018:30000:Nix build user 18:/var/empty:/bin/false
nixbld19:x:30019:30000:Nix build user 19:/var/empty:/bin/false
nixbld2:x:30002:30000:Nix build user 2:/var/empty:/bin/false
nixbld20:x:30020:30000:Nix build user 20:/var/empty:/bin/false
nixbld21:x:30021:30000:Nix build user 21:/var/empty:/bin/false
nixbld22:x:30022:30000:Nix build user 22:/var/empty:/bin/false
nixbld23:x:30023:30000:Nix build user 23:/var/empty:/bin/false
nixbld24:x:30024:30000:Nix build user 24:/var/empty:/bin/false
nixbld25:x:30025:30000:Nix build user 25:/var/empty:/bin/false
nixbld26:x:30026:30000:Nix build user 26:/var/empty:/bin/false
nixbld27:x:30027:30000:Nix build user 27:/var/empty:/bin/false
nixbld28:x:30028:30000:Nix build user 28:/var/empty:/bin/false
nixbld29:x:30029:30000:Nix build user 29:/var/empty:/bin/false
nixbld3:x:30003:30000:Nix build user 3:/var/empty:/bin/false
nixbld30:x:30030:30000:Nix build user 30:/var/empty:/bin/false
nixbld31:x:30031:30000:Nix build user 31:/var/empty:/bin/false
nixbld32:x:30032:30000:Nix build user 32:/var/empty:/bin/false
nixbld4:x:30004:30000:Nix build user 4:/var/empty:/bin/false
nixbld5:x:30005:30000:Nix build user 5:/var/empty:/bin/false
nixbld6:x:30006:30000:Nix build user 6:/var/empty:/bin/false
nixbld7:x:30007:30000:Nix build user 7:/var/empty:/bin/false
nixbld8:x:30008:30000:Nix build user 8:/var/empty:/bin/false
nixbld9:x:30009:30000:Nix build user 9:/var/empty:/bin/false
nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:/nix/store/c7klanhckqpsvv4x2izcyzvfb8vazy4s-shadow-4.11.1/bin/nologin
root:x:0:0:System administrator:/root:/nix/store/bap4d0lpcrhpwmpb8ayjcgkmvfj62lnq-bash-interactive-5.1-p16/bin/bash

15
.sops.yaml Normal file
View File

@ -0,0 +1,15 @@
keys:
# Admins
- &admin_ecchi age17wdazshqnfe63cy7mmsmwld75e5wedgn8gngvmvlqdktlr86c4us87tjxv
# Regular Users
# - &user_name key
# Hosts
- &host_kinda_sus_lol age187hkscvxar33wta3zvgypj6kkc02g6sewwmfwmup26z2fuhwpamsa2d8yh
creation_rules:
# kinda.sus.lol
- path_regex: hosts/kinda.sus.lol/secrets/.*\.yaml
key_groups:
- age:
- *admin_ecchi
- *host_kinda_sus_lol

1
README.md Normal file
View File

@ -0,0 +1 @@
# infrastructure

28
default.nix Normal file
View File

@ -0,0 +1,28 @@
{ pkgs, config, lib, ... }:
let
utils = import ./util/include.nix { lib = lib; };
imports =
(utils.includeDir ./modules/base) ++
[
./overlay
];
in
{
inherit imports;
nix = {
package = pkgs.nixVersions.stable;
extraOptions = ''
experimental-features = nix-command flakes
'';
settings = {
substituters = [
"https://cache.nixos.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
};
}

View File

@ -0,0 +1,46 @@
{ config, ... }:
{
imports = [
./xslt_template.nix
./rclone_mount.nix
];
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
virtualHosts."mirror.lewd.wtf" = {
serverName = "${config.variables.hostName}.${config.variables.domain}";
enableACME = true;
forceSSL = true;
root = "/var/www/mirror/mirror/";
locations = {
"/" = {
extraConfig = ''
if ($arg_format = "json") {
rewrite ^ /json$request_uri last;
}
autoindex on;
autoindex_format xml;
xslt_stylesheet /etc/nginx/mirror.xslt dirname='$1';
'';
};
"/json/" = {
alias = "/var/www/mirror/mirror/";
extraConfig = ''
autoindex on;
autoindex_format json;
'';
};
"/private/" = {
alias = "/var/www/mirror/private/";
extraConfig = ''
autoindex off;
'';
};
"~ \.xml$" = {
};
};
};
};
}

View File

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
systemd.services.rclone_mount = {
enable = true;
description = "RClone Mount";
serviceConfig = {
Type = "notify";
KillMode = "none";
User = "root";
ExecStart = "${pkgs.rclone}/bin/rclone mount master:/mnt/data /var/www/mirror --allow-other --dir-cache-time=5m --log-level INFO --umask 002 --cache-dir /mnt/cache --vfs-cache-mode full --vfs-cache-max-age 72h0m0s --vfs-cache-max-size 5Gi";
ExecStop = "/run/wrappers/bin/fusermount -uz /var/www/mirror";
Restart = "on-failure";
Environment = [ "PATH=/run/wrappers/bin/:$PATH" ];
};
wantedBy = [ "multi-user.target"];
wants = [ "network-online.target"];
after = [ "network-online.target"];
};
}

View File

@ -0,0 +1,8 @@
{
environment.etc = {
"nginx/mirror.xslt" = {
source = ./xslt_template.xslt;
mode = "0444";
};
};
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
<xsl:choose>
<xsl:when test="$text = '' or $replace = ''or not($replace)" >
<!-- Prevent this routine from hanging -->
<xsl:value-of select="$text" />
</xsl:when>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)" />
<xsl:value-of select="$by" />
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace" />
<xsl:with-param name="by" select="$by" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<link href="/private/asset/icons.css" rel="stylesheet" />
<link href="/private/asset/style.css" rel="stylesheet" />
</head>
<body>
<header>
<h3>Lewd.wtf Mirror Service</h3>
<p>Welcome to the mirror service of lewd.wtf! I provide this service free of charge to projects that could benefit from it.</p>
<p>Want to get your files hosted here? Please contact me at <b>mirror_request@lewd.wtf</b> and provide details regarding your projects.</p>
<h1>Proud Sineater and Sin's Cove Hater!</h1>
<p>If you come here from Sin's Cove, please close this page. This site is hosted by Ecchibitionist, the person you constantly harass.</p>
<p>You claim I bullied the original developer of EmuSAK, even though that's a blatant lie (and you know it).</p>
</header>
<main>
<h4>
<xsl:value-of select="$dirname"/>
</h4>
<table>
<tr>
<th>Name</th>
<th>Size</th>
</tr>
<tr>
<td><a href=".."><span class="material-icons back_folder_icon">drive_file_move_rtl</span>../</a></td>
<td align="right"></td>
</tr>
<xsl:for-each select="list/*">
<xsl:sort select="@name"/>
<xsl:variable name="name">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="." />
<xsl:with-param name="replace" select="'%'" />
<xsl:with-param name="by" select="'%25'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="size">
<xsl:if test="string-length(@size) &gt; 0">
<xsl:if test="number(@size) &gt; 0">
<xsl:choose>
<xsl:when test="round(@size div 1024) &lt; 1"><xsl:value-of select="@size" />B</xsl:when>
<xsl:when test="round(@size div 1048576) &lt; 1"><xsl:value-of select="format-number((@size div 1024), '0.0')" />KiB</xsl:when>
<xsl:otherwise><xsl:value-of select="format-number((@size div 1048576), '0.00')" />MiB</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
</xsl:variable>
<tr>
<td>
<a href="{$name}">
<xsl:choose>
<xsl:when test="string-length(@size)=0"><span class="material-icons folder">folder</span></xsl:when>
<xsl:when test="'.zip' = substring($name, string-length($name) - 3)"><span class="material-icons folder_zip"> folder_zip </span></xsl:when>
<xsl:when test="'.rar' = substring($name, string-length($name) - 3)"><span class="material-icons folder_zip"> folder_zip </span></xsl:when>
<xsl:otherwise><span class="material-icons file"> insert_drive_file </span></xsl:otherwise>
</xsl:choose>
<xsl:value-of select="."/>
</a>
</td>
<td align="right"><xsl:value-of select="$size"/></td>
</tr>
</xsl:for-each>
</table>
</main>
<footer>
<p>In case this mirror is hosting files that you believe shouldn't be here, please send a message to <a href="mailto:abuse@lewd.wtf">abuse@lewd.wtf</a> and we'll remove it as soon as possible.</p>
</footer>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,31 @@
{ config, pkgs, ... }:
let
cfg = config.variables.qbittorrent;
in
{
environment.systemPackages = [ pkgs.qbittorrent-nox ];
networking.firewall = {
allowedTCPPorts = [ cfg.torrentPort cfg.uiPort ];
allowedUDPPorts = [ cfg.torrentPort ];
};
systemd.services.qbittorrent = {
after = [ "network.target" ];
description = "qBittorrent Daemon";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.qbittorrent-nox ];
serviceConfig = {
ExecStart = ''
${pkgs.qbittorrent-nox}/bin/qbittorrent-nox \
--profile=${cfg.configDir} \
--webui-port=${toString cfg.uiPort}
'';
Restart = "on-success";
User = cfg.user;
Group = cfg.group;
UMask = "0002";
LimitNOFILE = cfg.openFilesLimit;
};
};
}

153
flake.lock Normal file
View File

@ -0,0 +1,153 @@
{
"nodes": {
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1674127017,
"narHash": "sha256-QO1xF7stu5ZMDLbHN30LFolMAwY6TVlzYvQoUs1RD68=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "8c9ea9605eed20528bf60fae35a2b613b901fd77",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1668681692,
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1681217261,
"narHash": "sha256-RbxCHWN3Vhyv/WEsXcJlDwF7bpvZ9NxDjfSouQxXEKo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3fb8eedc450286d5092e4953118212fa21091b3b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1681005198,
"narHash": "sha256-5LrnBeXR7Hv8OXh6eany7br4qBW+ZNl4LKf1CJu9zbg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e45cc0138829ad86e7ff17a76acf2d05e781e30a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
"utils": "utils_2"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1681209176,
"narHash": "sha256-wyQokPpkNZnsl/bVf8m1428tfA0hJ0w/qexq4EizhTc=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "00d5fd73756d424de5263b92235563bc06f2c6e1",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

217
flake.nix Normal file
View File

@ -0,0 +1,217 @@
{
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
deploy-rs = { url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; };
utils = { url = "github:numtide/flake-utils"; };
sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = { self, nixpkgs, deploy-rs, utils, sops-nix, ... }@inputs:
{
nixosConfigurations = {
"fsn1-1.mirror.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/fsn1-1.mirror.lewd.wtf/configuration.nix
./deployments/mirror/default.nix
];
};
"ash1-1.mirror.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/ash1-1.mirror.lewd.wtf/configuration.nix
./deployments/mirror/default.nix
];
};
"hil1-1.mirror.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/hil1-1.mirror.lewd.wtf/configuration.nix
./deployments/mirror/default.nix
];
};
"master.mirror.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/master.mirror.lewd.wtf/configuration.nix
];
};
"nyx.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/nyx.lewd.wtf/configuration.nix
];
};
"aztul.elmosco.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/seedbox/aztul/configuration.nix
];
};
"kitty.elmosco.lewd.wtf" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/seedbox/kitty/configuration.nix
];
};
"kinda.sus.lol" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs self; };
modules = [
sops-nix.nixosModules.sops
./default.nix
./hosts/kinda.sus.lol/configuration.nix
];
};
};
deploy.nodes = {
"fsn1-1.mirror.lewd.wtf" = {
sshOpts = [ "-p" "222" "-o" "StrictHostKeyChecking=no" ];
hostname = "fsn1-1.mirror.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."fsn1-1.mirror.lewd.wtf";
user = "root";
};
};
"ash1-1.mirror.lewd.wtf" = {
sshOpts = [ "-p" "222" "-o" "StrictHostKeyChecking=no" ];
hostname = "ash1-1.mirror.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."ash1-1.mirror.lewd.wtf";
user = "root";
};
};
"hil1-1.mirror.lewd.wtf" = {
sshOpts = [ "-p" "222" "-o" "StrictHostKeyChecking=no" ];
hostname = "hil1-1.mirror.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."hil1-1.mirror.lewd.wtf";
user = "root";
};
};
"master.mirror.lewd.wtf" = {
sshOpts = [ "-p" "222" "-o" "StrictHostKeyChecking=no" ];
hostname = "master.mirror.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."master.mirror.lewd.wtf";
user = "root";
};
};
"nyx.lewd.wtf" = {
sshOpts = [ "-p" "222" "-o" "StrictHostKeyChecking=no" ];
hostname = "192.168.0.10";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."nyx.lewd.wtf";
user = "root";
};
};
"aztul.elmosco.lewd.wtf" = {
sshOpts = [ "-p" "22111" "-o" "StrictHostKeyChecking=no" ];
hostname = "aztul.elmosco.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."aztul.elmosco.lewd.wtf";
user = "root";
};
};
"kitty.elmosco.lewd.wtf" = {
sshOpts = [ "-p" "22105" "-o" "StrictHostKeyChecking=no" ];
hostname = "kitty.elmosco.lewd.wtf";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."kitty.elmosco.lewd.wtf";
user = "root";
};
};
"kinda.sus.lol" = {
sshOpts = [ "-p" "22201" "-o" "StrictHostKeyChecking=no" ];
hostname = "kinda.sus.lol";
fastConnection = true;
profiles.system = {
sshUser = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."kinda.sus.lol";
user = "root";
};
};
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
} // utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
deploy-rs.defaultPackage.${system}
apacheHttpd
nixpkgs-fmt
];
};
}
);
}

View File

@ -0,0 +1,20 @@
{ self, config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
variables.hostName = "ash1-1";
variables.domain = "mirror.lewd.wtf";
networking.hostName = "${config.variables.hostName}";
networking.domain = "${config.variables.domain}";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,8 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
}

View File

@ -0,0 +1,20 @@
{ self, config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
variables.hostName = "fsn1-1";
variables.domain = "mirror.lewd.wtf";
networking.hostName = "${config.variables.hostName}";
networking.domain = "${config.variables.domain}";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,8 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
}

View File

@ -0,0 +1,20 @@
{ self, config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
variables.hostName = "hil1-1";
variables.domain = "mirror.lewd.wtf";
networking.hostName = "${config.variables.hostName}";
networking.domain = "${config.variables.domain}";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,8 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
}

View File

@ -0,0 +1,27 @@
{ self, config, pkgs, lib, ... }:
let
utils = import ../../util/include.nix { lib = lib; };
imports =
(utils.includeDir ./services) ++
(utils.includeDir ./storage_users) ++
[
./hardware-configuration.nix
./networking.nix
./sftp_jail.nix
./secrets.nix
];
in
{
inherit imports;
networking.hostName = "kinda";
networking.domain = "sus.lol";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,35 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.kernelModules = [ "kvm-intel" ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/var/lib" = {
device = "/dev/disk/by-label/varlib";
fsType = "ext4";
};
fileSystems."/mnt/data" = {
device = "/dev/disk/by-uuid/1147e812-b85d-4690-bbb1-d8ba5c398798";
fsType = "ext4";
};
fileSystems."/mnt/archive" = {
device = "//u203375.your-storagebox.de/backup/media_archive";
fsType = "cifs";
options = [ "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,seal,iocharset=utf8,credentials=/root/.smbcredentials,uid=0,gid=993,file_mode=0775,dir_mode=0775,cache=loose" ];
};
# Common mounts
fileSystems."/sftp_jail/common/media" = {
device = "/mnt/data/media";
options = [ "bind,ro" ];
};
fileSystems."/sftp_jail/common/archive" = {
device = "/mnt/archive";
options = [ "bind,ro" ];
};
}

View File

@ -0,0 +1,12 @@
{ ... }:
{
networking.defaultGateway = "192.168.99.1";
networking.nameservers = [ "1.1.1.1" ];
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.99.201";
prefixLength = 24;
}
];
networking.enableIPv6 = false;
}

View File

@ -0,0 +1,17 @@
{ config, ... }:
{
sops.defaultSopsFile = ./secrets/nginx.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# Nginx
sops.secrets."services/nginx/admin.htpasswd" = {
mode = "0400";
owner = config.users.users.nginx.name;
group = config.users.users.nginx.group;
};
sops.secrets."services/nginx/ecchi.htpasswd" = {
mode = "0400";
owner = config.users.users.nginx.name;
group = config.users.users.nginx.group;
};
}

View File

@ -0,0 +1,33 @@
services:
nginx:
admin.htpasswd: ENC[AES256_GCM,data:SYy91gzsVPwca7QHsAFnDV7e9hLoqS1+xeFyLNTa7WwFwT6sbvboMEnZUQ==,iv:RX8+6Ivx0ibZvoMlaxIGzJ1/OzMgOHu94J/lsvF5UqY=,tag:LtBBAlmRI0jskINGR7Gw/Q==,type:str]
ecchi.htpasswd: ENC[AES256_GCM,data:w6VYz0uQun4QiSmpqjwVLDRseVND0pHNzFxlD9F/0j7YqeHTo8gl1AI2cQ==,iv:7KKyUyoVtvIiZuQTmtKzWjZwr7heVX2K2C/WRSOPh0A=,tag:iOdURKQGTh+wt4PcEXCGUg==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age17wdazshqnfe63cy7mmsmwld75e5wedgn8gngvmvlqdktlr86c4us87tjxv
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBPSXdEdk5iWFl2RmJTeXlk
b2VwUE9TdXAwS0pWOXdsZXFUanlZMWVjS3p3CkNuQ3RTTEFzRGFsK3o3bUFpVTV4
OVJ0dzB6cW15a2ZYdkI1dnRvZWtxZUUKLS0tIFhKdGVzYkNqRjROaFdSMit5R1hM
QlM0UHJPT3JzWkFXSVUxNTZvcVY5NlkK8zS6V3UD3e92apzFlB6/yLDXvGMeW+0q
rThPZQvABXiamWpoU27rBxg26CsnuVoF2CXINIoPZvSq1bt+t5nlag==
-----END AGE ENCRYPTED FILE-----
- recipient: age187hkscvxar33wta3zvgypj6kkc02g6sewwmfwmup26z2fuhwpamsa2d8yh
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0NXFvaENiSnJEeEJQWW9k
M3BwVDJwZ0F2Z25odWJBamR3bVh2NHFCNTIwCm82TVVIV1JmZitOeUVBb0hUL0Mx
bXZaL3F5ZTBlVDJRSzdybDBrdlNZdjAKLS0tIFBadmlDdW4yb2pKUHh0S2grTHVP
a1d3ekVWMDV4dUxrSGNod2JvYmtHMmMKnBaqvtBd53Jz9CtkOeEJ93YBeGA8pmof
VlSrnXcJmZ3tG1GwVOu8Q9Xr5gXrvaG4HGvETLsGBafxVtMTU4v8KQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2023-04-12T12:01:27Z"
mac: ENC[AES256_GCM,data:Rr3ytpKR2UKuREKJF67PRbVwOf2UXKdXtwEjxA3a7dFSyujNWHL90J3beDTyWaWpPzlmj/ZjeMiSNd80U8A/l/gGSSlASa2bFzJZLlvSRdsRYnM2IuyhtGN4HK0WoyLzruiOX9P2kRJYIkOgMg/8qu0szf8okz4bdXtKz/d5nBQ=,iv:IqIPz5lESrFxkVmreT7uVjEwMr0uwmxEldWjde6ivyA=,tag:mUaAFSkDHRgrRbLITY71NQ==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.7.3

View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
jellyfin-ffmpeg
];
services.jellyfin = {
enable = true;
openFirewall = true;
};
}

View File

@ -0,0 +1,6 @@
{
services.jellyseerr = {
enable = true;
openFirewall = true;
};
}

View File

@ -0,0 +1,66 @@
{ config, ... }:
{
networking.firewall.allowedTCPPorts = [ 80 443 ];
users.users.nginx.extraGroups = [ config.users.groups.keys.name ];
services.nginx = {
enable = true;
virtualHosts."kinda.sus.lol" = {
serverName = "kinda.sus.lol";
locations = {
"/admin/sonarr" = {
extraConfig = ''
auth_basic "Show slit";
auth_basic_user_file /run/secrets/services/nginx/admin.htpasswd;
proxy_pass http://127.0.0.1:8989;
proxy_read_timeout 900;
proxy_connect_timeout 900;
proxy_send_timeout 900;
send_timeout 900;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
'';
};
"/admin/radarr" = {
extraConfig = ''
auth_basic "Show slit";
auth_basic_user_file /run/secrets/services/nginx/admin.htpasswd;
proxy_pass http://127.0.0.1:7878;
proxy_read_timeout 900;
proxy_connect_timeout 900;
proxy_send_timeout 900;
send_timeout 900;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
'';
};
"/admin/prowlarr" = {
extraConfig = ''
auth_basic "Show slit";
auth_basic_user_file /run/secrets/services/nginx/admin.htpasswd;
proxy_pass http://127.0.0.1:9696;
proxy_read_timeout 900;
proxy_connect_timeout 900;
proxy_send_timeout 900;
send_timeout 900;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
'';
};
};
};
};
}

View File

@ -0,0 +1,6 @@
{
services.prowlarr = {
enable = true;
openFirewall = true;
};
}

View File

@ -0,0 +1,41 @@
{
imports =
[
../../../deployments/seedbox/qbittorrent/default.nix
];
variables.qbittorrent = {
user = "qbittorrent";
group = "jellyfin";
torrentPort = 60836;
uiPort = 8888;
configDir = "/var/lib/qbittorrent";
openFilesLimit = 8192;
};
users.users.qbittorrent = {
group = "jellyfin";
isSystemUser = true;
home = "/var/lib/qbittorrent";
};
services.nginx = {
virtualHosts."ecchi.elmosco.lewd.wtf" = {
serverName = "ecchi.elmosco.lewd.wtf";
locations = {
"/" = {
extraConfig = ''
auth_basic "Show slit";
auth_basic_user_file /run/secrets/services/nginx/ecchi.htpasswd;
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
client_max_body_size 50M;
'';
};
};
};
};
}

View File

@ -0,0 +1,6 @@
{
services.radarr = {
enable = true;
group = "jellyfin";
};
}

View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
p7zip
];
services.sabnzbd = {
enable = true;
group = "jellyfin";
};
}

View File

@ -0,0 +1,10 @@
{
virtualisation.oci-containers.containers = {
seedcross = {
image = "registry.lewd.wtf/ciapa/seedcross";
autoStart = true;
ports = [ "127.0.0.1:8019:8019" ];
volumes = [ "seedcross:/code/seedcross/db" ];
};
};
}

View File

@ -0,0 +1,6 @@
{
services.sonarr = {
enable = true;
group = "jellyfin";
};
}

View File

@ -0,0 +1,10 @@
{
services.openssh.extraConfig = ''
Match Group sftponly
ChrootDirectory /sftp_jail
ForceCommand internal-sftp
AllowTcpForwarding no
'';
users.groups.sftponly = {};
}

View File

@ -0,0 +1,12 @@
{
users.users.jbrn = {
group = "sftponly";
isNormalUser = true;
home = "/sftp_jail/jbrn";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG3eO5g2TPLcE3pzt/6XiGqGjbAeCr41s+5mSR0aZuHt jrbn"
];
};
}

View File

@ -0,0 +1,25 @@
{ self, config, pkgs, lib, ... }:
let
utils = import ../../util/include.nix { lib = lib; };
imports =
(utils.includeDir ./mirror_users) ++
[
./hardware-configuration.nix
./networking.nix
./sftp_jail.nix
];
in
{
inherit imports;
networking.hostName = "master";
networking.domain = "mirror.lewd.wtf";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,16 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.kernelModules = [ "kvm-intel" ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/mnt/data" = {
device = "/dev/disk/by-label/data";
fsType = "ext4";
};
}

View File

@ -0,0 +1,16 @@
{
users.users.abdulsalam = {
group = "sftponly";
isNormalUser = true;
home = "/sftp_jail/abdulsalam";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE387jL1I99Ws/6BTS/lbiAlDXpyB9zaf08+KWx9U8kd abdulsalam"
];
};
fileSystems."/sftp_jail/abdulsalam/mirror/saves" = {
device = "/mnt/data/private/nintendo/switch/savegames";
options = [ "bind" ];
};
}

View File

@ -0,0 +1,16 @@
{
users.users.archbox = {
group = "sftponly";
isNormalUser = true;
home = "/sftp_jail/archbox";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJTWN+J6qFf60b58AIEXW/yuDwb7bwoyONKvM10kolWU archbox"
];
};
fileSystems."/sftp_jail/archbox/mirror/saves" = {
device = "/mnt/data/private/nintendo/switch/savegames";
options = [ "bind" ];
};
}

View File

@ -0,0 +1,20 @@
{
users.users.ecks = {
group = "sftponly";
isNormalUser = true;
home = "/sftp_jail/ecks";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINczWfNkdndU9bqB2PI1D3glO2CiIaEngXY5FnsodZjt ryusak"
];
};
fileSystems."/sftp_jail/ecks/mirror/ryusak" = {
device = "/mnt/data/mirror/archive/nintendo/switch/ryusak";
options = [ "bind" ];
};
fileSystems."/sftp_jail/ecks/mirror/shaders" = {
device = "/mnt/data/mirror/archive/nintendo/switch/shaders";
options = [ "bind" ];
};
}

View File

@ -0,0 +1,14 @@
{
users.users.mirror = {
group = "mirror";
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBGCcaz+17IbyUC/bbhG+m1yYiPa15Uut8GBywVREo1w root@fsn1-1"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOceXaCKbLpRq2LwS3Su6gZjqeIrCzBZfuA7rsKYa4BZ root@ash1-1"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMTUV7UVCWsv0xgLM7rQhGJhCWGX2bgHRG8pHuVEqImZ root@hil1-1"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKbd+qkj1A99nW71Ldip59KI6yNOao0A1l7Mv3GcXaA8 root@hel1-1"
];
};
users.groups.mirror = {};
}

View File

@ -0,0 +1,18 @@
{
users.groups.void = {};
users.users.void = {
group = "void";
isNormalUser = true;
home = "/home/void";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC+zfpUS+6gukPJ2WmU8ZFq7h7WRO9aGcze/gPd2TldyTB9tS/0T/5aDfKXzgE121lTmKX3bQru4bdJI1OIIT1YB8CsHFoKaLXrA+grl5GfIUxdgSKtkgJg1n8jH4qL43Zy/J4m1VrAyJBT6CnneDZEa88PizL0K74XGwxQx4zq6J66Csb+lEZfYly8oxNjoTDPNuXKYAX7ko44F5guv92/3XBtZ0wcRFE0IIaWzAOFMnUNrOjEWDiOjUMLNt18eNidsZFLrqdLc24EdZdztrKDIuuzIbx1H1ir9NUQxCIHd1wdqq8ndpkRdhNyOCjPuO2bgB6+eh6gLsFA+7f5CUOCgQ2wDTQdxi0EuA3Qn3hJhiISYe+og1UjhV5942nwH33qWuAg1fE1Sa0unRPCxoYnFbDddSR1d5SBkoqakgFEW0zjEaqIb4H0TeyV/gDs949lganC55wt2YZfXD41Kbi2qTF5KFS722rgObLZ2/3+2iCgJLjAD4qg2SFbi6sLUsc= master@Project-Kratos"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC614pP9wU/s+u2dFSV/DqpWqo9ngntZ9JpVMUikWc+9UYlq9SpOfr8MM10MOLJiolSeMNMi6NmNQ7Ge5C9O4d0MFQbA87NbGvmQzKYnTsQkRLrQlaDbkTYn8mirqV+vZLBF4ignF2JO0YlbfGXR2dBpdj/zk1WER5w3hIXx6H3ITVxBaOrUpd3gKuHg2YQ7j7whQq/kpoM3PVcdPZUDFB81NttKmyB4vbEmZOYSHx8p53pS8KH3D1kooVTHOuhzILzDPcXrlnFOhtQ5wkknBawq6Tf+1POlQ9TvsSaC79UbExdLOc+776rpGkE1iZ02XWDsAE1E0udDKiX+PhAN+lAXVHX34Jh+THmO36BTxFhSAR35pePL14c6XX+/kta7FEM4O/pl1eIAFnuObHDoL0yF9ruATNJuJWzPfieTBll3DpYH92gENmdT3Rg9sz6yxcY7ubmvZMVAC8R/8QJvlh3pPQC6BckOvOsMHVMdZrI6yBg1veKoZNCqyRl449QGJU= master@DESKTOP-V6SN4JP"
];
};
fileSystems."/home/void/mirror/pico" = {
device = "/mnt/data/mirror/archive/picoxr";
options = [ "bind" ];
};
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
networking.defaultGateway = "192.168.11.1";
networking.nameservers = [ "1.1.1.1" ];
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.11.110";
prefixLength = 24;
}
];
}

View File

@ -0,0 +1,10 @@
{
services.openssh.extraConfig = ''
Match Group sftponly
ChrootDirectory /sftp_jail
ForceCommand internal-sftp
AllowTcpForwarding no
'';
users.groups.sftponly = {};
}

View File

@ -0,0 +1,23 @@
{ self, config, pkgs, lib, ... }:
let
utils = import ../../util/include.nix { lib = lib; };
imports =
(utils.includeDir ./services) ++
[
./hardware-configuration.nix
./networking.nix
./users.nix
];
in
{
inherit imports;
networking.hostName = "nyx";
networking.domain = "lewd.wtf";
boot.loader.grub.enable = false;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,35 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/adde8f5f-358d-4ed2-835a-8fecbe4a86a4";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8D9D-CCA2";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/6cee1359-6e2c-45fc-927d-f2a558f0ec5d";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/474244b3-df18-4af7-badf-d7b2531ae17c"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
networking.defaultGateway = "192.168.0.1";
networking.nameservers = [ "192.168.0.69" ];
networking.interfaces.enp2s0.ipv4.addresses = [
{
address = "192.168.0.10";
prefixLength = 22;
}
];
}

View File

@ -0,0 +1,22 @@
{
services.nginx.virtualHosts."kasm.lewd.wtf" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "https://192.168.122.104:443";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig =
"proxy_ssl_verify off;" +
"proxy_pass_header Authorization;" +
"proxy_set_header Host $host;" +
"proxy_set_header X-Real-IP $remote_addr;" +
"proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;" +
"proxy_set_header X-Forwarded-Proto $scheme;" +
"proxy_read_timeout 1800s;" +
"proxy_send_timeout 1800s;" +
"proxy_connect_timeout 1800s;" +
"proxy_buffering off;"
;
};
};
}

View File

@ -0,0 +1,5 @@
{ pkgs, ...}:
{
virtualisation.libvirtd.enable = true;
security.polkit.enable = true;
}

View File

@ -0,0 +1,7 @@
{
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
};
}

View File

@ -0,0 +1,22 @@
{
services.uptime-kuma = {
enable = true;
settings = {
UPTIME_KUMA_PORT = "8099";
};
};
services.nginx.virtualHosts."status.lewd.wtf" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8099";
proxyWebsockets = true; # needed if you need to use WebSocket
extraConfig =
"proxy_set_header Host $host;" +
"proxy_set_header X-Real-IP $remote_addr;" +
"proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;" +
"proxy_set_header X-Forwarded-Proto $scheme;"
;
};
};
}

View File

@ -0,0 +1,13 @@
{ pkgs, ...}:
{
services.vikunja = {
enable = true;
setupNginx = true;
frontendScheme = "https";
frontendHostname = "todo.lewd.wtf";
};
services.nginx.virtualHosts."todo.lewd.wtf" = {
enableACME = true;
forceSSL = true;
};
}

View File

@ -0,0 +1,14 @@
{
users.groups.markus = {};
users.users.markus = {
group = "markus";
isNormalUser = true;
home = "/home/markus";
homeMode = "755";
createHome = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC2eur+tK9VTYqXTgYlJY1/oV1EzUhm4QZGEl4e3/kWr deck@steamdeck"
];
};
}

View File

@ -0,0 +1,25 @@
{ self, config, pkgs, lib, ... }:
let
utils = import ../../../util/include.nix { lib = lib; };
imports =
(utils.includeDir ./services) ++
[
./hardware-configuration.nix
./networking.nix
./users.nix
];
in
{
inherit imports;
networking.hostName = "aztul";
networking.domain = "elmosco.lewd.wtf";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,16 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.kernelModules = [ "kvm-intel" ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/home" = {
device = "/dev/disk/by-label/home";
fsType = "ext4";
};
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
networking.defaultGateway = "192.168.99.1";
networking.nameservers = [ "1.1.1.1" ];
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.99.111";
prefixLength = 24;
}
];
}

View File

@ -0,0 +1,15 @@
{
imports =
[
../../../../deployments/seedbox/qbittorrent/default.nix
];
variables.qbittorrent = {
user = "aztul";
group = "aztul";
torrentPort = 56997;
uiPort = 8888;
configDir = "/home/aztul";
openFilesLimit = 8192;
};
}

View File

@ -0,0 +1,13 @@
{ pkgs, ...}:
{
networking.firewall.allowedTCPPorts = [ 9000 ];
services.thelounge = {
enable = true;
public = false;
extraConfig = {
prefetch = true;
};
plugins = [ pkgs.theLoungePlugins.themes.solarized ];
};
}

View File

@ -0,0 +1,12 @@
{
users.groups.aztul = {};
users.users.aztul = {
group = "aztul";
isNormalUser = true;
home = "/home/aztul";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDoxHTW8Izr/9g+UYI2ngLK9nTN8F4BEIEzKbs2zKcb8K2n9NP5qvC8VY3kHzceQSojN6yW+FcBVbjmPQUEQdIquNiIyu+SJU7qV3UpmXMaAU9Gdf5Y9jQJnV0lSwByk7qcI8l4W0hqH3t0w99ihWiwzGzn4Ay0oFuGRGdsltw+OaFXmlSqtUSwSYam88XorY+c76VP/hL9R8b5ac1ZZeJ8w/i7nw17DrxCNiL4y+dDCed3wqaqFUVpY66nSij3rGGbhREVlBNKcOHBElYkMXjn6vcMXCo3vmswiTTOlODtLfA9KELGuAwtvCJUUeSaLeiHznv5C9QcSTxvKq9s5A4z aztul"
];
};
}

View File

@ -0,0 +1,25 @@
{ self, config, pkgs, lib, ... }:
let
utils = import ../../../util/include.nix { lib = lib; };
imports =
(utils.includeDir ./services) ++
[
./hardware-configuration.nix
./networking.nix
./users.nix
];
in
{
inherit imports;
networking.hostName = "kitty";
networking.domain = "elmosco.lewd.wtf";
boot.loader.grub = {
enable = true;
efiSupport = false;
devices = [ "/dev/sda" ];
};
system.stateVersion = "22.11";
}

View File

@ -0,0 +1,16 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.kernelModules = [ "kvm-intel" ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
fileSystems."/home" = {
device = "/dev/disk/by-label/home";
fsType = "ext4";
};
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
networking.defaultGateway = "192.168.99.1";
networking.nameservers = [ "1.1.1.1" ];
networking.interfaces.ens18.ipv4.addresses = [
{
address = "192.168.99.105";
prefixLength = 24;
}
];
}

View File

@ -0,0 +1,18 @@
{
virtualisation.oci-containers.containers = {
filebrowser = {
image = "filebrowser/filebrowser:s6";
autoStart = true;
ports = [ "80:8080" ];
volumes = [
"/home/kitty/shared:/home/kitty/shared"
"/home/kitty/filebrowser/config:/config"
"/home/kitty/filebrowser/database:/database"
];
environment = {
PUID = "1000";
PGID = "994";
};
};
};
}

View File

@ -0,0 +1,15 @@
{
imports =
[
../../../../deployments/seedbox/qbittorrent/default.nix
];
variables.qbittorrent = {
user = "kitty";
group = "kitty";
torrentPort = 57267;
uiPort = 8888;
configDir = "/home/kitty";
openFilesLimit = 8192;
};
}

View File

@ -0,0 +1,14 @@
{ pkgs, ...}:
{
networking.firewall.allowedTCPPorts = [ 9000 ];
services.thelounge = {
enable = true;
public = false;
extraConfig = {
prefetch = true;
messageStorage = [ "sqlite" "text" ];
};
plugins = [ pkgs.theLoungePlugins.themes.solarized ];
};
}

View File

@ -0,0 +1,14 @@
{
users.groups.kitty = {};
users.users.kitty = {
group = "kitty";
isNormalUser = true;
home = "/home/kitty";
homeMode = "755";
createHome = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming@DESKTOP-4ACM3JU"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQMGFxzIW62c1rudlhYOB9kKuzm3dZWu/PKh89GAtXccRz5Lq+AempZvuKX8LxvMoDsctocAmqKOfthQUUNP3rJtrEzyuEV7tpZ21oJ03ALW4uJUz306lsHoEjet6x2w83OmXp3p7bX+PphjVu83M2P6rO0QuWxSutoQRK/Zc09lSpJiSMqh8tH9rc7t3gBwhvhIRAWGBSjXBV0G5L+Ws8gGP+br5YhtHR39tq0EypV8ZfZs7Q8KQngioF+sX8ry0U0MNBC2ueTY0yGFpM1mE6OHW00gZPXxLb38oPvj2o76bMoI/jCqoX9C0YO1So6QM49Useiwxo2R6igDPYcT4r1g3Qdz5DXp1U/81qADxAl4IoeW6zMtrLXRAGa1qRlHA4HfOBjQShCdKbh0Vj927QPM2sSbVRngL7fNkUl19ChkA7HEMt8l446y9e84VCMpkYOBanUOZlpcGsn/TGlQVoWuk80ZgCt7fdP4JOHhmggvWiHhmJ4fDmSXxXQjRfL7k= kitty@fedora"
];
};
}

4
modules/base/acme.nix Normal file
View File

@ -0,0 +1,4 @@
{
security.acme.defaults.email = "ciapa@lewd.wtf";
security.acme.acceptTerms = true;
}

11
modules/base/nix.nix Normal file
View File

@ -0,0 +1,11 @@
{
nix = {
settings.auto-optimise-store = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 15";
};
};
}

10
modules/base/packages.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
vim
git
curl
htop
rclone
];
}

7
modules/base/podman.nix Normal file
View File

@ -0,0 +1,7 @@
{
virtualisation.oci-containers.backend = "podman";
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
}

31
modules/base/ssh.nix Normal file
View File

@ -0,0 +1,31 @@
{
services.openssh = {
enable = true;
openFirewall = true;
ports = [ 222 ];
settings = {
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
};
ciphers = [
"chacha20-poly1305@openssh.com"
"aes256-gcm@openssh.com"
"aes256-ctr"
"aes128-gcm@openssh.com"
];
macs = [
"umac-128-etm@openssh.com"
"hmac-sha2-256-etm@openssh.com"
"hmac-sha2-512-etm@openssh.com"
"hmac-sha2-512"
];
kexAlgorithms = [
"curve25519-sha256@libssh.org"
"diffie-hellman-group16-sha512"
"diffie-hellman-group18-sha512"
"curve25519-sha256"
];
};
}

10
modules/base/users.nix Normal file
View File

@ -0,0 +1,10 @@
{
users.users.root = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICgkmGE9IVi3xoaaMmhkYiVVzMdWZJ8nfV7dqyayTFMI markus@acheron"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHoKPipgr8EJNkLfG3qHTZxK9XTVDebVcic8mboiL1bg markus@GUN-OFF1-PC35-2018-10-11"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIERtfY26/h5xl+bzZm2htR4+Wd879DvZRPHsosFaEqIW gaming2DESKTOP-4ACM3JU"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTaFqYPA4cFQ98/jEoK8ofNBqOX4a3C4WS4hSlGdNzq gitlab"
];
};
}

View File

@ -0,0 +1,9 @@
{ lib, ... }:
{
options = {
variables = lib.mkOption {
type = lib.types.attrs;
default = { };
};
};
}

4
nix.conf Normal file
View File

@ -0,0 +1,4 @@
experimental-features = nix-command flakes
build-users-group = nixbld
sandbox = true
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

5
overlay/default.nix Normal file
View File

@ -0,0 +1,5 @@
{
nixpkgs.config = {
allowUnfree = true;
};
}

9
util/include.nix Normal file
View File

@ -0,0 +1,9 @@
{ lib }: rec {
includeDir = dirName:
let
toFilePath = name: value: dirName + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
in
lib.mapAttrsToList toFilePath
(lib.filterAttrs filterCaches (builtins.readDir dirName));
}