From 6ec023f040ef7449caf483e8f3b2ac87fb896523 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Thu, 22 Jan 2026 12:07:08 -0700 Subject: [PATCH] ?? --- Makefile | 7 ++-- configuration.nix | 3 +- flake.nix | 44 ++++++++++++++++++++ modules/hyprland.nix | 95 ++++++++++++++++++++++++++++++++++++++++++++ modules/packages.nix | 6 --- modules/stylix.nix | 60 ++++++++++++++++++++++++++++ 6 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 flake.nix create mode 100644 modules/hyprland.nix create mode 100644 modules/stylix.nix diff --git a/Makefile b/Makefile index a365d11..c1c598c 100644 --- a/Makefile +++ b/Makefile @@ -47,17 +47,18 @@ unlink: fi rebuild: - sudo nixos-rebuild switch + sudo nixos-rebuild switch --flake . update: - sudo nixos-rebuild switch --upgrade + nix flake update + sudo nixos-rebuild switch --flake . purge: sudo nix-collect-garbage -d sudo /run/current-system/bin/switch-to-configuration boot check: - nix-instantiate '' -A system --dry-run + nixos-rebuild build --flake . --dry-run edit: @$${EDITOR:-nano} $(SETTINGS) diff --git a/configuration.nix b/configuration.nix index 9d97f5e..549f7cd 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,7 +8,8 @@ ./modules/boot.nix ./modules/networking.nix ./modules/locale.nix - ./modules/desktop.nix + ./modules/hyprland.nix + ./modules/stylix.nix ./modules/audio.nix ./modules/users.nix ./modules/packages.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5f22ea2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "NixOS Configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprland.url = "github:hyprwm/Hyprland"; + + stylix.url = "github:danth/stylix"; + }; + + outputs = { self, nixpkgs, home-manager, hyprland, stylix, ... }@inputs: + let + settings = import ./settings.nix; + system = "x86_64-linux"; + lib = nixpkgs.lib; + in + { + nixosConfigurations = { + "${settings.hostname}" = lib.nixosSystem { + inherit system; + specialArgs = { inherit inputs; }; + modules = [ + ./configuration.nix + stylix.nixosModules.stylix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users."${settings.username}" = { + home.stateVersion = "24.05"; + }; + home-manager.extraSpecialArgs = { inherit inputs; }; + } + ]; + }; + }; + }; +} diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..2993306 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,95 @@ +{ config, pkgs, inputs, ... }: + +{ + programs.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; + }; + + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + enableHidpi = true; + }; + + # Environment variables for Wayland + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + + # QT Variables + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + + # Toolkit Backends + GDK_BACKEND = "wayland,x11,*"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + + # XDG Specifications + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + XDG_SESSION_DESKTOP = "Hyprland"; + }; + + environment.systemPackages = with pkgs; [ + # Core + waybar # Status bar + rofi-wayland # App launcher + swaynotificationcenter # Notifications + libnotify # Notification library + + # Theming & Wallpaper + swww # Wallpaper daemon + hyprcursor # Cursor theme manager + + # Utilities + wl-clipboard # Clipboard manager + cliphist # Clipboard history + grim # Screenshot tool + slurp # Region selector + swappy # Screenshot editor + hyprpicker # Color picker + + # System Management + hypridle # Idle daemon + hyprlock # Screen locker + wlogout # Logout menu + + # Audio + pamixer + playerctl + + # File Management + # (Dolphin or Nautilus usually handled by user preference, keeping system clean) + + # Polkit Agent + polkit_gnome + ]; + + # Security / Polkit + security.polkit.enable = true; + + systemd.user.services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + + # Portals + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + ]; + }; +} diff --git a/modules/packages.nix b/modules/packages.nix index 55c7cea..77fcae1 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -52,12 +52,6 @@ in impression streamcontroller onlyoffice-desktopeditors - - # Gnome Extensions - gnomeExtensions.blur-my-shell - gnomeExtensions.just-perfection - gnomeExtensions.arc-menu - gnomeExtensions.appindicator ]; # Programs with extra configuration diff --git a/modules/stylix.nix b/modules/stylix.nix new file mode 100644 index 0000000..a66bc3e --- /dev/null +++ b/modules/stylix.nix @@ -0,0 +1,60 @@ +{ config, pkgs, inputs, ... }: + +{ + stylix = { + enable = true; + + # Set the wallpaper + image = ../assets/wallpapers/japantrain.png; + + # Set the color scheme (dark mode) + polarity = "dark"; + + # Optionally force a specific scheme instead of generating from image + # base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + + cursor = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + size = 24; + }; + + fonts = { + monospace = { + package = pkgs.nerd-fonts.jetbrains-mono; + name = "JetBrainsMono Nerd Font Mono"; + }; + sansSerif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans"; + }; + serif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Serif"; + }; + + sizes = { + applications = 12; + terminal = 15; + desktop = 10; + popups = 10; + }; + }; + + # Opacity for various applications + opacity = { + applications = 1.0; + terminal = 0.95; + desktop = 1.0; + popups = 1.0; + }; + + # Configure which targets Stylix should manage + targets = { + console.enable = true; + gnome.enable = true; + gtk.enable = true; + nixos-icons.enable = true; + }; + }; +}