184 lines
5 KiB
Nix
184 lines
5 KiB
Nix
{ config, lib, pkgs, inputs, ... }:
|
|
|
|
{
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
# Enable automatic system updates
|
|
system.autoUpgrade = {
|
|
enable = true;
|
|
flake = inputs.self.outPath;
|
|
flags = [
|
|
"--update-input"
|
|
"nixpkgs"
|
|
"-L" # print build logs
|
|
];
|
|
dates = "weekly";
|
|
randomizedDelaySec = "45min";
|
|
};
|
|
# Allow non-free software (RMS will be mad at me :<)
|
|
nixpkgs.config.allowUnfree = true;
|
|
# Enable nix-command and flakes
|
|
nix.settings.experimental-features = [ "nix-command" "flakes"];
|
|
|
|
# SystemD-boot is good enough
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
systemd.tpm2.enable = false;
|
|
|
|
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"
|
|
];
|
|
extraDefCfg = "concurrent-tap-hold yes";
|
|
config = builtins.readFile ./kanata.kbd;
|
|
};
|
|
};
|
|
};
|
|
|
|
# Default user account
|
|
users.users.lunita = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" ];
|
|
packages = with pkgs; [
|
|
tree
|
|
];
|
|
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
|
|
jq
|
|
stow # For dotfiles deployment. May use home-manager in future
|
|
fastfetch # Muh epic r1ce!!!
|
|
minecraftia # font
|
|
jetbrains-mono # font
|
|
terminus_font # font
|
|
neovim # Terminal text editor
|
|
wget # coreutil for some script compatibility
|
|
htop # Resource manager
|
|
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
|
|
mpv # Video player
|
|
zathura # PDF/CBZ/EPUB/DJVU reader
|
|
tmux # Tride and true terminal multiplexer
|
|
obsidian # For epic note taking (really just mediocre journaling)
|
|
keepassxc # Secure password manager
|
|
syncthing # Self explanatory
|
|
tailscale # Same as above
|
|
];
|
|
|
|
# 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";
|
|
}
|