Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-07-16 19:25:32 +02:00
parent f74e15288b
commit 18c8afb616
18 changed files with 150 additions and 147 deletions

View File

@@ -12,7 +12,7 @@
enable = true;
extraConfig = {
"10-disable-camera" = {
"wireplumber.profiles" = { main."monitor.libcamera" = "disabled"; };
"wireplumber.profiles" = {main."monitor.libcamera" = "disabled";};
};
};
};

View File

@@ -1,5 +1,5 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ blueman ];
{pkgs, ...}: {
environment.systemPackages = with pkgs; [blueman];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

View File

@@ -1,4 +1,4 @@
{ config, ... }: {
{config, ...}: {
virtualisation.docker.enable = true;
users.users."${config.var.username}".extraGroups = [ "docker" ];
users.users."${config.var.username}".extraGroups = ["docker"];
}

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
fonts = {
packages = with pkgs; [
roboto

View File

@@ -1,8 +1,8 @@
{ inputs, ... }: {
{inputs, ...}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm-backup";
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = {inherit inputs;};
};
}

View File

@@ -1,4 +1,8 @@
{ inputs, pkgs, ... }: {
{
inputs,
pkgs,
...
}: {
programs.hyprland = {
enable = true;
withUWSM = true;

View File

@@ -1,26 +1,34 @@
{ config, inputs, ... }:
let autoGarbageCollector = config.var.autoGarbageCollector;
{
config,
inputs,
...
}: let
autoGarbageCollector = config.var.autoGarbageCollector;
in {
security.sudo.extraRules = [{
users = [ config.var.username ];
commands = [{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "NOPASSWD" ];
}];
}];
security.sudo.extraRules = [
{
users = [config.var.username];
commands = [
{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = ["NOPASSWD"];
}
];
}
];
nixpkgs.config = {
allowUnfree = true;
allowBroken = true;
};
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
channel.enable = false;
extraOptions = ''
warn-dirty = false
'';
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
experimental-features = ["nix-command" "flakes"];
substituters = [
# high priority since it's almost always used
"https://cache.nixos.org?priority=10"

View File

@@ -1,12 +1,13 @@
{ lib, pkgs, config, ... }:
let
{
pkgs,
config,
...
}: let
# Using beta driver for recent GPUs like RTX 4070
nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.beta;
in {
# Video drivers configuration for Xorg and Wayland
services.xserver.videoDrivers =
[ "nvidia" ]; # Simplified - other modules are loaded automatically
services.xserver.videoDrivers = ["nvidia"]; # Simplified - other modules are loaded automatically
# Kernel parameters for better Wayland and Hyprland integration
boot.kernelParams = [
@@ -16,7 +17,7 @@ in {
];
# Blacklist nouveau to avoid conflicts
boot.blacklistedKernelModules = [ "nouveau" ];
boot.blacklistedKernelModules = ["nouveau"];
# Environment variables for better compatibility
environment.variables = {
@@ -88,7 +89,7 @@ in {
# Nix cache for CUDA
nix.settings = {
substituters = [ "https://cuda-maintainers.cachix.org" ];
substituters = ["https://cuda-maintainers.cachix.org"];
trusted-public-keys = [
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];

View File

@@ -1,8 +1,15 @@
{ config, pkgs, ... }:
let
hp-omen-linux-module = pkgs.callPackage
({ kernel ? config.boot.kernelPackages.kernel, stdenv, fetchFromGitHub }:
{
config,
pkgs,
...
}: let
hp-omen-linux-module =
pkgs.callPackage
({
kernel ? config.boot.kernelPackages.kernel,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "hp-omen-linux-module";
version = "rebase-6.14";
@@ -24,13 +31,13 @@ let
install hp-wmi.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86/hp/
runHook postInstall
'';
})) { kernel = config.boot.kernelPackages.kernel; };
})) {kernel = config.boot.kernelPackages.kernel;};
in {
boot.extraModulePackages = [ hp-omen-linux-module ];
boot.kernelModules = [ "hp-wmi" ];
boot.extraModulePackages = [hp-omen-linux-module];
boot.kernelModules = ["hp-wmi"];
users.groups.omen-rgb = { };
users.users.${config.var.username}.extraGroups = [ "omen-rgb" ];
users.groups.omen-rgb = {};
users.users.${config.var.username}.extraGroups = ["omen-rgb"];
systemd.tmpfiles.rules = [
"w /sys/devices/platform/hp-wmi/rgb_zones/zone00 0660 root omen-rgb -"
@@ -51,22 +58,4 @@ in {
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone03", \
RUN+="${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone03"
'';
# systemd.services.fix-hp-omen-perms = {
# description = "Fix HP Omen keyboard RGB zone permissions";
# after = [ "systemd-modules-load.service" ];
# wantedBy = [ "multi-user.target" ];
# serviceConfig = {
# Type = "oneshot";
# ExecStart = ''
# ${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone00
# ${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone00
# ${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone01
# ${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone01
# ${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone02
# ${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone02
# ${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone03
# ${pkgs.coreutils}/bin/chmod 0660 /sys/devices/platform/hp-wmi/rgb_zones/zone03
# '';
# };
# };
}

View File

@@ -1,34 +1,14 @@
# SDDM is a display manager for X11 and Wayland
{ pkgs, inputs, config, lib, ... }:
let
{
pkgs,
inputs,
config,
...
}: let
foreground = config.theme.textColorOnWallpaper;
sddm-astronaut = pkgs.sddm-astronaut.override {
embeddedTheme = "pixel_sakura";
# TODO: Cleaner version for static vs .gif, just a string.replace
themeConfig = if lib.hasSuffix "sakura_static.png" config.stylix.image then
{ }
else if lib.hasSuffix "studio.png" config.stylix.image then {
Background = pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/anotherhadi/nixy-wallpapers/refs/heads/main/wallpapers/studio.gif";
sha256 = "sha256-qySDskjmFYt+ncslpbz0BfXiWm4hmFf5GPWF2NlTVB8=";
};
HeaderTextColor = "#${foreground}";
DateTextColor = "#${foreground}";
TimeTextColor = "#${foreground}";
LoginFieldTextColor = "#${foreground}";
PasswordFieldTextColor = "#${foreground}";
UserIconColor = "#${foreground}";
PasswordIconColor = "#${foreground}";
WarningColor = "#${foreground}";
LoginButtonBackgroundColor = "#${foreground}";
SystemButtonsIconsColor = "#${foreground}";
SessionButtonTextColor = "#${foreground}";
VirtualKeyboardButtonTextColor = "#${foreground}";
DropdownBackgroundColor = "#${foreground}";
HighlightBackgroundColor = "#${foreground}";
} else {
Background = "${toString config.stylix.image}";
themeConfig = {
HeaderTextColor = "#${foreground}";
DateTextColor = "#${foreground}";
TimeTextColor = "#${foreground}";
@@ -43,26 +23,37 @@ let
VirtualKeyboardButtonTextColor = "#${foreground}";
DropdownBackgroundColor = "#${foreground}";
HighlightBackgroundColor = "#${foreground}";
Background =
if "sakura_pixelart_light_static.png" == config.stylix.image
then
pkgs.fetchurl {
url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/sakura_pixelart_light_animated.gif";
sha256 = "sha256-qySDskjmFYt+ncslpbz0BfXiWm4hmFf5GPWF2NlTVB8=";
}
else if "cat-watching-the-star_pixelart_purple_static.png" == config.stylix.image
then
pkgs.fetchurl {
url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/cat-watching-the-star_pixelart_purple_animated.gif";
sha256 = "";
}
else "${toString config.stylix.image}";
};
};
in {
services.displayManager = {
sddm = {
package = pkgs.kdePackages.sddm;
extraPackages = [ sddm-astronaut ];
extraPackages = [sddm-astronaut];
enable = true;
wayland.enable = true;
theme = "sddm-astronaut-theme";
settings = {
Wayland.SessionDir = "${
inputs.hyprland.packages."${pkgs.system}".hyprland
}/share/wayland-sessions";
inputs.hyprland.packages."${pkgs.system}".hyprland
}/share/wayland-sessions";
};
};
};
environment.systemPackages = [ sddm-astronaut ];
# To prevent getting stuck at shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
environment.systemPackages = [sddm-astronaut];
}

View File

@@ -1,8 +1,4 @@
{
pkgs,
lib,
...
}: {
{pkgs, ...}: {
boot = {
bootspec.enable = true;
loader = {
@@ -29,14 +25,17 @@
consoleLogLevel = 0;
initrd.verbose = false;
plymouth = {
enable = true;
theme = lib.mkForce "cuts_alt";
themePackages = with pkgs; [
(adi1090x-plymouth-themes.override {
selected_themes = ["cuts_alt"];
})
];
};
# plymouth = {
# enable = true;
# theme = lib.mkForce "cuts_alt";
# themePackages = with pkgs; [
# (adi1090x-plymouth-themes.override {
# selected_themes = ["cuts_alt"];
# })
# ];
# };
};
# To avoid systemd services hanging on shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
}

View File

@@ -1,25 +1,31 @@
# Tailscale is a VPN service that makes it easy to connect your devices between each other.
{ config, ... }: {
security.sudo.extraRules = [{
users = [ config.var.username ];
commands = [
{
command = "/etc/profiles/per-user/${config.var.username}/bin/tailscale";
options = [ "NOPASSWD" ];
}
{
command = "/run/current-system/sw/bin/tailscale";
options = [ "NOPASSWD" ];
}
];
}];
{config, ...}: let
username = config.var.username;
in {
security.sudo.extraRules = [
{
users = [username];
# Allow running Tailscale commands without a password
commands = [
{
command = "/etc/profiles/per-user/${username}/bin/tailscale";
options = ["NOPASSWD"];
}
{
command = "/run/current-system/sw/bin/tailscale";
options = ["NOPASSWD"];
}
];
}
];
services.tailscale = {
enable = true;
openFirewall = true;
};
networking.firewall = {
trustedInterfaces = [ "tailscale0" ];
trustedInterfaces = ["tailscale0"];
# required to connect to Tailscale exit nodes
checkReversePath = "loose";
};

View File

@@ -1,18 +1,17 @@
# TUIGreet is a display manager.
# Legacy, I'm now using SDDM
{ pkgs, ... }: {
{pkgs, ...}: {
services.greetd = {
enable = true;
settings = {
default_session = {
command =
"${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
user = "greeter";
};
};
};
environment.systemPackages = with pkgs; [ greetd.tuigreet ];
environment.systemPackages = with pkgs; [greetd.tuigreet];
# this is a life saver.
# literally no documentation about this anywhere.
@@ -28,8 +27,4 @@
TTYVHangup = true;
TTYVTDisallocate = true;
};
# To prevent getting stuck at shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
}

View File

@@ -1,13 +1,18 @@
{ config, pkgs, ... }:
let username = config.var.username;
{
config,
pkgs,
...
}: let
username = config.var.username;
in {
programs.zsh.enable = true;
users = {
defaultUserShell = pkgs.zsh;
users.${username} = {
isNormalUser = true;
description = "${username} account";
extraGroups = [ "networkmanager" "wheel" ];
extraGroups = ["networkmanager" "wheel"];
};
};
}

View File

@@ -1,5 +1,8 @@
{ pkgs, config, inputs, ... }:
let
{
pkgs,
config,
...
}: let
hostname = config.var.hostname;
keyboardLayout = config.var.keyboardLayout;
configDir = config.var.configDirectory;
@@ -17,11 +20,11 @@ in {
enable = autoUpgrade;
dates = "04:00";
flake = "${configDir}";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
flags = ["--update-input" "nixpkgs" "--commit-lock-file"];
allowReboot = false;
};
time = { timeZone = timeZone; };
time = {timeZone = timeZone;};
i18n.defaultLocale = defaultLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = extraLocale;
@@ -64,7 +67,7 @@ in {
dbus = {
enable = true;
implementation = "broker";
packages = with pkgs; [ gcr gnome-settings-daemon ];
packages = with pkgs; [gcr gnome-settings-daemon];
};
gvfs.enable = true;
upower.enable = true;
@@ -73,7 +76,7 @@ in {
};
# enable zsh autocompletion for system packages (systemd, etc)
environment.pathsToLink = [ "/share/zsh" ];
environment.pathsToLink = ["/share/zsh"];
# Faster rebuilding
documentation = {
@@ -101,11 +104,11 @@ in {
enable = true;
xdgOpenUsePortal = true;
config = {
common.default = [ "gtk" ];
hyprland.default = [ "gtk" "hyprland" ];
common.default = ["gtk"];
hyprland.default = ["gtk" "hyprland"];
};
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
extraPortals = [pkgs.xdg-desktop-portal-gtk];
};
security = {

View File

@@ -1,5 +1,7 @@
{ config, ... }:
let domain = "adguard.hadi.diy";
# Adguard is a network-wide ad blocker
# When installed, open localhost:3000 to setup
{config, ...}: let
domain = "adguard.hadi.diy";
in {
services = {
adguardhome = {
@@ -11,8 +13,7 @@ in {
useACMEHost = "hadi.diy";
forceSSL = true;
locations."/" = {
proxyPass =
"http://127.0.0.1:${toString config.services.adguardhome.port}";
proxyPass = "http://127.0.0.1:${toString config.services.adguardhome.port}";
};
};
};

View File

@@ -1,5 +1,6 @@
{ config, ... }:
let domain = "vault.hadi.diy";
# Bitwarden (or vaultwarden) is a self-hosted password manager.
{config, ...}: let
domain = "vault.hadi.diy";
in {
services = {
vaultwarden = {
@@ -18,8 +19,8 @@ in {
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${
toString config.services.vaultwarden.config.ROCKET_PORT
}";
toString config.services.vaultwarden.config.ROCKET_PORT
}";
};
};
};

View File

@@ -1,3 +1,4 @@
# Firewall configuration for NixOS
{
networking.firewall = {
enable = true;