Added transfer-sh and basic caddy config and lapserv host config.

This commit is contained in:
Jurn Wubben 2025-03-27 19:29:22 +01:00
parent 58dcc86ca8
commit cc42ce672d
8 changed files with 95 additions and 3 deletions

View file

@ -16,6 +16,7 @@ in {
flake = let flake = let
systems = [ systems = [
"laptop" "laptop"
"lapserv"
"minimal" "minimal"
]; ];
in { in {

View file

@ -0,0 +1,7 @@
{
imports = [
./hardware-configuration.nix
];
niksos.server = true;
}

View file

@ -0,0 +1,44 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/59540469-ecb9-4a68-829b-4cd3ad6e95c3";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/83C9-84B1";
fsType = "vfat";
options = ["fmask=0077" "dmask=0077"];
};
swapDevices = [
{device = "/dev/disk/by-uuid/65190d84-4e34-4905-a317-d750591933e2";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -11,6 +11,7 @@
desktop = true; desktop = true;
portable = true; portable = true;
neovim = true; neovim = true;
server = true;
}; };
home-manager.users.jsw.wayland.windowManager.hyprland.settings.monitor = ["eDP-1,2880x1920@120,0x0,1.5,vrr,1"]; home-manager.users.jsw.wayland.windowManager.hyprland.settings.monitor = ["eDP-1,2880x1920@120,0x0,1.5,vrr,1"];

View file

@ -5,6 +5,7 @@
./network ./network
./nix ./nix
./programs ./programs
./server
./services ./services
]; ];
} }

View file

@ -1,3 +1,23 @@
{config, ...}: { {config, ...}: {
niksos.server.enable = config.niksos.server.enable; services.caddy = {
enable = config.niksos.server;
email = "jurnwubben@gmail.com";
enableReload = false;
virtualHosts."share.jsw.tf" = {
serverAliases = ["www.share.jsw.tf"];
extraConfig = ''
reverse_proxy :9000
'';
};
globalConfig = ''
http_port 80
https_port 443
auto_https off
bind 192.168.1.114
'';
};
networking.firewall.allowedTCPPorts = [80 443];
} }

View file

@ -1,4 +1,4 @@
{lib, ...}: { {lib, ...}: {
imports = [./caddy.nix]; imports = [./caddy.nix ./transfer-sh.nix];
options.niksos.server.enable = lib.mKEnableOption "server servcies (such as caddy)."; options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option.
} }

View file

@ -0,0 +1,18 @@
{config, ...}: {
services.transfer-sh = {
enable = config.niksos.server;
settings = {
PURGE_DAYS = 7;
MAX_UPLOAD_SIZE = 4 * 1000 * 1000; # 2gb
# CORS_DOMAINS = "transfer.jsw.tf"; #FIXME: open it to the world wide web.
BASEDIR = "/var/lib/transfer.sh";
LISTENER = ":9000";
};
};
systemd.services.transfer-sh.serviceConfig = {
StateDirectory = "transfer.sh";
StateDirectoryMode = "0750";
};
#TODO: caddy
}