diff --git a/.config/nix/hosts/common.nix b/.config/nix/hosts/common.nix index 1449b53..e084f36 100644 --- a/.config/nix/hosts/common.nix +++ b/.config/nix/hosts/common.nix @@ -1,6 +1,14 @@ { config, lib, pkgs, inputs, ... }: { + # Set default user lunita + users.users.lunita = { + isNormalUser = true; + description = "Lunita"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + shell = pkgs.zsh; + }; # Enable automatic system updates system.autoUpgrade = { enable = true; @@ -30,16 +38,12 @@ }; # Basic configuration stuff - WiFi, Xserver keyboard layout, Stylix networking.networkmanager.enable = true; - time.timeZone = "America/St_Thomas"; + time.timeZone = "America/St_Thomas"; # Timezone => AST i18n.defaultLocale = "en_US.UTF-8"; services.xserver.xkb = { layout = "us"; variant = ""; }; - stylix = { - enable = true; - image = ./bg.jpg; - }; # Zsh programs.zsh.enable = true; # Browser diff --git a/.config/nix/hosts/mecca/configuration.nix b/.config/nix/hosts/mecca/configuration.nix index e454b02..ecdf26e 100644 --- a/.config/nix/hosts/mecca/configuration.nix +++ b/.config/nix/hosts/mecca/configuration.nix @@ -1,155 +1,21 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, pkgs, inputs, ... }: { imports = [ ./hardware-configuration.nix + ../../modules/kanata.nix + ../../modules/efi.nix + ../../modules/laptop.nix + ../../modules/hypr.nix ]; -# SystemD-boot is good enough - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - systemd.tpm2.enable = false; + networking.hostName = "mecca"; - networking.hostName = "mecca"; # Change for given system - networking.networkmanager.enable = true; - - # Timezone => AST - time.timeZone = "America/St_Thomas"; - stylix = { enable = true; image = ./bg.jpg; }; - # Hyprland looks nice so I'm using it - programs.hyprland = { - enable = true; - withUWSM = true; - xwayland.enable = true; - }; - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - xdg.portal.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - - # using piprewire cuz embrace muh modernity - services.pipewire = { - enable = true; - pulse.enable = true; - }; - - services.libinput.enable = true; # for laptop touchpad - - # Laptop battery optimizations - # NOTE: Comment out if on PC/Not required for your rig - services.tlp = { - enable = true; - settings = { - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - - CPU_MIN_PERF_ON_AC = 0; - CPU_MAX_PERF_ON_AC = 100; - CPU_MIN_PERF_ON_BAT = 0; - CPU_MAX_PERF_ON_BAT = 20; - - START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge - STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging - }; - }; - services.auto-cpufreq.enable = true; - services.auto-cpufreq.settings = { - battery = { - governor = "powersave"; - turbo = "never"; - }; - charger = { - governor = "performance"; - turbo = "auto"; - }; - }; - powerManagement.powertop.enable = true; - - # Kanata setup - # Mostly copied from https://dev.to/shanu-kumawat/how-to-set-up-kanata-on-nixos-a-step-by-step-guide-1jkc - boot.kernelModules = [ "uinput" ]; # Enable uinput kernel module - hardware.uinput.enable = true; # Enable uinput - # Set up udev rules for uinput - services.udev.extraRules = '' - KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput" - ''; - users.groups.uinput = { }; # ensure uinput group exists - # Add Kanata service user to necessary groups - systemd.services.kanata-internalKeyboard.serviceConfig = { - SupplementaryGroups = [ - "input" - "uinput" - ]; - }; - # Kanata configuration - services.kanata = { - enable = true; - keyboards = { - internalKeyboard = { - devices = [ - "/dev/input/by-path/platform-i8042-serio-0-event-kbd" - ]; - configFile = builtins.fetchurl { - url = https://git.luluslly.xyz/lulusilly/dotfiles/raw/branch/master/.config/kanata/conf.kbd; - sha256 = "1jv6051igv4yxwr9bxzil6qrynvg3imlnh65lxhjdfcvpnmlcy6p"; - }; - }; - }; - }; - - # Default user account - users.users.lunita = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - shell = pkgs.zsh; - }; - # Enabling Emacs server - services.emacs = { - enable = true; - package = pkgs.emacs-gtk; - }; - # Enable zsh - programs.zsh.enable = true; - # Going with FF for now. Might switch over to Zen eventually - programs.firefox.enable = true; - # Enable Tailscale for homeserver stuff - services.tailscale.enable = true; - # Enable syncthing for Obsidian & KeePass DB sync across devices - services.syncthing.enable = true; - - environment.systemPackages = with pkgs; [ - # home-manager # For using Nix Home Manager - zsh # Default user shell - minecraftia # font - jetbrains-mono # font - terminus_font # font - neovim # Terminal text editor - wget # coreutil for some script compatibility - waybar # Status bar - libnotify # Desktop notifications - swww # Wallpaper manager - brightnessctl # For laptop backlight brightness control - grim # screenshot utility - slurp # select utility - wl-clipboard # xclip alternative - rofi-wayland # Dmenu replacement for Wayland - ghostty # Terminal emulator - ]; - - # Enable OpenSSH SSH Daemon - services.openssh.enable = true; - - # Copy sysconf in case this file is deleted or corrupted - # NOTE: Doesn't work with flakes enabled. - # system.copySystemConfiguration = true; - system.stateVersion = "25.05"; } diff --git a/.config/nix/hosts/syntheticnexus/configuration.nix b/.config/nix/hosts/syntheticnexus/configuration.nix index eb682d7..6c6399d 100644 --- a/.config/nix/hosts/syntheticnexus/configuration.nix +++ b/.config/nix/hosts/syntheticnexus/configuration.nix @@ -5,42 +5,17 @@ [ ./hardware-configuration.nix ../../modules/kanata.nix + ../../modules/laptop.nix + ../../modules/efi.nix + ../../modules/hypr.nix ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - systemd.tpm2.enable = false; networking.hostName = "syntheticnexus"; - services.displayManager.gdm.enable = true; - services.desktopManager.gnome.enable = true; - services.gnome.core-apps.enable = false; - services.gnome.core-developer-tools.enable = false; - services.gnome.games.enable = false; - environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ]; - - services.libinput.enable = true; # for laptop touchpad - - users.users.lunita = { - isNormalUser = true; - description = "Lunita"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - shell = pkgs.zsh; + stylix = { + enable = true; + image = ./bg.jpg; }; - environment.systemPackages = with pkgs; [ - curl - wget - neovim - git - home-manager - gnome-console - gnomeExtensions.blur-my-shell - gnomeExtensions.just-perfection - gnomeExtensions.paperwm - nyxt - ]; - system.stateVersion = "25.05"; } diff --git a/.config/nix/modules/efi.nix b/.config/nix/modules/efi.nix new file mode 100644 index 0000000..6aa4b51 --- /dev/null +++ b/.config/nix/modules/efi.nix @@ -0,0 +1,8 @@ +{ config, pkgs, inputs, ... } + +{ + # SystemD-boot is good enough + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + systemd.tpm2.enable = false; +} diff --git a/.config/nix/modules/hypr.nix b/.config/nix/modules/hypr.nix new file mode 100644 index 0000000..85edaca --- /dev/null +++ b/.config/nix/modules/hypr.nix @@ -0,0 +1,29 @@ +{ config, pkgs, inputs, ... } + +{ + # Hyprland looks nice so I'm using it + programs.hyprland = { + enable = true; + withUWSM = true; + xwayland.enable = true; + }; + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + + environment.systemPackages = with pkgs; [ + # home-manager # For using Nix Home Manager + zsh # Default user shell + neovim # Terminal text editor + wget # coreutil for some script compatibility + waybar # Status bar + libnotify # Desktop notifications + swww # Wallpaper manager + brightnessctl # For laptop backlight brightness control + grim # screenshot utility + slurp # select utility + wl-clipboard # xclip alternative + rofi-wayland # Dmenu replacement for Wayland + ghostty # Terminal emulator + ]; +} diff --git a/.config/nix/modules/laptop.nix b/.config/nix/modules/laptop.nix new file mode 100644 index 0000000..5af5317 --- /dev/null +++ b/.config/nix/modules/laptop.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, inputs, ...}: + +{ + services.libinput.enable = true; # for laptop touchpad + # Laptop battery optimizations + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 20; + + START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge + STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging + }; + }; + services.auto-cpufreq.enable = true; + services.auto-cpufreq.settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "performance"; + turbo = "auto"; + }; + }; + powerManagement.powertop.enable = true; +}