feat!: move everything around to accomodate two system configurations in one repo

This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2024-09-16 18:45:39 -03:00
parent d735060641
commit 53a2609204
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
82 changed files with 1786 additions and 863 deletions

30
modules/nixos/common.nix Normal file
View file

@ -0,0 +1,30 @@
{ ... }:
{
# Enable experimental features
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# 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";
};
# Optimize storage
nix.optimise.automatic = true;
nix.settings.auto-optimise-store = true;
# Enable Hyprland's cachix
nix.settings.substituters = [ "https://hyprland.cachix.org" ];
nix.settings.trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
}

13
modules/nixos/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }:
{
imports = [
./common.nix
./desktop.nix
./hardware.nix
./packages.nix
./services.nix
./sound.nix
./system.nix
];
}

83
modules/nixos/desktop.nix Normal file
View file

@ -0,0 +1,83 @@
{ pkgs, hyprland, ... }:
let
hyprland-pkgs = hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in
{
environment.sessionVariables = {
# Set env for Fcitx5
QMODIFIERS = "@im=fcitx5";
};
# Enable SDDM.
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "catppuccin-frappe";
package = pkgs.kdePackages.sddm;
};
# Enable Hyprland
programs.hyprland = {
enable = true;
package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = pkgs.xdg-desktop-portal-wlr;
};
# Enable XDG Desktop Portals.
xdg.portal = {
enable = true;
config = {
common = {
default = [ "wlr" ];
};
};
};
# Needed for home-manager
environment.pathsToLink = [
"/share/xdg-desktop-portal"
"/share/applications"
];
# Enable OpenGL.
hardware.graphics = {
enable = true;
enable32Bit = true;
package = hyprland-pkgs.mesa.drivers;
package32 = hyprland-pkgs.pkgsi686Linux.mesa.drivers;
extraPackages = with pkgs; [
rocm-opencl-icd # OpenGL hwa
rocm-opencl-runtime
];
};
# Enable Thunar and it's dependencies
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [ thunar-archive-plugin ];
};
programs.xfconf.enable = true; # For configuring
services.gvfs.enable = true; # For mounting drives, trash, etc.
services.tumbler.enable = true; # Thumbnail support
# Enable the Fcitx5 IME
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-catppuccin
];
waylandFrontend = true;
};
};
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
# Enable Bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
# Enable fstrim for better ssd lifespan
services.fstrim.enable = true;
}

108
modules/nixos/packages.nix Normal file
View file

@ -0,0 +1,108 @@
{ pkgs, ... }:
{
# 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;
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 ];
};
# Enable and configure gamemode.
programs.gamemode = {
enable = true;
enableRenice = true;
};
# Enable KDEConnect
programs.kdeconnect.enable = true;
# Enable Docker.
virtualisation.docker.enable = true;
# Enable virt-manager
programs.virt-manager.enable = true;
# Enable virtd and spice USB redirection
virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
## Tools
# Utilities
bat
btrfs-progs
duf
fuseiso
lm_sensors
p7zip
tree
unrar
unzip
wget
zip
# File managing
sshfs
yazi
# Virtualization
docker-compose
quickemu
# Desktop
wl-clipboard
xclip
zoxide
(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
## Libraries
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtquickcontrols2
pkgsi686Linux.gperftools # Needed for TF2 rn :(
## Hardware specific
openrazer-daemon # Razor products back-end
polychromatic # and it's front-end
vial
];
}

View file

@ -0,0 +1,38 @@
{
pkgs,
lib,
config,
...
}:
{
# Enable polkit,
security.polkit.enable = true;
# install an agent to interface with it,
environment.systemPackages = with pkgs; [ polkit_gnome ];
# And enable GNOME keyring for registering keys.
services.gnome.gnome-keyring.enable = true;
services.postgresql = {
identMap = lib.mkIf config.services.postgresql.enable ''
# MAP_NAME SYSTEM_USER DB_USER
superuser_map root postgres
superuser_map postgres postgres
superuser_map /^(.*)$ \1
'';
authentication = lib.mkIf config.services.postgresql.enable (
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
''
);
};
}

16
modules/nixos/sound.nix Normal file
View file

@ -0,0 +1,16 @@
{ ... }:
{
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

54
modules/nixos/system.nix Normal file
View file

@ -0,0 +1,54 @@
{ pkgs, config, ... }:
{
# Kernel
boot.kernelPackages = pkgs.linuxPackages_zen;
# Add AMD drivers.
boot.initrd.kernelModules = [ "amdgpu" ];
boot.extraModulePackages = [
config.boot.kernelPackages.v4l2loopback
];
# Bootloader.
boot.loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
# Enables zram.
zramSwap.enable = true;
# Enable networking
networking.networkmanager.enable = true;
# Enable WOL on my ethernet interface.
networking.interfaces.enp5s0.wakeOnLan.enable = true;
# 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;
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB