make hyprland work

This commit is contained in:
notohh 2022-12-06 18:13:43 -05:00
parent 4e0e153a0b
commit 9e851bec59
4 changed files with 167 additions and 59 deletions

View file

@ -2,12 +2,13 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { config, pkgs, flake-self, inputs, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./modules/hyprland/default.nix
]; ];
# Bootloader. # Bootloader.
@ -44,32 +45,26 @@
LC_TIME = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8";
}; };
# Enable the X11 windowing system.
services = { services = {
xserver = { xserver = {
enable = true; enable = true;
videoDrivers = [ "nvidia" ]; videoDrivers = [ "nvidia" ];
displayManager = { displayManager = {
lightdm.enable = true; gdm.enable = true;
gdm.wayland = true;
}; };
desktopManager.plasma5.enable = true; desktopManager.plasma5.enable = true;
windowManager.i3.enable = true;
windowManager.i3.package = pkgs.i3-gaps;
}; };
}; };
# Configure keymap in X11
services.xserver = { services.xserver = {
layout = "us"; layout = "us";
xkbVariant = ""; xkbVariant = "";
}; };
# Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
security.rtkit.enable = true; security.rtkit.enable = true;
@ -78,18 +73,13 @@
alsa.enable = true; alsa.enable = true;
alsa.support32Bit = true; alsa.support32Bit = true;
pulse.enable = 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). programs.fish.enable = true;
# services.xserver.libinput.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 = { users.users.notoh = {
isNormalUser = true; isNormalUser = true;
description = "notoh"; description = "notoh";
@ -97,48 +87,35 @@
packages = with pkgs; [ packages = with pkgs; [
firefox firefox
neovim neovim
git
discord
neofetch neofetch
rofi
bitwarden bitwarden
spotify spotify
discord
waybar
obsidian
btop
]; ];
}; };
# Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ 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 wget
wayland git
alacritty alacritty
gcc 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? system.stateVersion = "23.05"; # Did you read the comment?
nix = { nix = {
@ -146,5 +123,46 @@
extraOptions = "experimental-features = nix-command flakes"; 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";
};
};
} }

View file

@ -1,5 +1,5 @@
{ {
description = "Your new nix config"; description = "notohh's flake";
inputs = { inputs = {
# Nixpkgs # Nixpkgs
@ -17,7 +17,6 @@
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO: Add any other flake you might need
# hardware.url = "github:nixos/nixos-hardware"; # hardware.url = "github:nixos/nixos-hardware";
# Shameless plug: looking for a way to nixify your themes and make # Shameless plug: looking for a way to nixify your themes and make
@ -29,9 +28,8 @@
# NixOS configuration entrypoint # NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname' # Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
# FIXME replace with your hostname
nixos = nixpkgs.lib.nixosSystem { 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 < # > Our main nixos configuration file <
modules = [ ./configuration.nix modules = [ ./configuration.nix
@ -45,13 +43,11 @@
# Standalone home-manager configuration entrypoint # Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname' # Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
# FIXME replace with your username@hostname
"notoh@nixos" = home-manager.lib.homeManagerConfiguration { "notoh@nixos" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config
# > Our main home-manager configuration file < # > Our main home-manager configuration file <
modules = [ modules = [./home-manager/home.nix ];
./home-manager/home.nix ];
}; };
}; };
}; };

View file

@ -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
'';
}

View file

@ -0,0 +1 @@