initial commit here we are

This commit is contained in:
Geir Okkenhaug Jerstad 2024-05-20 12:24:36 +02:00
commit 82916ad718
59 changed files with 2155 additions and 0 deletions

20
appserver/aliases.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
tldr
eza
bat
ripgrep
];
environment.shellAliases = {
vi = "nvim";
vim = "nvim";
h = "tldr";
# oxidized
ls = "eza -l";
cat = "bat";
grep = "rg";
top = "btm --color gruvbox";
# some tools
};
}

33
appserver/audiobook.nix Normal file
View file

@ -0,0 +1,33 @@
{ configs, pkgs, ... }:
let
audioBookShelfPort = 8000;
in
{
environment.systemPackages = [
pkgs.audiobookshelf
];
systemd.services = {
audiobookshelf = {
description = "Audiobookshelf";
wantedBy = ["multi-user.target"];
restartIfChanged = true;
environment = {
PORT = builtins.toString audioBookShelfPort;
HOST = "0.0.0.0";
};
serviceConfig = {
Type = "simple";
Restart = "always";
RestartSec = "5";
ExecStart = ''
${pkgs.audiobookshelf}/bin/audiobookshelf
'';
};
};
};
networking.firewall.allowedTCPPorts = [ audioBookShelfPort ];
#services.audiobookshelf.enable = true;
#services.audiobookshelf.host = 0.0.0.0 ;
#services.audiobookshelf.port = 8000;
#services.audiobookshelf.openFirewall = true;
}

16
appserver/calibre-web.nix Normal file
View file

@ -0,0 +1,16 @@
{ config, pkgs, ... }:
{
services.calibre-web = {
enable = true;
#group = "media";
listen = {
ip = "0.0.0.0";
port = 8083;
};
options = {
calibreLibrary = "/mnt/remote/media/books/calibre/";
enableBookUploading = true;
};
};
networking.firewall.allowedTCPPorts = [ 8083 ];
}

View file

@ -0,0 +1,77 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./starship.nix
./podman.nix
./libvirt.nix
./wg.nix
./jellfin.nix
];
# Swap zram
zramSwap = {
enable = true;
algorithm = "zstd";
};
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.efi.efiSysMountPoint = "/boot/";
boot.loader.grub.device = "nodev";
# Disks and Updates
services.fstrim.enable = true;
# Enable all unfree hardware support.
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
nixpkgs.config.allowUnfree = true;
services.fwupd.enable = true;
# Networking
networking.hostName = "server1";
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "no";
};
users.users.geir = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "libvirt" "podman" ];
packages = with pkgs; [
bottom
];
};
environment.systemPackages = with pkgs; [
neovim emacs nano curl htop glances neofetch
wget git wireguard-tools
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.settings.PasswordAuthentication = false;
# Enable Netdata
services.netdata.enable = true;
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 19999 ];
networking.firewall.allowedUDPPorts = [ 22 ];
system.stateVersion = "23.05";
}

View file

@ -0,0 +1,96 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./starship.nix
./aliases.nix
./podman.nix
./libvirt.nix
./incus.nix
./jellyfin.nix
./tailscale.nix
./calibre-web.nix
./audiobook.nix
./ollama.nix
#./soft-serve.nix
];
# Swap zram
zramSwap = {
enable = true;
algorithm = "zstd";
};
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.efi.efiSysMountPoint = "/boot/";
boot.loader.grub.device = "nodev";
# Disks and Updates
services.fstrim.enable = true;
# Mount remote filesystem
fileSystems."/mnt/remote/media" = {
device = "10.0.0.8:/mnt/storage/media";
fsType = "nfs";
};
# Enable all unfree hardware support.
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
nixpkgs.config.allowUnfree = true;
services.fwupd.enable = true;
# Networking
networking.hostName = "server1";
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "no";
};
users.users.geir = {
isNormalUser = true;
extraGroups = [ "wheel"
"networkmanager"
"libvirt"
"podman"
"ollama"
"writefreely"
];
packages = with pkgs; [
bottom
];
};
environment.systemPackages = with pkgs; [
neovim emacs nano curl htop glances kitty
wget git inxi nethogs fastfetch
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.settings.PasswordAuthentication = true;
# Enable Netdata
services.netdata.enable = true;
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 19999 23231];
networking.firewall.allowedUDPPorts = [ 22 23231 ];
system.stateVersion = "23.05";
}

View file

@ -0,0 +1,118 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "server1"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.geir = {
isNormalUser = true;
initialPassword = "goj290873";
extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = with pkgs; [
neovim
tree
];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View file

@ -0,0 +1,38 @@
# 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 = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b101efbd-a6b3-494d-9c21-21187540dc8d";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/E251-F60A";
fsType = "vfat";
};
swapDevices = [ ];
# 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.enp1s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp8s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

9
appserver/incus.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, pkgs, ... }:
{
virtualisation.incus.enable = true;
environment.systemPackages = with pkgs; [
incus
lxc
];
}

6
appserver/jellyfin.nix Normal file
View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
services.jellyfin.enable = true;
networking.firewall.allowedTCPPorts = [ 8096 8920 ];
networking.firewall.allowedUDPPorts = [ 1900 7359 ];
}

8
appserver/libvirt.nix Normal file
View file

@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
environment.systemPackages = with pkgs; [
qemu_kvm
libvirt
];
}

30
appserver/nextcloud.nix Normal file
View file

@ -0,0 +1,30 @@
{ pkgs, ... }:
{
# Nextcloud Config
environment.etc."nextcloud-admin-pass".text = "siKKerhet666";
services.nextcloud = {
enable = true;
hostName = "server1.tail807ea.ts.net";
# Ssl Let'encrypt
#hostName = "cloud.geokkjer.eu";
#https = true;
# Auto-update Nextcloud Apps
autoUpdateApps.enable = true;
# Set what time makes sense for you
autoUpdateApps.startAt = "05:00:00";
# enable redis cache
configureRedis = true;
# Create db locally , maybe not needed with sqlite
database.createLocally = true;
# Config options
config = {
dbtype = "sqlite";
adminpassFile = "/etc/nextcloud-admin-pass";
trustedProxies = [ "46.226.104.98" "100.75.29.52" ];
extraTrustedDomains = [ "localhost" "*.cloudflare.net" "*.tail807ea.ts.net" "46.226.104.98" "*.geokkjer.eu" ];
};
};
}

30
appserver/ollama.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ollama
];
systemd.services = {
ollama = {
description = "Server for local large language models";
after = ["network-online.target"];
wantedBy = ["multi-user.target"];
environment = {
HOME = "%S/ollama";
OLLAMA_HOST = "0.0.0.0";
OLLAMA_MODELS = "%S/ollama/models";
};
serviceConfig = {
Type = "simple";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
WorkingDirectory = "/var/lib/ollama";
StateDirectory = [ "ollama" ];
DynamicUser = true;
ExecStart = "${pkgs.ollama}/bin/ollama serve";
};
};
};
networking.firewall.allowedTCPPorts = [ 11434 ];
}

13
appserver/podman.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
virtualisation.podman.dockerSocket.enable = true;
#virtualisation.defaultNetwork.settings.dns_enabled = true;
environment.systemPackages = with pkgs; [
podman-tui
podman-compose
];
}

View file

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
tldr
eza
bat
ripgrep
];
environment.shellAliases = {
vi = "nvim";
vim = "nvim";
h = "tldr";
# oxidized
ls = "eza -l";
cat = "bat";
grep = "rg";
top = "btm --color gruvbox";
# some tools
};
}

View file

@ -0,0 +1,33 @@
{ configs, pkgs, ... }:
let
audioBookShelfPort = 8000;
in
{
environment.systemPackages = [
pkgs.audiobookshelf
];
systemd.services = {
audiobookshelf = {
description = "Audiobookshelf";
wantedBy = ["multi-user.target"];
restartIfChanged = true;
environment = {
PORT = builtins.toString audioBookShelfPort;
HOST = "0.0.0.0";
};
serviceConfig = {
Type = "simple";
Restart = "always";
RestartSec = "5";
ExecStart = ''
${pkgs.audiobookshelf}/bin/audiobookshelf
'';
};
};
};
networking.firewall.allowedTCPPorts = [ audioBookShelfPort ];
#services.audiobookshelf.enable = true;
#services.audiobookshelf.host = 0.0.0.0 ;
#services.audiobookshelf.port = 8000;
#services.audiobookshelf.openFirewall = true;
}

View file

@ -0,0 +1,16 @@
{ config, pkgs, ... }:
{
services.calibre-web = {
enable = true;
#group = "media";
listen = {
ip = "0.0.0.0";
port = 8083;
};
options = {
calibreLibrary = "/mnt/remote/media/books/calibre/";
enableBookUploading = true;
};
};
networking.firewall.allowedTCPPorts = [ 8083 ];
}

View file

@ -0,0 +1,77 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./starship.nix
./podman.nix
./libvirt.nix
./wg.nix
./jellfin.nix
];
# Swap zram
zramSwap = {
enable = true;
algorithm = "zstd";
};
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.efi.efiSysMountPoint = "/boot/";
boot.loader.grub.device = "nodev";
# Disks and Updates
services.fstrim.enable = true;
# Enable all unfree hardware support.
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
nixpkgs.config.allowUnfree = true;
services.fwupd.enable = true;
# Networking
networking.hostName = "server1";
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "no";
};
users.users.geir = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "libvirt" "podman" ];
packages = with pkgs; [
bottom
];
};
environment.systemPackages = with pkgs; [
neovim emacs nano curl htop glances neofetch
wget git wireguard-tools
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.settings.PasswordAuthentication = false;
# Enable Netdata
services.netdata.enable = true;
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 19999 ];
networking.firewall.allowedUDPPorts = [ 22 ];
system.stateVersion = "23.05";
}

View file

@ -0,0 +1,96 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./starship.nix
./aliases.nix
./podman.nix
./libvirt.nix
./incus.nix
./jellyfin.nix
./tailscale.nix
./calibre-web.nix
./audiobook.nix
./ollama.nix
#./soft-serve.nix
];
# Swap zram
zramSwap = {
enable = true;
algorithm = "zstd";
};
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.efi.efiSysMountPoint = "/boot/";
boot.loader.grub.device = "nodev";
# Disks and Updates
services.fstrim.enable = true;
# Mount remote filesystem
fileSystems."/mnt/remote/media" = {
device = "10.0.0.8:/mnt/storage/media";
fsType = "nfs";
};
# Enable all unfree hardware support.
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
nixpkgs.config.allowUnfree = true;
services.fwupd.enable = true;
# Networking
networking.hostName = "server1";
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Oslo";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "no";
};
users.users.geir = {
isNormalUser = true;
extraGroups = [ "wheel"
"networkmanager"
"libvirt"
"podman"
"ollama"
"writefreely"
];
packages = with pkgs; [
bottom
];
};
environment.systemPackages = with pkgs; [
neovim emacs nano curl htop glances kitty
wget git inxi nethogs fastfetch
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.settings.PasswordAuthentication = false;
# Enable Netdata
services.netdata.enable = true;
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 19999 23231];
networking.firewall.allowedUDPPorts = [ 22 23231 ];
system.stateVersion = "23.05";
}

View file

@ -0,0 +1,9 @@
{ config, pkgs, ... }:
{
virtualisation.incus.enable = true;
environment.systemPackages = with pkgs; [
incus
lxc
];
}

View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
services.jellyfin.enable = true;
networking.firewall.allowedTCPPorts = [ 8096 8920 ];
networking.firewall.allowedUDPPorts = [ 1900 7359 ];
}

View file

@ -0,0 +1,8 @@
{ config, pkgs, ... }:
{
virtualisation.libvirtd.enable = true;
environment.systemPackages = with pkgs; [
qemu_kvm
libvirt
];
}

View file

@ -0,0 +1,30 @@
{ pkgs, ... }:
{
# Nextcloud Config
environment.etc."nextcloud-admin-pass".text = "siKKerhet666";
services.nextcloud = {
enable = true;
hostName = "server1.tail807ea.ts.net";
# Ssl Let'encrypt
#hostName = "cloud.geokkjer.eu";
#https = true;
# Auto-update Nextcloud Apps
autoUpdateApps.enable = true;
# Set what time makes sense for you
autoUpdateApps.startAt = "05:00:00";
# enable redis cache
configureRedis = true;
# Create db locally , maybe not needed with sqlite
database.createLocally = true;
# Config options
config = {
dbtype = "sqlite";
adminpassFile = "/etc/nextcloud-admin-pass";
trustedProxies = [ "46.226.104.98" "100.75.29.52" ];
extraTrustedDomains = [ "localhost" "*.cloudflare.net" "*.tail807ea.ts.net" "46.226.104.98" "*.geokkjer.eu" ];
};
};
}

View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ollama
];
systemd.services = {
ollama = {
description = "Server for local large language models";
after = ["network-online.target"];
wantedBy = ["multi-user.target"];
environment = {
HOME = "%S/ollama";
OLLAMA_HOST = "0.0.0.0";
OLLAMA_MODELS = "%S/ollama/models";
};
serviceConfig = {
Type = "simple";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
WorkingDirectory = "/var/lib/ollama";
StateDirectory = [ "ollama" ];
DynamicUser = true;
ExecStart = "${pkgs.ollama}/bin/ollama serve";
};
};
};
networking.firewall.allowedTCPPorts = [ 11434 ];
}

View file

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
virtualisation.podman.dockerSocket.enable = true;
#virtualisation.defaultNetwork.settings.dns_enabled = true;
environment.systemPackages = with pkgs; [
podman-tui
podman-compose
];
}

View file

@ -0,0 +1,48 @@
{ pkgs, configs, ... }:
{
services.soft-serve.enable = true;
services.soft-serve.settings = {
name = "geokkjer's repos";
log_format = "text";
ssh = {
listen_addr = "0.0.0.0:23231";
public_url = "ssh://git.geokkjer.eu:23231";
max_timeout = 30;
idle_timeout = 120;
};
stats.listen_addr = ":23233";
};
}
#+end80808080 * Ollama
#+begin_src nix :tangle ollama.nix
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ollama
];
systemd.services = {
ollama = {
description = "Server for local large language models";
after = ["network-online.target"];
wantedBy = ["multi-user.target"];
environment = {
HOME = "%S/ollama";
OLLAMA_HOST = "0.0.0.0";
OLLAMA_MODELS = "%S/ollama/models";
};
serviceConfig = {
Type = "simple";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
WorkingDirectory = "/var/lib/ollama";
StateDirectory = [ "ollama" ];
DynamicUser = true;
ExecStart = "${pkgs.ollama}/bin/ollama serve";
};
};
};
networking.firewall.allowedTCPPorts = [ 11434 ];
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
starship
];
}

View file

@ -0,0 +1,18 @@
{config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
tailscale
];
services.tailscale.enable = true;
networking.firewall = {
# trace: warning: Strict reverse path filtering breaks Tailscale exit node
# use and some subnet routing setups. Consider setting
# `networking.firewall.checkReversePath` = 'loose'
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
};
}
#+end80808080 * nginx
#+begin_src nix

View file

@ -0,0 +1,20 @@
{ config, pkgs, lib, ... }:
{
networking.firewall.checkReversePath = "loose";
networking.wg-quick.interfaces = {
wg0 = {
address = [ "192.168.100.3/24" ]; # "fdc9:281f:04d7:9ee9::2/64"
#dns = [ "192.168.100.1" "192.168.1.1" ]; # "fdc9:281f:04d7:9ee9::1"
privateKeyFile = "/root/wireguard-keys/private";
peers = [
{
publicKey = "";
presharedKeyFile = "/root/wireguard-keys/preshared";
allowedIPs = [ "192.168.100.1/24" ]; # "::/0"
endpoint = "46.226.104.98:51820";
persistentKeepalive = 25;
}
];
};
};
}

View file

@ -0,0 +1,26 @@
{ pkgs, configs, ... }:
{
services.writefreely = {
enable = true;
admin.name = "geir@geokkjer.eu";
host = "blog.geokkjer.eu";
database = {
type = "sqlite3";
#filename = "writefreely.db";
#database = "writefreely";
};
nginx = {
# Enable Nginx and configure it to serve WriteFreely.
enable = true;
};
settings = {
server = {
port = 8088;
bind = "0.0.0.0";
};
};
};
networking.firewall.allowedTCPPorts = [ 8088 ];
networking.firewall.allowedUDPPorts = [ 8088 ];
}

48
appserver/soft-serve.nix Normal file
View file

@ -0,0 +1,48 @@
{ pkgs, configs, ... }:
{
services.soft-serve.enable = true;
services.soft-serve.settings = {
name = "geokkjer's repos";
log_format = "text";
ssh = {
listen_addr = "0.0.0.0:23231";
public_url = "ssh://git.geokkjer.eu:23231";
max_timeout = 30;
idle_timeout = 120;
};
stats.listen_addr = ":23233";
};
}
#+end80808080 * Ollama
#+begin_src nix :tangle ollama.nix
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
ollama
];
systemd.services = {
ollama = {
description = "Server for local large language models";
after = ["network-online.target"];
wantedBy = ["multi-user.target"];
environment = {
HOME = "%S/ollama";
OLLAMA_HOST = "0.0.0.0";
OLLAMA_MODELS = "%S/ollama/models";
};
serviceConfig = {
Type = "simple";
User = "ollama";
Group = "ollama";
Restart = "always";
RestartSec = "3";
WorkingDirectory = "/var/lib/ollama";
StateDirectory = [ "ollama" ];
DynamicUser = true;
ExecStart = "${pkgs.ollama}/bin/ollama serve";
};
};
};
networking.firewall.allowedTCPPorts = [ 11434 ];
}

6
appserver/starship.nix Normal file
View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
starship
];
}

18
appserver/tailscale.nix Normal file
View file

@ -0,0 +1,18 @@
{config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
tailscale
];
services.tailscale.enable = true;
networking.firewall = {
# trace: warning: Strict reverse path filtering breaks Tailscale exit node
# use and some subnet routing setups. Consider setting
# `networking.firewall.checkReversePath` = 'loose'
checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
};
}
#+end80808080 * nginx
#+begin_src nix

20
appserver/wg.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, pkgs, lib, ... }:
{
networking.firewall.checkReversePath = "loose";
networking.wg-quick.interfaces = {
wg0 = {
address = [ "192.168.100.3/24" ]; # "fdc9:281f:04d7:9ee9::2/64"
#dns = [ "192.168.100.1" "192.168.1.1" ]; # "fdc9:281f:04d7:9ee9::1"
privateKeyFile = "/root/wireguard-keys/private";
peers = [
{
publicKey = "";
presharedKeyFile = "/root/wireguard-keys/preshared";
allowedIPs = [ "192.168.100.1/24" ]; # "::/0"
endpoint = "46.226.104.98:51820";
persistentKeepalive = 25;
}
];
};
};
}

26
appserver/writefreely.nix Normal file
View file

@ -0,0 +1,26 @@
{ pkgs, configs, ... }:
{
services.writefreely = {
enable = true;
admin.name = "geir@geokkjer.eu";
host = "blog.geokkjer.eu";
database = {
type = "sqlite3";
#filename = "writefreely.db";
#database = "writefreely";
};
nginx = {
# Enable Nginx and configure it to serve WriteFreely.
enable = true;
};
settings = {
server = {
port = 8088;
bind = "0.0.0.0";
};
};
};
networking.firewall.allowedTCPPorts = [ 8088 ];
networking.firewall.allowedUDPPorts = [ 8088 ];
}