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

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

View File

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

View File

@@ -1,13 +1,21 @@
{ config, inputs, ... }: {
let autoGarbageCollector = config.var.autoGarbageCollector; config,
inputs,
...
}: let
autoGarbageCollector = config.var.autoGarbageCollector;
in { in {
security.sudo.extraRules = [{ security.sudo.extraRules = [
{
users = [config.var.username]; users = [config.var.username];
commands = [{ commands = [
{
command = "/run/current-system/sw/bin/nixos-rebuild"; command = "/run/current-system/sw/bin/nixos-rebuild";
options = ["NOPASSWD"]; options = ["NOPASSWD"];
}]; }
}]; ];
}
];
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; allowUnfree = true;
allowBroken = true; allowBroken = true;

View File

@@ -1,12 +1,13 @@
{ lib, pkgs, config, ... }: {
pkgs,
let config,
...
}: let
# Using beta driver for recent GPUs like RTX 4070 # Using beta driver for recent GPUs like RTX 4070
nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.beta; nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.beta;
in { in {
# Video drivers configuration for Xorg and Wayland # Video drivers configuration for Xorg and Wayland
services.xserver.videoDrivers = services.xserver.videoDrivers = ["nvidia"]; # Simplified - other modules are loaded automatically
[ "nvidia" ]; # Simplified - other modules are loaded automatically
# Kernel parameters for better Wayland and Hyprland integration # Kernel parameters for better Wayland and Hyprland integration
boot.kernelParams = [ boot.kernelParams = [

View File

@@ -1,8 +1,15 @@
{ config, pkgs, ... }: {
config,
let pkgs,
hp-omen-linux-module = pkgs.callPackage ...
({ kernel ? config.boot.kernelPackages.kernel, stdenv, fetchFromGitHub }: }: let
hp-omen-linux-module =
pkgs.callPackage
({
kernel ? config.boot.kernelPackages.kernel,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hp-omen-linux-module"; pname = "hp-omen-linux-module";
version = "rebase-6.14"; version = "rebase-6.14";
@@ -51,22 +58,4 @@ in {
RUN+="${pkgs.coreutils}/bin/chgrp omen-rgb /sys/devices/platform/hp-wmi/rgb_zones/zone03", \ 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" 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,48 +1,42 @@
# SDDM is a display manager for X11 and Wayland # SDDM is a display manager for X11 and Wayland
{ pkgs, inputs, config, lib, ... }: {
let pkgs,
inputs,
config,
...
}: let
foreground = config.theme.textColorOnWallpaper; foreground = config.theme.textColorOnWallpaper;
sddm-astronaut = pkgs.sddm-astronaut.override { sddm-astronaut = pkgs.sddm-astronaut.override {
embeddedTheme = "pixel_sakura"; embeddedTheme = "pixel_sakura";
# TODO: Cleaner version for static vs .gif, just a string.replace themeConfig = {
themeConfig = if lib.hasSuffix "sakura_static.png" config.stylix.image then HeaderTextColor = "#${foreground}";
{ } DateTextColor = "#${foreground}";
else if lib.hasSuffix "studio.png" config.stylix.image then { TimeTextColor = "#${foreground}";
Background = pkgs.fetchurl { LoginFieldTextColor = "#${foreground}";
url = PasswordFieldTextColor = "#${foreground}";
"https://raw.githubusercontent.com/anotherhadi/nixy-wallpapers/refs/heads/main/wallpapers/studio.gif"; UserIconColor = "#${foreground}";
PasswordIconColor = "#${foreground}";
WarningColor = "#${foreground}";
LoginButtonBackgroundColor = "#${foreground}";
SystemButtonsIconsColor = "#${foreground}";
SessionButtonTextColor = "#${foreground}";
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="; sha256 = "sha256-qySDskjmFYt+ncslpbz0BfXiWm4hmFf5GPWF2NlTVB8=";
}; }
HeaderTextColor = "#${foreground}"; else if "cat-watching-the-star_pixelart_purple_static.png" == config.stylix.image
DateTextColor = "#${foreground}"; then
TimeTextColor = "#${foreground}"; pkgs.fetchurl {
LoginFieldTextColor = "#${foreground}"; url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/cat-watching-the-star_pixelart_purple_animated.gif";
PasswordFieldTextColor = "#${foreground}"; sha256 = "";
UserIconColor = "#${foreground}"; }
PasswordIconColor = "#${foreground}"; else "${toString config.stylix.image}";
WarningColor = "#${foreground}";
LoginButtonBackgroundColor = "#${foreground}";
SystemButtonsIconsColor = "#${foreground}";
SessionButtonTextColor = "#${foreground}";
VirtualKeyboardButtonTextColor = "#${foreground}";
DropdownBackgroundColor = "#${foreground}";
HighlightBackgroundColor = "#${foreground}";
} else {
Background = "${toString config.stylix.image}";
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}";
}; };
}; };
in { in {
@@ -62,7 +56,4 @@ in {
}; };
environment.systemPackages = [sddm-astronaut]; environment.systemPackages = [sddm-astronaut];
# To prevent getting stuck at shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
} }

View File

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

View File

@@ -1,10 +1,14 @@
# Tailscale is a VPN service that makes it easy to connect your devices between each other. # Tailscale is a VPN service that makes it easy to connect your devices between each other.
{ config, ... }: { {config, ...}: let
security.sudo.extraRules = [{ username = config.var.username;
users = [ config.var.username ]; in {
security.sudo.extraRules = [
{
users = [username];
# Allow running Tailscale commands without a password
commands = [ commands = [
{ {
command = "/etc/profiles/per-user/${config.var.username}/bin/tailscale"; command = "/etc/profiles/per-user/${username}/bin/tailscale";
options = ["NOPASSWD"]; options = ["NOPASSWD"];
} }
{ {
@@ -12,7 +16,9 @@
options = ["NOPASSWD"]; options = ["NOPASSWD"];
} }
]; ];
}]; }
];
services.tailscale = { services.tailscale = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;

View File

@@ -5,8 +5,7 @@
enable = true; enable = true;
settings = { settings = {
default_session = { default_session = {
command = command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
"${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
user = "greeter"; user = "greeter";
}; };
}; };
@@ -28,8 +27,4 @@
TTYVHangup = true; TTYVHangup = true;
TTYVTDisallocate = true; TTYVTDisallocate = true;
}; };
# To prevent getting stuck at shutdown
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
} }

View File

@@ -1,9 +1,14 @@
{ config, pkgs, ... }: {
let username = config.var.username; config,
pkgs,
...
}: let
username = config.var.username;
in { in {
programs.zsh.enable = true; programs.zsh.enable = true;
users = { users = {
defaultUserShell = pkgs.zsh; defaultUserShell = pkgs.zsh;
users.${username} = { users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "${username} account"; description = "${username} account";

View File

@@ -1,5 +1,8 @@
{ pkgs, config, inputs, ... }: {
let pkgs,
config,
...
}: let
hostname = config.var.hostname; hostname = config.var.hostname;
keyboardLayout = config.var.keyboardLayout; keyboardLayout = config.var.keyboardLayout;
configDir = config.var.configDirectory; configDir = config.var.configDirectory;

View File

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

View File

@@ -1,5 +1,6 @@
{ config, ... }: # Bitwarden (or vaultwarden) is a self-hosted password manager.
let domain = "vault.hadi.diy"; {config, ...}: let
domain = "vault.hadi.diy";
in { in {
services = { services = {
vaultwarden = { vaultwarden = {

View File

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