more reorg

This commit is contained in:
Matt Nish-Lapidus 2025-02-08 22:48:41 -05:00
parent f3413ce790
commit a058fa3c90
6 changed files with 251 additions and 230 deletions

View file

@ -2,37 +2,48 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ nix-config, config, pkgs, inputs, ... }:
{
nix-config,
config,
pkgs,
inputs,
...
}:
{
imports = with nix-config.nixosModules;
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./razer-speaker-fix.nix
imports = with nix-config.nixosModules; [
# Include the results of the hardware scan.
./hardware-configuration.nix
./razer-speaker-fix.nix
niri
];
niri
];
nixpkgs = {
config = {
allowUnfree = true;
};
overlays = builtins.attrValues nix-config.overlays
++ [
inputs.niri.overlays.niri
inputs.emacs-overlay.overlays.default
inputs.audio.overlays.default
inputs.nix-rice.overlays.default
];
overlays = builtins.attrValues nix-config.overlays ++ [
inputs.niri.overlays.niri
inputs.emacs-overlay.overlays.default
inputs.audio.overlays.default
inputs.nix-rice.overlays.default
];
};
nix = {
# registry.nixpkgs.flake = nixpkgs;
# channel.enable = false;
settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://nix-community.cachix.org" "https://cache.garnix.io" ];
experimental-features = [
"nix-command"
"flakes"
];
substituters = [
"https://nix-community.cachix.org"
"https://cache.garnix.io"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
@ -77,14 +88,23 @@
};
kernelPackages = pkgs.linuxPackages_latest;
initrd.systemd.enable = true;
initrd.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" "snd-virmidi" ];
kernelParams = [ "nvidia_drm.fbdev=1" "nvidia_drm.modeset=1" ];
initrd.kernelModules = [
"nvidia"
"nvidia_modeset"
"nvidia_uvm"
"nvidia_drm"
"snd-virmidi"
];
kernelParams = [
"nvidia_drm.fbdev=1"
"nvidia_drm.modeset=1"
];
};
systemd.services.tailscaled.after = ["NetworkManager-wait-online.service"];
systemd.services.tailscaled.after = [ "NetworkManager-wait-online.service" ];
systemd.sleep.extraConfig = ''
HibernateDelaySec=2h
'';
HibernateDelaySec=2h
'';
documentation = {
dev.enable = true;
@ -169,46 +189,46 @@
services.logind = {
extraConfig = ''
IdleAction=lock
IdleActionSec=5m
IdleAction=lock
IdleActionSec=5m
'';
};
services.udev = {
extraRules = ''
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
'';
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
'';
packages = [
pkgs.via
pkgs.vial
(pkgs.writeTextFile {
name = "on-battery";
text = ''
# Rule for when switching to battery
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set balanced"
# Rule for when switching to battery
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set balanced"
'';
destination = "/etc/udev/rules.d/60-onbattery.rules";
})
(pkgs.writeTextFile {
name = "on-power";
text = ''
# Rule for when switching to ac
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance"
# Rule for when switching to ac
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance"
'';
destination = "/etc/udev/rules.d/61-onpower.rules";
})
(pkgs.writeTextFile {
name = "hibernate-low-battery";
text = ''
# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="${pkgs.systemd}/bin/systemctl hibernate"
# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="${pkgs.systemd}/bin/systemctl hibernate"
'';
destination = "/etc/udev/rules.d/99-hibernate-low-battery.rules";
})
(pkgs.writeTextFile {
name = "on-battery-power-saver";
text = ''
# Switch to power-saver when battery below 50%
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5][0-9]", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set power-saver"
# Switch to power-saver when battery below 50%
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5][0-9]", RUN+="${pkgs.power-profiles-daemon}/bin/powerprofilesctl set power-saver"
'';
destination = "/etc/udev/rules.d/62-power-save-battery.rules";
})
@ -217,15 +237,21 @@
security.polkit.enable = true;
security.rtkit.enable = true;
security.pam.services.swaylock = {};
security.pam.services.hyprlock = {};
security.pam.services.swaylock = { };
security.pam.services.hyprlock = { };
services.xserver.videoDrivers = [ "nvidia" "modesetting" ];
services.xserver.videoDrivers = [
"nvidia"
"modesetting"
];
networking = {
hostName = "eddie";
domain = "local";
nameservers = [ "1.1.1.1" "1.0.0.1" ];
nameservers = [
"1.1.1.1"
"1.0.0.1"
];
networkmanager = {
enable = true;
wifi.powersave = true;
@ -250,10 +276,10 @@
services.resolved = {
enable = true;
extraConfig = ''
LLMNR=no
ReadEtcHosts=no
DNSSEC=no
'';
LLMNR=no
ReadEtcHosts=no
DNSSEC=no
'';
};
# Set your time zone.
@ -417,14 +443,14 @@
programs.fish.enable = true;
environment.pathsToLink = [ "/share/fish" ];
programs.bash = {
interactiveShellInit = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
interactiveShellInit = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
services.flatpak.enable = true;
services.dbus.implementation = "broker";
@ -443,37 +469,37 @@
services.gnome.gnome-online-accounts.enable = true;
services.kmonad = {
enable = true;
keyboards = {
sinc = {
device = "/dev/input/by-id/usb-Keebio_Sinc_Rev._4-event-kbd";
config = builtins.readFile ../../homes/emenel/dotfiles/dot_config/kmonad/sinc.kbd;
};
razer = {
extraGroups = [ "openrazer" ];
device = "/dev/input/by-id/usb-Razer_Razer_Blade-if01-event-kbd";
config = builtins.readFile ../../homes/emenel/dotfiles/dot_config/kmonad/razer.kbd;
};
};
};
enable = true;
keyboards = {
sinc = {
device = "/dev/input/by-id/usb-Keebio_Sinc_Rev._4-event-kbd";
config = builtins.readFile ../../homes/emenel/dotfiles/dot_config/kmonad/sinc.kbd;
};
razer = {
extraGroups = [ "openrazer" ];
device = "/dev/input/by-id/usb-Razer_Razer_Blade-if01-event-kbd";
config = builtins.readFile ../../homes/emenel/dotfiles/dot_config/kmonad/razer.kbd;
};
};
};
# programs.virt-manager.enable = true;
programs.virt-manager.enable = true;
# virtualisation = {
# libvirtd = {
# enable = true;
# qemu = {
# package = pkgs.qemu_kvm;
# swtpm.enable = true;
# ovmf.enable = true;
# ovmf.packages = [ pkgs.OVMFFull.fd ];
# };
# };
# spiceUSBRedirection.enable = true;
# };
virtualisation = {
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = [ pkgs.OVMFFull.fd ];
};
};
spiceUSBRedirection.enable = true;
};
# services.qemuGuest.enable = true;
# services.spice-vdagentd.enable = true;
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
programs.appimage = {
enable = true;
@ -485,35 +511,35 @@
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
zlib
zstd
stdenv.cc.cc
curlFull
openssl.out
attr
libssh
libxcrypt.out
bzip2
libxml2
acl
libsodium
util-linux
xz
systemd
fontconfig
freetype
gnutls
util-linux
libGL.dev
psutils
egl-wayland
eglexternalplatform
glfw-wayland
glfw
libGLU.dev
libuv.out
libressl.out
libudev-zero.out
zlib
zstd
stdenv.cc.cc
curlFull
openssl.out
attr
libssh
libxcrypt.out
bzip2
libxml2
acl
libsodium
util-linux
xz
systemd
fontconfig
freetype
gnutls
util-linux
libGL.dev
psutils
egl-wayland
eglexternalplatform
glfw-wayland
glfw
libGLU.dev
libuv.out
libressl.out
libudev-zero.out
];
fonts = {
@ -569,7 +595,22 @@
users.users.emenel = {
isNormalUser = true;
description = "emenel";
extraGroups = [ "networkmanager" "network" "wheel" "uinput" "uucp" "dialout" "input" "audio" "video" "libvirtd" "nvidia" "cups" "openrazer" "plugdev" ];
extraGroups = [
"networkmanager"
"network"
"wheel"
"uinput"
"uucp"
"dialout"
"input"
"audio"
"video"
"libvirtd"
"nvidia"
"cups"
"openrazer"
"plugdev"
];
packages = with pkgs; [
git
];
@ -578,6 +619,4 @@
#do not change
system.stateVersion = "24.05";
}