2023-11-05 04:53:31 -03:00
|
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page
|
|
|
|
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
|
|
|
|
2024-03-15 23:40:18 -03:00
|
|
|
|
{ config, pkgs, ... }:
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
##
|
|
|
|
|
## NIXOS ##
|
|
|
|
|
##
|
|
|
|
|
|
2024-03-25 22:29:41 -03:00
|
|
|
|
imports = [
|
|
|
|
|
# Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
# Include service configuration
|
2024-04-26 07:51:15 -03:00
|
|
|
|
./services/archi.nix
|
2024-03-25 22:29:41 -03:00
|
|
|
|
./services/caddy.nix
|
|
|
|
|
./services/jellyfin.nix
|
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
# Enable experimental features
|
2024-06-24 03:20:30 -03:00
|
|
|
|
nix.settings.experimental-features = [
|
|
|
|
|
"nix-command"
|
|
|
|
|
"flakes"
|
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
# Enable automatic garbage collection.
|
|
|
|
|
nix.gc = {
|
|
|
|
|
automatic = true;
|
|
|
|
|
dates = "weekly";
|
|
|
|
|
options = "--delete-older-than 1w";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Optimize storage
|
2024-06-04 17:46:48 -03:00
|
|
|
|
nix.optimise.automatic = true;
|
2023-11-05 04:53:31 -03:00
|
|
|
|
nix.settings.auto-optimise-store = true;
|
|
|
|
|
|
|
|
|
|
# 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"; # Did you read the comment?
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## SYSTEM ##
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Kernel
|
2024-06-24 03:20:47 -03:00
|
|
|
|
boot.kernelPackages = pkgs.linuxPackages_zen;
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
# Add AMD drivers.
|
|
|
|
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
|
|
|
|
|
|
|
|
# TODO: FIX IT BEING BEING OVERWRITTEN
|
2024-03-25 22:29:41 -03:00
|
|
|
|
boot.extraModulePackages = [
|
|
|
|
|
config.boot.kernelPackages.v4l2loopback
|
2024-06-24 03:20:47 -03:00
|
|
|
|
(pkgs.callPackage ./kernel/zenergy.nix { kernel = pkgs.linux_zen; })
|
2024-03-25 22:29:41 -03:00
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
# Bootloader.
|
|
|
|
|
boot.loader = {
|
|
|
|
|
systemd-boot = {
|
|
|
|
|
enable = true;
|
|
|
|
|
configurationLimit = 10;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.hostName = "nixos"; # Define your hostname.
|
|
|
|
|
|
|
|
|
|
# Enable networking
|
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
|
|
2024-05-13 11:56:50 -03:00
|
|
|
|
# Enable WOL on my ethernet interface.
|
|
|
|
|
networking.interfaces.enp5s0.wakeOnLan.enable = true;
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
# Open ports in the firewall.
|
|
|
|
|
networking.firewall = {
|
|
|
|
|
allowedTCPPorts = [
|
2024-01-16 11:33:01 -03:00
|
|
|
|
11753 # OpenRCT2
|
2024-04-11 20:04:41 -03:00
|
|
|
|
14004 # Veloren
|
2024-01-16 11:33:01 -03:00
|
|
|
|
443 # SSL
|
2024-01-31 18:37:02 -03:00
|
|
|
|
80 # HTTP
|
2023-11-05 04:53:31 -03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
allowedUDPPorts = [
|
2024-01-16 11:33:01 -03:00
|
|
|
|
11753 # OpenRCT2
|
2024-04-11 20:04:41 -03:00
|
|
|
|
14004 # Veloren
|
2024-01-31 18:37:02 -03:00
|
|
|
|
2626 # Dolphin emulator
|
2024-01-16 11:33:01 -03:00
|
|
|
|
27015 # Source games
|
2024-01-31 18:37:02 -03:00
|
|
|
|
8211 # Palworld
|
2023-11-05 04:53:31 -03:00
|
|
|
|
];
|
|
|
|
|
|
2024-06-24 03:20:30 -03:00
|
|
|
|
allowedTCPPortRanges = [
|
|
|
|
|
{
|
|
|
|
|
from = 1714;
|
|
|
|
|
to = 1764;
|
|
|
|
|
} # KDEConnect
|
2024-04-11 20:04:41 -03:00
|
|
|
|
];
|
2024-06-24 03:20:30 -03:00
|
|
|
|
allowedUDPPortRanges = [
|
|
|
|
|
{
|
|
|
|
|
from = 1714;
|
|
|
|
|
to = 1764;
|
|
|
|
|
} # KDEConnect
|
2024-04-11 20:04:41 -03:00
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
# Or disable the firewall altogether.
|
|
|
|
|
# networking.firewall.enable = false;
|
|
|
|
|
|
|
|
|
|
# Define system-wide variables.
|
2023-12-30 12:54:44 -03:00
|
|
|
|
environment.variables = { };
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
2023-12-11 14:10:40 -03:00
|
|
|
|
# Set fish as the default shell for all users.
|
|
|
|
|
users.defaultUserShell = pkgs.fish;
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
|
|
|
|
users.users.wizardlink = {
|
|
|
|
|
createHome = true;
|
|
|
|
|
description = "Alexandre Cavalheiro";
|
2024-06-24 03:20:30 -03:00
|
|
|
|
extraGroups = [
|
|
|
|
|
"networkmanager"
|
|
|
|
|
"wheel"
|
|
|
|
|
"postgresql"
|
|
|
|
|
"docker"
|
|
|
|
|
"openrazer"
|
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
2024-02-04 22:26:36 -03:00
|
|
|
|
initialPassword = "wizardlink";
|
2023-11-05 04:53:31 -03:00
|
|
|
|
isNormalUser = true;
|
|
|
|
|
|
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDdGOyRbu6IOw9yqotxE6m7wCif7oP/2D0tlREa5Q6uo Alexandre Cavalheiro S. Tiago da Silva <contact@thewizard.link>"
|
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIISfCUsZrnCMZapdrvkUCrdRiX+1xuZBdGrynNRzDI2v" # SpaceEEC
|
2024-01-03 21:11:31 -03:00
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPInBFp7zBLhFluoww65CZzcnMdhndTawBv8QYJ5s/Xt david.alejandro.rubio@gmail.com" # Kodehawa
|
2023-11-05 04:53:31 -03:00
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
|
time.timeZone = "America/Sao_Paulo";
|
|
|
|
|
|
|
|
|
|
# Select internationalisation properties.
|
|
|
|
|
i18n = {
|
|
|
|
|
defaultLocale = "en_US.UTF-8";
|
2024-03-25 22:29:41 -03:00
|
|
|
|
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"
|
|
|
|
|
];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
extraLocaleSettings = {
|
2024-03-25 22:29:41 -03:00
|
|
|
|
LANGUAGE = "en_US.UTF-8";
|
2023-12-04 23:28:48 -03:00
|
|
|
|
LC_ADDRESS = "en_US.UTF-8";
|
2024-03-25 22:29:41 -03:00
|
|
|
|
LC_ALL = "en_US.UTF-8";
|
2023-12-04 23:28:48 -03:00
|
|
|
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
2023-11-05 04:53:31 -03:00
|
|
|
|
LC_MEASUREMENT = "pt_BR.UTF-8";
|
2023-12-04 23:28:48 -03:00
|
|
|
|
LC_MONETARY = "en_US.UTF-8";
|
|
|
|
|
LC_NAME = "en_US.UTF-8";
|
2023-11-05 04:53:31 -03:00
|
|
|
|
LC_NUMERIC = "pt_BR.UTF-8";
|
|
|
|
|
LC_PAPER = "pt_BR.UTF-8";
|
|
|
|
|
LC_TELEPHONE = "pt_BR.UTF-8";
|
2023-12-04 23:28:48 -03:00
|
|
|
|
LC_TIME = "en_GB.UTF-8";
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Enable CUPS to print documents.
|
|
|
|
|
services.printing.enable = true;
|
|
|
|
|
|
|
|
|
|
# Enable the OpenSSH daemon.
|
|
|
|
|
services.openssh = {
|
2024-01-16 11:33:01 -03:00
|
|
|
|
enable = true;
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
2024-01-16 11:33:01 -03:00
|
|
|
|
settings = {
|
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
|
PermitRootLogin = "no";
|
|
|
|
|
};
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## HARDWARE ##
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Enable Bluetooth
|
|
|
|
|
hardware.bluetooth = {
|
|
|
|
|
enable = true;
|
|
|
|
|
powerOnBoot = true;
|
|
|
|
|
};
|
|
|
|
|
services.blueman.enable = true;
|
|
|
|
|
|
|
|
|
|
# Enable openrazer for managing Razer products' configuration
|
|
|
|
|
hardware.openrazer = {
|
|
|
|
|
enable = true;
|
|
|
|
|
users = [ "wizardlink" ];
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-13 11:58:36 -03:00
|
|
|
|
# Enable QMK support.
|
|
|
|
|
hardware.keyboard.qmk.enable = true;
|
|
|
|
|
|
2024-06-24 03:21:05 -03:00
|
|
|
|
# Enable the udev rules Steam recommends for controllers.
|
|
|
|
|
hardware.steam-hardware.enable = true;
|
2023-12-30 12:54:44 -03:00
|
|
|
|
|
2024-01-31 18:37:02 -03:00
|
|
|
|
# Enable fstrim for better ssd lifespan
|
|
|
|
|
services.fstrim.enable = true;
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
##
|
|
|
|
|
## DESKTOP ##
|
|
|
|
|
##
|
|
|
|
|
|
2024-04-26 07:52:25 -03:00
|
|
|
|
# Enable SDDM.
|
|
|
|
|
services.displayManager.sddm = {
|
2023-11-05 04:53:31 -03:00
|
|
|
|
enable = true;
|
2024-04-26 07:52:25 -03:00
|
|
|
|
wayland.enable = true;
|
2024-05-13 11:58:36 -03:00
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
theme = "${import ./theming/sddm.nix { inherit pkgs; }}";
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-28 01:16:30 -03:00
|
|
|
|
# Enable Hyprland
|
|
|
|
|
programs.hyprland.enable = true;
|
|
|
|
|
|
2024-06-15 22:56:54 -03:00
|
|
|
|
# Enable XDG Desktop Portals.
|
|
|
|
|
xdg.portal = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
2024-06-24 03:20:30 -03:00
|
|
|
|
extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ];
|
2024-06-15 22:56:54 -03:00
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
common = {
|
2024-06-24 03:20:30 -03:00
|
|
|
|
default = [ "hyprland" ];
|
2024-06-15 22:56:54 -03:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
# Enable OpenGL.
|
2024-06-24 03:22:26 -03:00
|
|
|
|
hardware.graphics = {
|
2023-11-05 04:53:31 -03:00
|
|
|
|
enable = true;
|
2024-06-24 03:22:26 -03:00
|
|
|
|
enable32Bit = true;
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
|
rocm-opencl-icd # OpenGL hwa
|
|
|
|
|
rocm-opencl-runtime
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## INPUT ##
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Configure keymap in X11
|
|
|
|
|
services.xserver = {
|
2024-02-06 10:25:37 -03:00
|
|
|
|
xkb = {
|
|
|
|
|
layout = "us";
|
|
|
|
|
variant = "";
|
|
|
|
|
};
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## SOUND #
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Enable sound with pipewire.
|
|
|
|
|
sound.enable = true;
|
|
|
|
|
hardware.pulseaudio.enable = false;
|
|
|
|
|
security.rtkit.enable = true;
|
|
|
|
|
services.pipewire = {
|
|
|
|
|
enable = true;
|
2024-04-11 20:05:01 -03:00
|
|
|
|
audio.enable = true;
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
alsa.enable = true;
|
|
|
|
|
alsa.support32Bit = true;
|
2024-04-11 20:05:01 -03:00
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
pulse.enable = true;
|
|
|
|
|
|
2024-04-11 20:05:01 -03:00
|
|
|
|
#jack.enable = true;
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## PACKAGES ##
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Allow unfree packages
|
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
|
|
|
|
|
# Enable GPG.
|
|
|
|
|
programs.gnupg.agent = {
|
|
|
|
|
enable = true;
|
|
|
|
|
enableSSHSupport = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Enable fish system-wide to integrate with nixpkgs.
|
|
|
|
|
programs.fish.enable = true;
|
|
|
|
|
|
|
|
|
|
# Enable Steam.
|
|
|
|
|
programs.steam = {
|
|
|
|
|
enable = true;
|
|
|
|
|
remotePlay.openFirewall = true;
|
2024-06-24 03:22:26 -03:00
|
|
|
|
|
|
|
|
|
extraCompatPackages = with pkgs; [ proton-ge-bin ];
|
2023-11-05 04:53:31 -03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Enable and configure gamemode.
|
|
|
|
|
programs.gamemode = {
|
|
|
|
|
enable = true;
|
|
|
|
|
enableRenice = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Enable KDEConnect
|
|
|
|
|
programs.kdeconnect.enable = true;
|
|
|
|
|
|
|
|
|
|
# Enable Docker.
|
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
|
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
|
# $ nix search wget
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
## Tools
|
|
|
|
|
# Utilities
|
|
|
|
|
bat
|
2024-02-25 09:36:42 -03:00
|
|
|
|
btop
|
2023-11-05 04:53:31 -03:00
|
|
|
|
docker-compose
|
|
|
|
|
duf
|
|
|
|
|
fzf
|
|
|
|
|
gping
|
|
|
|
|
killall
|
2024-02-25 09:36:42 -03:00
|
|
|
|
lm_sensors
|
2023-11-05 04:53:31 -03:00
|
|
|
|
nmap
|
|
|
|
|
ripgrep
|
|
|
|
|
tree
|
|
|
|
|
unrar
|
|
|
|
|
unzip
|
|
|
|
|
wget
|
2023-12-18 19:37:56 -03:00
|
|
|
|
wl-clipboard
|
|
|
|
|
xclip
|
2023-11-05 04:53:31 -03:00
|
|
|
|
zip
|
|
|
|
|
zoxide
|
2024-02-07 19:12:51 -03:00
|
|
|
|
|
|
|
|
|
# File managing
|
2024-05-21 15:53:32 -03:00
|
|
|
|
sshfs
|
2024-03-15 23:40:18 -03:00
|
|
|
|
yazi
|
2024-02-07 19:12:51 -03:00
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
## Libraries
|
|
|
|
|
libsForQt5.qt5.qtgraphicaleffects
|
|
|
|
|
libsForQt5.qt5.qtquickcontrols2
|
2024-01-31 18:37:02 -03:00
|
|
|
|
pkgsi686Linux.gperftools # Needed for TF2 rn :(
|
2023-11-05 04:53:31 -03:00
|
|
|
|
|
|
|
|
|
## Hardware specific
|
|
|
|
|
openrazer-daemon # Razor products back-end
|
2024-05-13 11:58:21 -03:00
|
|
|
|
polychromatic # and it's front-end
|
2024-05-13 11:58:36 -03:00
|
|
|
|
via
|
2023-11-05 04:53:31 -03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
# };
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## SERVICES #
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
# Enable flatpak
|
|
|
|
|
services.flatpak.enable = true;
|
|
|
|
|
|
2024-05-13 11:58:36 -03:00
|
|
|
|
# Enables VIA
|
|
|
|
|
services.udev.packages = [ pkgs.via ];
|
|
|
|
|
|
2023-11-05 04:53:31 -03:00
|
|
|
|
# Enable and configure PostgreSQL.
|
|
|
|
|
services.postgresql = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
|
|
identMap = ''
|
|
|
|
|
# MAP_NAME SYSTEM_USER DB_USER
|
|
|
|
|
superuser_map root postgres
|
|
|
|
|
superuser_map postgres postgres
|
|
|
|
|
superuser_map /^(.*)$ \1
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
authentication = pkgs.lib.mkOverride 10 ''
|
|
|
|
|
# TYPE DATABASE USER ADDRESS METHOD MAP
|
|
|
|
|
local all all peer map=superuser_map
|
|
|
|
|
host all all 127.0.0.1/32 md5
|
|
|
|
|
host all all ::1/128 md5
|
|
|
|
|
local replication all peer map=superuser_map
|
|
|
|
|
host replication all 127.0.0.1/32 ident map=superuser_map
|
|
|
|
|
host replication all ::1/128 ident map=superuser_map
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
}
|