diff --git a/configuration.nix b/configuration.nix index 021baaa..59b47c5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,12 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ config, pkgs, flake-self, inputs, ... }: { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix + ./hardware-configuration.nix + ./modules/hyprland/default.nix ]; # Bootloader. @@ -44,32 +45,26 @@ LC_TIME = "en_US.UTF-8"; }; - # Enable the X11 windowing system. services = { xserver = { enable = true; videoDrivers = [ "nvidia" ]; displayManager = { - lightdm.enable = true; + gdm.enable = true; + gdm.wayland = true; }; desktopManager.plasma5.enable = true; - windowManager.i3.enable = true; - windowManager.i3.package = pkgs.i3-gaps; - }; }; - # Configure keymap in X11 services.xserver = { layout = "us"; xkbVariant = ""; }; - # Enable CUPS to print documents. - services.printing.enable = true; + services.printing.enable = true; - # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; @@ -78,72 +73,95 @@ alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; }; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; + programs.fish.enable = true; + users.defaultUserShell = pkgs.fish; + + security.polkit.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.notoh = { isNormalUser = true; description = "notoh"; extraGroups = [ "networkmanager" "wheel" ]; packages = with pkgs; [ firefox - neovim - git - discord + neovim neofetch - rofi bitwarden spotify + discord + waybar + obsidian + btop ]; }; - # Allow unfree packages nixpkgs.config.allowUnfree = true; - # List packages installed in system profile. To search, run: - # $ nix search wget environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. wget - wayland + git alacritty gcc + kitty + stow + starship + rustup + cargo + jre + jdk + nodejs + polkit_gnome + appimage-run ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - system.stateVersion = "23.05"; # Did you read the comment? nix = { package = pkgs.nixFlakes; extraOptions = "experimental-features = nix-command flakes"; + }; + + hardware = { + nvidia = { + powerManagement.enable = true; + modesetting.enable = true; + }; + opengl.extraPackages = with pkgs; [nvidia-vaapi-driver]; + }; + + nix.settings = { + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + }; + + fonts = { + enableDefaultFonts = true; + fontDir.enable = true; + + fonts = with pkgs; [ + inter + jetbrains-mono + nerdfonts + noto-fonts-cjk-sans + recursive + rubik + twemoji-color-font + font-awesome + powerline-fonts + fira-code-symbols + ]; + + fontconfig = { + enable = true; + allowBitmaps = true; + defaultFonts = { + monospace = ["Maple Mono NF"]; + sansSerif = ["Google Sans Text"]; + }; + hinting.style = "hintfull"; + }; }; } diff --git a/flake.nix b/flake.nix index ae0f855..f916dfb 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Your new nix config"; + description = "notohh's flake"; inputs = { # Nixpkgs @@ -17,7 +17,6 @@ home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - # TODO: Add any other flake you might need # hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make @@ -29,29 +28,26 @@ # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - # FIXME replace with your hostname nixos = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; # Pass flake inputs to our config + specialArgs = { inherit inputs; flake-self = self; }; # Pass flake inputs to our config # > Our main nixos configuration file < - modules = [ ./configuration.nix + modules = [ ./configuration.nix hyprland.nixosModules.default { programs.hyprland.enable = true; } - ]; + ]; }; - }; + }; # Standalone home-manager configuration entrypoint # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { - # FIXME replace with your username@hostname "notoh@nixos" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config # > Our main home-manager configuration file < - modules = [ - ./home-manager/home.nix ]; + modules = [./home-manager/home.nix ]; }; }; }; diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index e69de29..8bc067b 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -0,0 +1,93 @@ +{ config, pkgs, lib, ... }: + +let + dbus-hyprland-environment = pkgs.writeTextFile { + name = "dbus-hyprland-environment"; + destination = "/bin/dbus-hyprland-environment"; + executable = true; + + text = '' + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=hyprland + systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; + + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gesettings/schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + gesettings set $gnome_schema gtk-theme 'Adwaita' + ''; + }; + + flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; + hyprland = (import flake-compat { + src = builtins.fetchTarball "https://github.com/vaxerski/Hyprland/archive/master.tar.gz"; + }).defaultNix; + +in +{ + environment.systemPackages = with pkgs; [ + dbus-hyprland-environment + configure-gtk + wayland + glib + gnome3.adwaita-icon-theme + grim + wl-clipboard + bemenu + wlr-randr + wofi + ]; + + services.dbus.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + gtkUsePortal = true; + }; + + programs.hyprland.enable = true; + programs.xwayland.enable = true; + + environment.sessionVariables = rec { + GBM_BACKEND = "nvidia-drm"; + __GL_GSYNC_ALLOWED = "0"; + __GL_VRR_ALLOWED = "0"; + WLR_DRM_NO_ATOMIC = "1"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + + # Will break SDDM if running X11 + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + + GDK_BACKEND = "wayland"; + WLR_NO_HARDWARE_CURSORS = "1"; + MOZ_ENABLE_WAYLAND = "1"; + }; + + services.greetd = { + enable = true; + settings = rec { + initial_session = { + command = "Hyprland"; + user = "notoh"; + }; + default_session = initial_session; + }; + }; + + environment.etc."greetd/environments".text = '' + Hyprland + ''; + + +} diff --git a/modules/wayland/wayland.nix b/modules/wayland/wayland.nix new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/modules/wayland/wayland.nix @@ -0,0 +1 @@ +