refactor!: restructure and document configuration
This commit is contained in:
parent
4a02e072a7
commit
f87f9995be
126 changed files with 957 additions and 590 deletions
15
hosts/README.md
Normal file
15
hosts/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
## wizdesk
|
||||
|
||||
My main machine, this is where I host everything that's accessible through the `thewizard.link` domain.
|
||||
|
||||
### Specs
|
||||
|
||||

|
||||
|
||||
## wizlap
|
||||
|
||||
My ASUS Vivobook 15 (M1502IA), I mostly use it when I have to travel so there isn't much to say about it.
|
||||
|
||||
### Specs
|
||||
|
||||
They can be found in ASUS' store/support page, I haven't modified it yet.
|
71
hosts/wizdesk/hardware-configuration.nix
Normal file
71
hosts/wizdesk/hardware-configuration.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
# 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" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/1f7083ba-4271-486e-a85c-8386f6287b0a";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/1f7083ba-4271-486e-a85c-8386f6287b0a";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=nix" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/1f7083ba-4271-486e-a85c-8386f6287b0a";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/D4D7-CD5F";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
fileSystems."/mnt/internal" =
|
||||
{ device = "/dev/disk/by-uuid/b8541c0d-9146-4388-b217-431f196957cc";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/ssd" =
|
||||
{ device = "/dev/disk/by-uuid/f27f2224-d351-46fd-89f5-991de36166ad";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/extra" =
|
||||
{ device = "/dev/disk/by-uuid/0d4ef3e0-7e7a-4a70-bbbc-040fe7aa7c2a";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/media" =
|
||||
{ device = "/dev/disk/by-uuid/52c17b8b-46c1-4870-b86c-c3b9f4bd4434";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
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.enp5s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
162
hosts/wizdesk/home-manager.nix
Normal file
162
hosts/wizdesk/home-manager.nix
Normal file
|
@ -0,0 +1,162 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
#
|
||||
## HOME CONFIGURATION #
|
||||
#
|
||||
|
||||
# Import configurations for better modularity.
|
||||
imports = [
|
||||
../../modules/emacs
|
||||
../../modules/hyprland/home-manager.nix
|
||||
../../modules/neovim
|
||||
../../shared/home-manager
|
||||
./services/home-manager
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "wizardlink";
|
||||
home.homeDirectory = "/home/wizardlink";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.05"; # Please read the comment before changing.
|
||||
|
||||
home.file = {
|
||||
# Create wallpaper script to be read by the start_services.sh script.
|
||||
".local/share/scripts/wallpaper.sh" = {
|
||||
executable = true;
|
||||
text = # sh
|
||||
''
|
||||
#
|
||||
## Start wallpaper daemon and set one.
|
||||
#
|
||||
OUTPUT_1="DP-2"
|
||||
IMAGE_1="/mnt/internal/personal/wallpapers/edited/1440-bicycle.jpg"
|
||||
|
||||
OUTPUT_2="DP-3"
|
||||
IMAGE_2="/mnt/internal/personal/wallpapers/edited/1080-bycicle.jpg"
|
||||
|
||||
function load_wallpapers() {
|
||||
swww img -t any --transition-bezier 0.0,0.0,1.0,1.0 --transition-duration .8 --transition-step 255 --transition-fps 60 -o $OUTPUT_1 $IMAGE_1;
|
||||
swww img -t any --transition-bezier 0.0,0.0,1.0,1.0 --transition-duration .8 --transition-step 255 --transition-fps 60 -o $OUTPUT_2 $IMAGE_2
|
||||
}
|
||||
|
||||
if ! swww query; then
|
||||
swww-daemon &
|
||||
fi
|
||||
|
||||
load_wallpapers &
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
#
|
||||
# PACKAGES #
|
||||
#
|
||||
|
||||
programs.direnv = {
|
||||
config = {
|
||||
whitelist = {
|
||||
prefix = [
|
||||
"/mnt/internal/hydractify/GitHub"
|
||||
"/mnt/internal/personal/projects"
|
||||
"/mnt/internal/personal/study"
|
||||
"/mnt/internal/repos"
|
||||
"/mnt/internal/shared/projects"
|
||||
"/mnt/internal/shared/work"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# Games
|
||||
pcsx2
|
||||
|
||||
# Creative work
|
||||
easyeffects
|
||||
|
||||
# Create an FHS environment using the command `fhs`, enabling the execution of non-NixOS packages in NixOS!
|
||||
(
|
||||
let
|
||||
base = appimageTools.defaultFhsEnvArgs;
|
||||
in
|
||||
buildFHSEnv (
|
||||
base
|
||||
// {
|
||||
name = "fhs";
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
(
|
||||
# pkgs.buildFHSUserEnv provides only a minimal FHS environment,
|
||||
# lacking many basic packages needed by most software.
|
||||
# Therefore, we need to add them manually.
|
||||
#
|
||||
# pkgs.appimageTools provides basic packages required by most software.
|
||||
(base.targetPkgs pkgs)
|
||||
++ (with pkgs; [
|
||||
nodejs
|
||||
dotnet-sdk_8
|
||||
])
|
||||
);
|
||||
profile = "export FHS=1";
|
||||
runScript = "bash";
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
}
|
||||
)
|
||||
)
|
||||
];
|
||||
|
||||
#
|
||||
# MODULES #
|
||||
#
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
# Enable ollama support
|
||||
ollama.enable = true;
|
||||
};
|
||||
|
||||
modules.hyprland = {
|
||||
# Enable scripts
|
||||
scripts = {
|
||||
startup.enable = true;
|
||||
screenshot.enable = true;
|
||||
};
|
||||
|
||||
# Enable hypridle and hyprlock
|
||||
hypridle.enable = true;
|
||||
hyprlock = {
|
||||
enable = true;
|
||||
background = "/mnt/internal/personal/wallpapers/wallhaven-2em8y6.jpg";
|
||||
};
|
||||
|
||||
# Add monitor configuration to hyprland
|
||||
extraConfig = # hyprlang
|
||||
''
|
||||
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||
monitor = DP-3, 1920x1080@74.973, 2560x0, 1
|
||||
monitor = DP-2, 2560x1440@165.00301, 0x0, 1
|
||||
|
||||
# Bind workspaces to specific monitors
|
||||
workspace = 1, monitor:DP-2
|
||||
workspace = 2, monitor:DP-3
|
||||
workspace = 3, monitor:DP-2
|
||||
workspace = 4, monitor:DP-3
|
||||
workspace = 5, monitor:DP-2
|
||||
workspace = 6, monitor:DP-3
|
||||
workspace = 7, monitor:DP-2
|
||||
workspace = 8, monitor:DP-3
|
||||
workspace = 9, monitor:DP-2
|
||||
workspace = 0, monitor:DP-3
|
||||
'';
|
||||
};
|
||||
}
|
182
hosts/wizdesk/nixos.nix
Normal file
182
hosts/wizdesk/nixos.nix
Normal file
|
@ -0,0 +1,182 @@
|
|||
{ pkgs, config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../modules/hyprland/nixos.nix
|
||||
../../shared/nixos
|
||||
./hardware-configuration.nix
|
||||
./services/nixos
|
||||
];
|
||||
|
||||
#
|
||||
# NIXOS #
|
||||
#
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
#
|
||||
# SYSTEM #
|
||||
#
|
||||
|
||||
# Configure options for mounted volumes.
|
||||
fileSystems = {
|
||||
"/".options = [ "compress=zstd" ];
|
||||
"/home".options = [ "compress=zstd" ];
|
||||
"/nix".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
"/mnt/extra".options = [ "nofail" ];
|
||||
"/mnt/internal".options = [ "nofail" ];
|
||||
"/mnt/media".options = [ "nofail" ];
|
||||
"/mnt/ssd".options = [ "nofail" ];
|
||||
};
|
||||
|
||||
# Enable btrf's auto scrubbing of volumes.
|
||||
services.btrfs.autoScrub = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
fileSystems = [ "/" ];
|
||||
};
|
||||
|
||||
networking.hostName = "wizdesk"; # Define your hostname.
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
443 # SSL
|
||||
6567 # Mindustry
|
||||
80 # HTTP
|
||||
3979 # OpenTTD
|
||||
7777 # Terraria
|
||||
];
|
||||
|
||||
allowedUDPPorts = [
|
||||
2626 # Dolphin emulator
|
||||
27015 # Source games
|
||||
28910 # Heretic II
|
||||
6567 # Mindustry
|
||||
8211 # Palworld
|
||||
3979 # OpenTTD
|
||||
];
|
||||
|
||||
allowedTCPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
} # KDEConnect
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
} # KDEConnect
|
||||
];
|
||||
};
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.wizardlink = {
|
||||
createHome = true;
|
||||
description = "Alexandre Cavalheiro";
|
||||
extraGroups = [
|
||||
"docker"
|
||||
"gamemode"
|
||||
"libvirtd"
|
||||
"networkmanager"
|
||||
"openrazer"
|
||||
"postgresql"
|
||||
"wheel"
|
||||
];
|
||||
|
||||
initialPassword = "wizardlink";
|
||||
isNormalUser = true;
|
||||
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva <contact@thewizard.link>"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa
|
||||
];
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Sao_Paulo";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
supportedLocales = [
|
||||
"C.UTF-8/UTF-8"
|
||||
"en_GB.UTF-8/UTF-8"
|
||||
"en_US.UTF-8/UTF-8"
|
||||
"ja_JP.UTF-8/UTF-8"
|
||||
"pt_BR.UTF-8/UTF-8"
|
||||
];
|
||||
|
||||
extraLocaleSettings = {
|
||||
LANGUAGE = "en_US.UTF-8";
|
||||
LC_ADDRESS = "en_US.UTF-8";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||
LC_MEASUREMENT = "pt_BR.UTF-8";
|
||||
LC_MONETARY = "en_US.UTF-8";
|
||||
LC_NAME = "en_US.UTF-8";
|
||||
LC_NUMERIC = "pt_BR.UTF-8";
|
||||
LC_PAPER = "pt_BR.UTF-8";
|
||||
LC_TELEPHONE = "pt_BR.UTF-8";
|
||||
LC_TIME = "en_GB.UTF-8";
|
||||
};
|
||||
};
|
||||
|
||||
#
|
||||
# HARDWARE #
|
||||
#
|
||||
|
||||
# Enable Zenergy
|
||||
boot.initrd.kernelModules = [
|
||||
"zenergy"
|
||||
];
|
||||
boot.extraModulePackages = [
|
||||
config.boot.kernelPackages.zenergy
|
||||
];
|
||||
|
||||
# Enable openrazer for managing Razer products' configuration
|
||||
hardware.openrazer = {
|
||||
enable = true;
|
||||
users = [ "wizardlink" ];
|
||||
};
|
||||
|
||||
services.udev = {
|
||||
# Vial udev rule for Monsgeek M1
|
||||
extraRules = ''
|
||||
# Monsgeek M1
|
||||
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0005", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
|
||||
'';
|
||||
|
||||
# WB32 DFU rules - needed for flashing
|
||||
packages = [ (pkgs.callPackage ../../packages/wb32dfu-udev-rules { }) ];
|
||||
};
|
||||
|
||||
# enable a better driver for wireless xbox controllers.
|
||||
hardware.xpadneo.enable = true;
|
||||
|
||||
#
|
||||
# PACKAGES #
|
||||
#
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
## Tools
|
||||
# Utilities
|
||||
btrfs-progs
|
||||
|
||||
## Hardware specific
|
||||
openrazer-daemon # Razor products back-end
|
||||
polychromatic # and it's front-end
|
||||
vial
|
||||
];
|
||||
}
|
10
hosts/wizdesk/services/home-manager/default.nix
Normal file
10
hosts/wizdesk/services/home-manager/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./gakuen-cosplay-api.nix
|
||||
./hydractify-bot.nix
|
||||
./openttd.nix
|
||||
./terraria.nix
|
||||
];
|
||||
}
|
16
hosts/wizdesk/services/home-manager/gakuen-cosplay-api.nix
Normal file
16
hosts/wizdesk/services/home-manager/gakuen-cosplay-api.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ gakuen-cosplay, pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.gakuen-cosplay-api = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Gakuen Cosplay API";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${gakuen-cosplay.packages.${pkgs.system}.backend}/bin/cosplayer_submission";
|
||||
Restart = "on-failure";
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/mnt/internal/shared/work/gakuen/projects/cosplayer_submission/packages/backend";
|
||||
};
|
||||
};
|
||||
}
|
17
hosts/wizdesk/services/home-manager/hydractify-bot.nix
Normal file
17
hosts/wizdesk/services/home-manager/hydractify-bot.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ hydractify-bot, pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.hydractify-bot = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Hydractify bot";
|
||||
Unit.After = "postgresql.service";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${hydractify-bot.defaultPackage.${pkgs.system}}/bin/hydractify";
|
||||
Restart = "on-failure";
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/mnt/internal/hydractify/GitHub/hydractify";
|
||||
};
|
||||
};
|
||||
}
|
53
hosts/wizdesk/services/home-manager/openttd.nix
Normal file
53
hosts/wizdesk/services/home-manager/openttd.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
openttd
|
||||
];
|
||||
|
||||
systemd.user.services.openttd = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "OpenTTD Tmux server";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd new -s OpenTTD -d '${pkgs.openttd}/bin/openttd -g /home/wizardlink/.local/share/openttd/save/hyfy.sav -D'";
|
||||
ExecStop = "${pkgs.tmux}/bin/tmux kill-session -t OpenTTD";
|
||||
Restart = "on-failure";
|
||||
Type = "forking";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.openttd-rcon = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit = {
|
||||
Description = "OpenTTD RCON Password set";
|
||||
After = [ "openttd.service" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'rcon_pw aaaa' Enter";
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.openttd-save = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit = {
|
||||
Description = "OpenTTD RCON Password set";
|
||||
After = [ "openttd.service" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'save hyfy' Enter";
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
RestartSec = "1800s";
|
||||
};
|
||||
};
|
||||
}
|
17
hosts/wizdesk/services/home-manager/terraria.nix
Normal file
17
hosts/wizdesk/services/home-manager/terraria.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.terraria = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Terraria TMUX Server";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L terraria new -s Terraria -d /etc/profiles/per-user/wizardlink/bin/fhs -c 'dotnet ./tModLoader.dll -server -config serverconfig.txt'";
|
||||
ExecStop = "${pkgs.tmux}/bin/tmux kill-session -t Terraria";
|
||||
Restart = "on-failure";
|
||||
Type = "forking";
|
||||
WorkingDirectory = "/mnt/ssd/SteamLibrary/steamapps/common/tModLoader";
|
||||
};
|
||||
};
|
||||
}
|
20
hosts/wizdesk/services/nixos/archi.nix
Normal file
20
hosts/wizdesk/services/nixos/archi.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
services.archisteamfarm = {
|
||||
enable = true;
|
||||
web-ui.enable = true;
|
||||
|
||||
bots.wizardlink = {
|
||||
enabled = true;
|
||||
username = "master1891891";
|
||||
|
||||
settings = {
|
||||
CustomGamePlayedWhileFarming = "In the fields";
|
||||
};
|
||||
};
|
||||
|
||||
bots.zak = {
|
||||
enabled = true;
|
||||
username = "matheuszak";
|
||||
};
|
||||
};
|
||||
}
|
57
hosts/wizdesk/services/nixos/caddy.nix
Normal file
57
hosts/wizdesk/services/nixos/caddy.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ ... }:
|
||||
{
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
email = "contact@thewizard.link";
|
||||
|
||||
virtualHosts."thewizard.link".extraConfig = ''
|
||||
redir https://github.com/wizardlink/
|
||||
header Strict-Transport-Security "max-age=63072000; includeSubDomains"
|
||||
'';
|
||||
|
||||
virtualHosts."jellyfin.thewizard.link".extraConfig = ''
|
||||
encode gzip
|
||||
reverse_proxy 127.0.0.1:8096 {
|
||||
flush_interval -1
|
||||
}
|
||||
'';
|
||||
|
||||
virtualHosts."jellyseerr.thewizard.link".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:5055
|
||||
'';
|
||||
|
||||
virtualHosts."foundry.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:30000 {
|
||||
flush_interval -1
|
||||
}
|
||||
'';
|
||||
|
||||
virtualHosts."git.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:3788
|
||||
'';
|
||||
|
||||
virtualHosts."files.thewizard.link".extraConfig = ''
|
||||
root * /srv/files
|
||||
file_server
|
||||
'';
|
||||
|
||||
virtualHosts."torrent.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8144
|
||||
'';
|
||||
|
||||
virtualHosts."shoko.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8111
|
||||
'';
|
||||
|
||||
virtualHosts."api.cosplay.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:3000
|
||||
'';
|
||||
|
||||
virtualHosts."cosplay.thewizard.link".extraConfig = ''
|
||||
root * /srv/cosplay
|
||||
encode
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
'';
|
||||
};
|
||||
}
|
12
hosts/wizdesk/services/nixos/default.nix
Normal file
12
hosts/wizdesk/services/nixos/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./archi.nix
|
||||
./caddy.nix
|
||||
./forgejo.nix
|
||||
./jellyfin.nix
|
||||
./nix-serve.nix
|
||||
./postgresql.nix
|
||||
];
|
||||
}
|
26
hosts/wizdesk/services/nixos/forgejo.nix
Normal file
26
hosts/wizdesk/services/nixos/forgejo.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
|
||||
lfs.enable = true;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
HTTP_PORT = 3788;
|
||||
LANDING_PAGE = "explore";
|
||||
ROOT_URL = "https://git.thewizard.link";
|
||||
};
|
||||
|
||||
ui = {
|
||||
# HACK: Unfortunately we need to manually put files in /var/lib/forgejo/custom/public/assets/css
|
||||
# so this will break in a new system.
|
||||
DEFAULT_THEME = "catppuccin-frappe-lavender";
|
||||
THEMES = "forgejo-auto,forgejo-light,forgejo-dark,gitea-auto,gitea-light,gitea-dark,forgejo-auto-deuteranopia-protanopia,forgejo-light-deuteranopia-protanopia,forgejo-dark-deuteranopia-protanopia,forgejo-auto-tritanopia,forgejo-light-tritanopia,forgejo-dark-tritanopia,catppuccin-latte-rosewater,catppuccin-latte-flamingo,catppuccin-latte-pink,catppuccin-latte-mauve,catppuccin-latte-red,catppuccin-latte-maroon,catppuccin-latte-peach,catppuccin-latte-yellow,catppuccin-latte-green,catppuccin-latte-teal,catppuccin-latte-sky,catppuccin-latte-sapphire,catppuccin-latte-blue,catppuccin-latte-lavender,catppuccin-frappe-rosewater,catppuccin-frappe-flamingo,catppuccin-frappe-pink,catppuccin-frappe-mauve,catppuccin-frappe-red,catppuccin-frappe-maroon,catppuccin-frappe-peach,catppuccin-frappe-yellow,catppuccin-frappe-green,catppuccin-frappe-teal,catppuccin-frappe-sky,catppuccin-frappe-sapphire,catppuccin-frappe-blue,catppuccin-frappe-lavender,catppuccin-macchiato-rosewater,catppuccin-macchiato-flamingo,catppuccin-macchiato-pink,catppuccin-macchiato-mauve,catppuccin-macchiato-red,catppuccin-macchiato-maroon,catppuccin-macchiato-peach,catppuccin-macchiato-yellow,catppuccin-macchiato-green,catppuccin-macchiato-teal,catppuccin-macchiato-sky,catppuccin-macchiato-sapphire,catppuccin-macchiato-blue,catppuccin-macchiato-lavender,catppuccin-mocha-rosewater,catppuccin-mocha-flamingo,catppuccin-mocha-pink,catppuccin-mocha-mauve,catppuccin-mocha-red,catppuccin-mocha-maroon,catppuccin-mocha-peach,catppuccin-mocha-yellow,catppuccin-mocha-green,catppuccin-mocha-teal,catppuccin-mocha-sky,catppuccin-mocha-sapphire,catppuccin-mocha-blue,catppuccin-mocha-lavender";
|
||||
};
|
||||
|
||||
service = {
|
||||
DISABLE_REGISTRATION = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
hosts/wizdesk/services/nixos/jellyfin.nix
Normal file
36
hosts/wizdesk/services/nixos/jellyfin.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.jellyfin = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = "wizardlink";
|
||||
package = pkgs.jellyfin.override {
|
||||
jellyfin-web = pkgs.jellyfin-web.overrideAttrs (
|
||||
final: prev: {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# Inject the skip intro button script.
|
||||
sed -i "s#</head>#<script src=\"configurationpage?name=skip-intro-button.js\"></script></head>#" dist/index.html
|
||||
|
||||
mkdir -p $out/share
|
||||
cp -a dist $out/share/jellyfin-web
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
services.jellyseerr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
package = pkgs.jellyseerr.overrideAttrs (
|
||||
_final: _prev: {
|
||||
dontCheckForBrokenSymlinks = true;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
9
hosts/wizdesk/services/nixos/nix-serve.nix
Normal file
9
hosts/wizdesk/services/nixos/nix-serve.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.nix-serve = {
|
||||
enable = true;
|
||||
port = 7373;
|
||||
secretKeyFile = "/etc/keys/nix-store-wizdesk-1";
|
||||
};
|
||||
}
|
13
hosts/wizdesk/services/nixos/postgresql.nix
Normal file
13
hosts/wizdesk/services/nixos/postgresql.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
initialScript = pkgs.writeText "backend-initScript" ''
|
||||
CREATE ROLE wizardlink WITH LOGIN SUPERUSER PASSWORD 'wizardlink' CREATEDB CREATEROLE REPLICATION;
|
||||
CREATE DATABASE wizardlink;
|
||||
GRANT ALL PRIVILEGES ON DATABASE wizardlink TO wizardlink;
|
||||
'';
|
||||
};
|
||||
}
|
53
hosts/wizlap/hardware-configuration.nix
Normal file
53
hosts/wizlap/hardware-configuration.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
# 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"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/796d5ad8-db83-4c4f-883d-2f1f4f1937de";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."luks-94d233be-889a-46a4-9c20-b7f026980cbf".device = "/dev/disk/by-uuid/94d233be-889a-46a4-9c20-b7f026980cbf";
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/CA05-302F";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0022"
|
||||
"dmask=0022"
|
||||
];
|
||||
};
|
||||
|
||||
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.docker0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
145
hosts/wizlap/home-manager.nix
Normal file
145
hosts/wizlap/home-manager.nix
Normal file
|
@ -0,0 +1,145 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
#
|
||||
## HOME CONFIGURATION #
|
||||
#
|
||||
|
||||
# Import configurations for better modularity.
|
||||
imports = [
|
||||
../../modules/emacs
|
||||
../../modules/hyprland/home-manager.nix
|
||||
../../modules/neovim
|
||||
../../shared/home-manager
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "wizardlink";
|
||||
home.homeDirectory = "/home/wizardlink";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.05"; # Please read the comment before changing.
|
||||
|
||||
home.file = {
|
||||
# Create wallpaper script to be read by the start_services.sh script.
|
||||
".local/share/scripts/wallpaper.sh" = {
|
||||
executable = true;
|
||||
text = # sh
|
||||
''
|
||||
#
|
||||
## Start wallpaper daemon and set one.
|
||||
#
|
||||
OUTPUT_1="eDP-1"
|
||||
IMAGE_1="/home/wizardlink/Pictures/wallhaven-x6p3y3.jpg"
|
||||
|
||||
function load_wallpapers() {
|
||||
swww img -t any --transition-bezier 0.0,0.0,1.0,1.0 --transition-duration .8 --transition-step 255 --transition-fps 60 -o $OUTPUT_1 $IMAGE_1;
|
||||
}
|
||||
|
||||
if ! swww query; then
|
||||
swww-daemon &
|
||||
fi
|
||||
|
||||
load_wallpapers &
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
#
|
||||
# PACKAGES #
|
||||
#
|
||||
|
||||
programs.direnv = {
|
||||
config = {
|
||||
whitelist = {
|
||||
prefix = [
|
||||
"/home/wizardlink/Documents/projects"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
## Tools
|
||||
# Utilities
|
||||
brightnessctl
|
||||
|
||||
# Create an FHS environment using the command `fhs`, enabling the execution of non-NixOS packages in NixOS!
|
||||
(
|
||||
let
|
||||
base = appimageTools.defaultFhsEnvArgs;
|
||||
in
|
||||
buildFHSEnv (
|
||||
base
|
||||
// {
|
||||
name = "fhs";
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
(
|
||||
# pkgs.buildFHSUserEnv provides only a minimal FHS environment,
|
||||
# lacking many basic packages needed by most software.
|
||||
# Therefore, we need to add them manually.
|
||||
#
|
||||
# pkgs.appimageTools provides basic packages required by most software.
|
||||
(base.targetPkgs pkgs)
|
||||
++ (with pkgs; [
|
||||
])
|
||||
);
|
||||
profile = "export FHS=1";
|
||||
runScript = "bash";
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
}
|
||||
)
|
||||
)
|
||||
];
|
||||
|
||||
#
|
||||
# MODULES #
|
||||
#
|
||||
|
||||
# Enable neovim
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
# Enable ollama support
|
||||
ollama.enable = true;
|
||||
|
||||
# Set the hostname for nixd in neovim
|
||||
nixd.hostname = "wizlap";
|
||||
};
|
||||
|
||||
# Add monitor configuration to hyprland
|
||||
modules.hyprland = {
|
||||
# Enable scripts
|
||||
scripts = {
|
||||
startup.enable = true;
|
||||
screenshot.enable = true;
|
||||
};
|
||||
|
||||
# Add monitor configuration to hyprland
|
||||
extraConfig = # hyprlang
|
||||
''
|
||||
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||
monitor = eDP-1, 1920x1080@60.01, 0x0, 1
|
||||
|
||||
# Bind workspaces to specific monitors
|
||||
workspace = 1, monitor:eDP-1
|
||||
workspace = 2, monitor:eDP-1
|
||||
workspace = 3, monitor:eDP-1
|
||||
workspace = 4, monitor:eDP-1
|
||||
workspace = 5, monitor:eDP-1
|
||||
workspace = 6, monitor:eDP-1
|
||||
workspace = 7, monitor:eDP-1
|
||||
workspace = 8, monitor:eDP-1
|
||||
workspace = 9, monitor:eDP-1
|
||||
workspace = 0, monitor:eDP-1
|
||||
'';
|
||||
};
|
||||
}
|
118
hosts/wizlap/nixos.nix
Normal file
118
hosts/wizlap/nixos.nix
Normal file
|
@ -0,0 +1,118 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../modules/hyprland/nixos.nix
|
||||
../../shared/nixos
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
#
|
||||
# NIXOS #
|
||||
#
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
# Consume my desktop's binary cache. This is specially useful since (in theory)
|
||||
# I will always update the flake and desktop machine first, so when I pull the changes,
|
||||
# my desktop will have all the binaries my laptop needs.
|
||||
nix.settings.substituters = [ "http://192.168.0.100:7373" ];
|
||||
nix.settings.trusted-public-keys = [
|
||||
"wizdesk-1:2UvctPjiMwMs7r2r7VPvoPmh4OcUjY3JmaRDJnOTZY8="
|
||||
];
|
||||
|
||||
#
|
||||
# SYSTEM #
|
||||
#
|
||||
networking.hostName = "wizlap"; # Define your hostname.
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall = {
|
||||
allowedTCPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
} # KDEConnect
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
} # KDEConnect
|
||||
];
|
||||
};
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.wizardlink = {
|
||||
createHome = true;
|
||||
description = "Alexandre Cavalheiro";
|
||||
extraGroups = [
|
||||
"docker"
|
||||
"gamemode"
|
||||
"libvirtd"
|
||||
"networkmanager"
|
||||
"openrazer"
|
||||
"postgresql"
|
||||
"wheel"
|
||||
];
|
||||
|
||||
initialPassword = "wizardlink";
|
||||
isNormalUser = true;
|
||||
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva <contact@thewizard.link>"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa
|
||||
];
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Sao_Paulo";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
supportedLocales = [
|
||||
"C.UTF-8/UTF-8"
|
||||
"en_GB.UTF-8/UTF-8"
|
||||
"en_US.UTF-8/UTF-8"
|
||||
"ja_JP.UTF-8/UTF-8"
|
||||
"pt_BR.UTF-8/UTF-8"
|
||||
];
|
||||
|
||||
extraLocaleSettings = {
|
||||
LANGUAGE = "en_US.UTF-8";
|
||||
LC_ADDRESS = "en_US.UTF-8";
|
||||
LC_ALL = "en_US.UTF-8";
|
||||
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||
LC_MEASUREMENT = "pt_BR.UTF-8";
|
||||
LC_MONETARY = "en_US.UTF-8";
|
||||
LC_NAME = "en_US.UTF-8";
|
||||
LC_NUMERIC = "pt_BR.UTF-8";
|
||||
LC_PAPER = "pt_BR.UTF-8";
|
||||
LC_TELEPHONE = "pt_BR.UTF-8";
|
||||
LC_TIME = "en_GB.UTF-8";
|
||||
};
|
||||
};
|
||||
|
||||
#
|
||||
# HARDWARE #
|
||||
#
|
||||
|
||||
# Enable Zenergy
|
||||
boot.initrd.kernelModules = [
|
||||
"zenergy"
|
||||
];
|
||||
boot.extraModulePackages = [
|
||||
config.boot.kernelPackages.zenergy
|
||||
];
|
||||
|
||||
# enable a better driver for wireless xbox controllers.
|
||||
hardware.xpadneo.enable = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue