linuxware/nixos.nix

459 lines
10 KiB
Nix
Raw Normal View History

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-08-14 10:58:06 -03:00
{
config,
pkgs,
hyprland,
xdg-desktop-portal-hyprland,
2024-08-14 10:58:06 -03:00
...
}:
let
hyprland-pkgs = hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in
2023-11-05 04:53:31 -03:00
{
##
## NIXOS ##
##
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
2023-11-05 04:53:31 -03:00
# Enable experimental features
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
2023-11-05 04:53:31 -03:00
2024-07-04 15:42:55 -03:00
# Enable nh, a bundle of CLI utilities for NixOS
programs.nh = {
enable = true;
# Enable automatic garbage collection.
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/wizardlink/.system";
2023-11-05 04:53:31 -03:00
};
# 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;
2024-08-14 10:58:06 -03:00
# Enable Hyprland's cachix
nix.settings.substituters = [ "https://hyprland.cachix.org" ];
nix.settings.trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
2023-11-05 04:53:31 -03:00
# 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. Its 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
boot.extraModulePackages = [
config.boot.kernelPackages.v4l2loopback
2024-06-24 03:20:47 -03:00
(pkgs.callPackage ./kernel/zenergy.nix { kernel = pkgs.linux_zen; })
];
2023-11-05 04:53:31 -03:00
# Bootloader.
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
networking.hostName = "wizlap"; # Define your hostname.
2023-11-05 04:53:31 -03:00
# Enable networking
networking.networkmanager.enable = true;
# Open ports in the firewall.
networking.firewall = {
2024-02-28 06:48:35 -03:00
allowedTCPPorts = [ ];
2023-11-05 04:53:31 -03:00
2024-02-28 06:48:35 -03:00
allowedUDPPorts = [ ];
2023-11-05 04:53:31 -03:00
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
} # KDEConnect
2023-11-05 04:53:31 -03:00
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
} # KDEConnect
2023-11-05 04:53:31 -03:00
];
};
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Define system-wide variables.
environment.variables = { };
2023-11-05 04:53:31 -03:00
# Define variables that will be initialized in PAM.
environment.sessionVariables = {
# Set env for Fcitx5
QMODIFIERS = "@im=fcitx5";
};
# 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";
extraGroups = [
"docker"
2024-07-16 00:46:49 -03:00
"gamemode"
2024-06-27 00:44:16 -03:00
"libvirtd"
"networkmanager"
"openrazer"
2024-06-27 00:44:16 -03:00
"postgresql"
"wheel"
];
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>"
];
};
# 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"
];
2023-11-05 04:53:31 -03:00
extraLocaleSettings = {
LANGUAGE = "en_US.UTF-8";
2023-12-04 23:28:48 -03:00
LC_ADDRESS = "en_US.UTF-8";
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 = {
enable = true;
2023-11-05 04:53:31 -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" ];
};
# Enable QMK support.
2024-08-14 10:58:06 -03:00
# hardware.keyboard.qmk.enable = true;
# FIXME: Causing issues with xpadneo :(
2024-08-14 10:58:06 -03:00
# enable a better driver for wireless xbox controllers.
hardware.xpadneo.enable = true;
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;
wayland.enable = true;
2024-08-14 10:58:06 -03:00
theme = "catppuccin-frappe";
package = pkgs.kdePackages.sddm;
2023-11-05 04:53:31 -03:00
};
# Enable Hyprland
2024-08-14 10:58:06 -03:00
programs.hyprland = {
enable = true;
package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = xdg-desktop-portal-hyprland.packages.${pkgs.stdenv.hostPlatform.system}.default;
2024-08-14 10:58:06 -03:00
};
2024-06-15 22:56:54 -03:00
# Enable XDG Desktop Portals.
xdg.portal = {
enable = true;
config = {
common = {
default = [ "hyprland" ];
2024-06-15 22:56:54 -03:00
};
};
};
# Needed for home-manager
environment.pathsToLink = [
"/share/xdg-desktop-portal"
"/share/applications"
];
2023-11-05 04:53:31 -03:00
# Enable OpenGL.
hardware.graphics = {
2023-11-05 04:53:31 -03:00
enable = true;
enable32Bit = true;
2023-11-05 04:53:31 -03:00
2024-08-14 10:58:06 -03:00
package = hyprland-pkgs.mesa.drivers;
package32 = hyprland-pkgs.pkgsi686Linux.mesa.drivers;
2023-11-05 04:53:31 -03:00
extraPackages = with pkgs; [
rocm-opencl-icd # OpenGL hwa
rocm-opencl-runtime
];
};
2024-07-16 00:46:27 -03:00
# Enable Thunar and it's dependencies
2024-08-19 20:34:04 -03:00
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [ thunar-archive-plugin ];
};
2024-07-16 00:46:27 -03:00
programs.xfconf.enable = true; # For configuring
services.gvfs.enable = true; # For mounting drives, trash, etc.
services.tumbler.enable = true; # Thumbnail support
2023-11-05 04:53:31 -03:00
# Enable the Fcitx5 IME
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-catppuccin
];
waylandFrontend = true;
};
};
2023-11-05 04:53:31 -03:00
##
## SOUND #
##
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
audio.enable = true;
2023-11-05 04:53:31 -03:00
alsa.enable = true;
alsa.support32Bit = true;
2023-11-05 04:53:31 -03:00
pulse.enable = true;
#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;
2024-08-14 10:58:06 -03:00
2023-11-05 04:53:31 -03:00
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
# ^ Enables so we can transfer games to other computers in the network.
# Add Proton-GE to 'compatibilitytools.d'.
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;
2024-06-27 00:44:16 -03:00
# Enable virt-manager
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
2024-08-14 10:58:06 -03:00
virtualisation.spiceUSBRedirection.enable = true;
2024-06-27 00:44:16 -03:00
2023-11-05 04:53:31 -03:00
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
## Tools
# Utilities
bat
duf
2024-08-14 10:58:06 -03:00
fuseiso
lm_sensors
2024-08-14 10:58:06 -03:00
p7zip
2023-11-05 04:53:31 -03:00
tree
unrar
unzip
wget
zip
# File managing
2024-05-21 15:53:32 -03:00
sshfs
2024-03-15 23:40:18 -03:00
yazi
# Virtualization
docker-compose
2024-07-16 00:46:17 -03:00
quickemu
# Desktop
wl-clipboard
xclip
zoxide
2024-08-14 10:58:06 -03:00
(catppuccin-sddm.override # So SDDM finds the theme files.
{
flavor = "frappe";
font = "FantasqueSansM Nerd Font";
fontSize = "12";
background = "${./theming/sddm/Background.jpg}";
loginBackground = true;
}
)
# Networking
gping
nmap
# Processes
btop
killall
# Filter
fzf
ripgrep
2023-11-05 04:53:31 -03:00
## Libraries
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtquickcontrols2
];
# 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;
# Enables VIA
2024-08-14 10:58:06 -03:00
# services.udev.packages = [ pkgs.via ];
# FIXME: Causing issues with xpadneo :(
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;
'';
};
}