diff --git a/README.md b/README.md index 2826c076..0e127e3d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,16 @@ Repo for nix configuration files --- # Information +### Home Manager * Home Manager Documentation - [Link](https://nix-community.github.io/home-manager/index.html) * Home Manager Options Search - [Link](https://mipmip.github.io/home-manager-option-search/) + +### NixOS * NixOS Documentation - Stable - [Link](https://nixos.org/manual/nixos/stable/) * NixOS Packages / Options Search - [Link](https://search.nixos.org/) * Nix User Repository (NUR) Search - [Link](https://nur.nix-community.org/) + +### Examples / Useful Links * Tons of good examples here - [Link](https://github.com/Mic92/dotfiles/blob/main/nixos/modules/) * Track a Nixpkgs PR - [Link](https://nixpk.gs/pr-tracker.html) * NixOS Flakes Intro Guide - [Link](https://nixos-and-flakes.thiscute.world/) @@ -14,14 +19,18 @@ Repo for nix configuration files --- # Theming * To change system-wide themes, you need to change the following: +### gnome 1. `desktops/gnome.nix` - Change the imports at the bottom. 2. `users/albert/gnome-dconf.nix` - Change the theme variants in the following: * `org/gnome/shell/extensions/nightthemeswitcher/gtk-variants` * `org/gnome/shell/extensions/nightthemeswitcher/icon-variants` * `org/gnome/shell/extensions/nightthemeswitcher/shell-variants` - 3. `common/dotfiles/neovim.nix` - Change the following: +### neovim + 1. `common/dotfiles/neovim.nix` - Change the following: * `plugins = with pkgs.vimPlugins` - Add your theme under "Themes" * `extraConfig` - Change the `colorscheme` section +### hyprland / waybar + 1. Work in progress... # GPG Keys 1. Import your GPG key `albert.key` diff --git a/configuration.nix b/configuration.nix index ed197880..c15c9aae 100644 --- a/configuration.nix +++ b/configuration.nix @@ -51,10 +51,6 @@ # Bash powerline powerline-go - - # General packages - # https://github.com/gvolpe/dconf2nix - dconf2nix wget killall neovim @@ -83,5 +79,6 @@ # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? + # system.stateVersion = "23.05"; # Did you read the comment? + system.stateVersion = "unstable" } diff --git a/desktops/common.nix b/desktops/common.nix index 2f0d6c00..ab4ce115 100644 --- a/desktops/common.nix +++ b/desktops/common.nix @@ -14,23 +14,4 @@ # Software configurations ../software/firefox.nix ]; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - # Configure keymap in X11 - services.xserver = { - enable = true; - layout = "us"; - xkbVariant = ""; - autorun = true; - }; } \ No newline at end of file diff --git a/desktops/gnome-unstable.nix b/desktops/gnome.nix similarity index 84% rename from desktops/gnome-unstable.nix rename to desktops/gnome.nix index 8479115a..deae7537 100644 --- a/desktops/gnome-unstable.nix +++ b/desktops/gnome.nix @@ -1,6 +1,25 @@ -{ config, unstable, hostname, ... }: { - # Use "unstable" instead of "pkgs" to get the latest packages, defined in "flake.nix" - services.xserver = with unstable.pkgs; { +{ config, pkgs, hostname, ... }: { + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + autorun = true; + videoDrivers = [ "nvidia" ]; + }; + + services.xserver = with pkgs; { # https://nixos.org/manual/nixos/stable/index.html#chap-gnome # Enable the GNOME Desktop Environment. desktopManager.gnome.enable = true; @@ -65,7 +84,7 @@ # https://nixos.wiki/wiki/GNOME # Remove unwanted packages - environment.gnome.excludePackages = (with unstable.pkgs; [ + environment.gnome.excludePackages = (with pkgs; [ gnome.cheese gnome.gnome-music gnome.epiphany @@ -83,7 +102,7 @@ gnome.simple-scan ]); - environment.systemPackages = with unstable.pkgs; [ + environment.systemPackages = with pkgs; [ # Gnome Extensions gnomeExtensions.tiling-assistant gnomeExtensions.dash-to-dock @@ -98,6 +117,10 @@ # Gnome relevant packages gnome3.gnome-tweaks papirus-icon-theme + + # General packages + # https://github.com/gvolpe/dconf2nix + dconf2nix ]; imports = [ diff --git a/desktops/hyprland.nix b/desktops/hyprland.nix index 4c8a5f17..5d52a965 100644 --- a/desktops/hyprland.nix +++ b/desktops/hyprland.nix @@ -1,4 +1,87 @@ {pkgs, ...}: { - # https://wiki.hyprland.org/ - programs.hyprland.enable = true; + # Enabling hyprlnd on NixOS + programs.hyprland = { + enable = true; + nvidiaPatches = true; + xwayland.enable = true; + }; + + environment.sessionVariables = { + # If your cursor becomes invisible + WLR_NO_HARDWARE_CURSORS = "1"; + # Hint electron apps to use wayland + NIXOS_OZONE_WL = "1"; + }; + + hardware = { + # Opengl + opengl.enable = true; + # Most wayland compositors need this + nvidia.modesetting.enable = true; + }; + + # waybar + (pkgs.waybar.overrideAttrs (oldAttrs: { + mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; + }) + ) + + # system packages + environment.systemPackages = with pkgs [ + waybar + # Notofication daemon + libnotify + mako + # for x11 + # dunst + + # Wallpaper daemons + # hyprpaper + # swaybg + # wpaperd + # mpvpaper + swww + + # Terminal + # hyprlands default terminal + kitty + # alacritty + # wezterm + + # App launchers + rofi-wayland + # gtk version: + # wofi + + # suggestions + # bemenu + # fuzzel + # tofi + + # Other apps: + networkmanagerapplet + + # Screenshot utility: + grim + slupr + wl-copyd + + # fonts + font-awesome + ]; + + # XDG portal + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + + # Enable sound with pipewire. + sound.enable = true; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; } \ No newline at end of file diff --git a/desktops/kde.nix b/desktops/kde.nix index 78010273..985690b3 100644 --- a/desktops/kde.nix +++ b/desktops/kde.nix @@ -1,4 +1,25 @@ { config, pkgs, ... }: { + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + autorun = true; + videoDrivers = [ "nvidia" ]; + }; + services.xserver = { displayManager.gdm.enable = true; desktopManager.plasma5.enable = true; diff --git a/desktops/sway.nix b/desktops/sway.nix index 7ea8b456..b02331b7 100644 --- a/desktops/sway.nix +++ b/desktops/sway.nix @@ -1,4 +1,23 @@ -{ config, pkgs, unstable, ... }: { +{ config, pkgs, ... }: { + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + autorun = true; + }; + programs.sway = { enable = true; }; diff --git a/flake.nix b/flake.nix index e5d6a890..e4c2b338 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,9 @@ inputs = { # NixOS packages - stable-nixpkgs.url = "nixpkgs/nixos-23.05"; + # stable-nixpkgs.url = "nixpkgs/nixos-23.05"; unstable-nixpkgs.url = "nixpkgs/nixos-unstable"; - master-nixpkgs.url = "nixpkgs/master"; + # master-nixpkgs.url = "nixpkgs/master"; # Manage dotfiles in a home directory home-manager.url = "github:nix-community/home-manager/release-23.05"; @@ -28,26 +28,36 @@ sops-nix.url = "github:Mic92/sops-nix"; }; - outputs = { stable-nixpkgs, unstable-nixpkgs, master-nixpkgs, home-manager, lanzaboote, nur, sops-nix, /*nixos-hardware,*/ ... }@inputs: + outputs = { + # stable-nixpkgs, + unstable-nixpkgs, + # master-nixpkgs, + home-manager, + lanzaboote, + nur, + sops-nix, + # nixos-hardware, + ... + }@inputs: let # Variables - Remember to set these hostname = "nixos-laptop"; system = "x86_64-linux"; - pkgs = import stable-nixpkgs { + pkgs = import unstable-nixpkgs { inherit system; config = { allowUnfree = true; }; }; - unstable = import unstable-nixpkgs { - inherit system; - config = { allowUnfree = true; }; - }; - - master = import master-nixpkgs { - inherit system; - config = { allowUnfree = true; }; - } + # unstable = import unstable-nixpkgs { + # inherit system; + # config = { allowUnfree = true; }; + # }; + # + # master = import master-nixpkgs { + # inherit system; + # config = { allowUnfree = true; }; + # } lib = stable-nixpkgs.lib; in { @@ -57,8 +67,8 @@ ${hostname} = lib.nixosSystem { inherit system; specialArgs = { - inherit unstable; - inherit master; + # inherit unstable; + # inherit master; inherit hostname; }; modules = [ diff --git a/hosts/nixos-laptop/configuration.nix b/hosts/nixos-laptop/configuration.nix index baa88821..78d74065 100644 --- a/hosts/nixos-laptop/configuration.nix +++ b/hosts/nixos-laptop/configuration.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, unstable, ... }: { +{ lib, config, pkgs, ... }: { # Set your time zone. time.timeZone = "Asia/Tokyo"; @@ -32,12 +32,12 @@ opengl.driSupport = true; # opengl.extraPackages = with pkgs; [ nvidia-vaapi-driver ]; # https://nixpk.gs/pr-tracker.html?pr=244060 - nvidia = with unstable.pkgs { + nvidia = with pkgs { open = false; package = config.boot.kernelPackages.nvidiaPackages.stable; # powerManagement.finegrained = true; - powerManagement.enable = false; - # modesetting.enable = true; + powerManagement.enable = true; + modesetting.enable = true; prime = { offload = { enable = true; @@ -49,8 +49,6 @@ }; }; - services.xserver.videoDrivers = [ "nvidia" ]; - # environment.variables = { # GBM_BACKEND = "nvidia-drm"; # LIBVA_DRIVER_NAME = "nvidia"; diff --git a/hosts/nixos-laptop/gnome-dconf.nix b/hosts/nixos-laptop/desktops/gnome-dconf.nix similarity index 100% rename from hosts/nixos-laptop/gnome-dconf.nix rename to hosts/nixos-laptop/desktops/gnome-dconf.nix diff --git a/hosts/nixos-laptop/desktops/hyperland-conf.nix b/hosts/nixos-laptop/desktops/hyperland-conf.nix new file mode 100644 index 00000000..86d4f35b --- /dev/null +++ b/hosts/nixos-laptop/desktops/hyperland-conf.nix @@ -0,0 +1,216 @@ +{ ... }: { + + wayland.windowManager.hyprland = { + enable = true; + enableNvidiaPatches = true; + systemdIntegration = true; + xwayland.enable = true; + xwayland.hidpi = true; + + wayland.windowManager.hyprland.extraConfig = " + # This is an example Hyprland config file. + # + # Refer to the wiki for more information. + + # + # Please note not all available settings / options are set here. + # For a full list, see the wiki + # + + # See https://wiki.hyprland.org/Configuring/Monitors/ + # monitor=,preferred,auto,auto + + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + + # Execute your favorite apps at launch + # exec-once = waybar & hyprpaper & firefox + + # Source a file (multi-file configs) + # source = ~/.config/hypr/myColors.conf + + # Some default env vars. + env = XCURSOR_SIZE,24 + + # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ + input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = true + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + } + + general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle + } + + decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 10 + + blur { + enabled = true + size = 3 + passes = 1 + } + + drop_shadow = true + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) + } + + animations { + enabled = true + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default + } + + dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # you probably want this + } + + master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true + } + + gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = false + } + + # Example per-device config + # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more + device:epic-mouse-v1 { + sensitivity = -0.5 + } + + # Example windowrule v1 + # windowrule = float, ^(kitty)$ + # Example windowrule v2 + # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + $mainMod = SUPER + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = $mainMod, Q, exec, kitty + bind = $mainMod, C, killactive, + bind = $mainMod, M, exit, + bind = $mainMod, E, exec, dolphin + bind = $mainMod, V, togglefloating, + bind = $mainMod, R, exec, wofi --show drun + bind = $mainMod, P, pseudo, # dwindle + bind = $mainMod, J, togglesplit, # dwindle + bind = $mainMod, S, exec, rofi -show drun -show-icons + + # Move focus with mainMod + arrow keys + bind = $mainMod, left, movefocus, l + bind = $mainMod, right, movefocus, r + bind = $mainMod, up, movefocus, u + bind = $mainMod, down, movefocus, d + + # Switch workspaces with mainMod + [0-9] + bind = $mainMod, 1, workspace, 1 + bind = $mainMod, 2, workspace, 2 + bind = $mainMod, 3, workspace, 3 + bind = $mainMod, 4, workspace, 4 + bind = $mainMod, 5, workspace, 5 + bind = $mainMod, 6, workspace, 6 + bind = $mainMod, 7, workspace, 7 + bind = $mainMod, 8, workspace, 8 + bind = $mainMod, 9, workspace, 9 + bind = $mainMod, 0, workspace, 10 + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + bind = $mainMod SHIFT, 1, movetoworkspace, 1 + bind = $mainMod SHIFT, 2, movetoworkspace, 2 + bind = $mainMod SHIFT, 3, movetoworkspace, 3 + bind = $mainMod SHIFT, 4, movetoworkspace, 4 + bind = $mainMod SHIFT, 5, movetoworkspace, 5 + bind = $mainMod SHIFT, 6, movetoworkspace, 6 + bind = $mainMod SHIFT, 7, movetoworkspace, 7 + bind = $mainMod SHIFT, 8, movetoworkspace, 8 + bind = $mainMod SHIFT, 9, movetoworkspace, 9 + bind = $mainMod SHIFT, 0, movetoworkspace, 10 + + # Scroll through existing workspaces with mainMod + scroll + bind = $mainMod, mouse_down, workspace, e+1 + bind = $mainMod, mouse_up, workspace, e-1 + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + + # Start the config: + exec-once=bash ~/.config/hypr/start.sh + + "; + } + + home.file = { + # Set the custom launcher script + "~/.config/hypr/start.sh" = { + enable = true; + executable = true; + text = " + #!/usr/bin/env bash + # Init the wallpaper daemon and set the wallpaper: + sww init & + #TODO: Set this + sww img /etc/nixos/git/desktops/wallpapers/gruvbox/wallpaper1.png & + # Add the network manager applet: + nm-applet --indicator & + # The bar + waybar & + # Notifications + mako + "; + }; + # https://yewtu.be/watch?v=tWQB1NDDA9c + # Waybar configuration + "~/.config/waybar/config.jsonc" = { + enable = true; + executable = false; + text = ""; + } + # Waybar theming + "~/.config/waybar/style.css" = { + enable = true; + executable = false; + text = ""; + }; + } +} \ No newline at end of file diff --git a/modules/fonts.nix b/modules/fonts.nix index 83522c59..b91172fa 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -16,6 +16,7 @@ (nerdfonts.override { fonts = [ "Arimo" "JetBrainsMono" ]; }) noto-fonts-emoji sarasa-gothic + font-awesome ]; }; } \ No newline at end of file diff --git a/users/albert/home.nix b/users/albert/home.nix index a2372d69..3ffca6f6 100644 --- a/users/albert/home.nix +++ b/users/albert/home.nix @@ -1,7 +1,8 @@ { config, pkgs, hostname, ... }: { home.stateVersion = "23.05"; imports = [ - ../../hosts/${hostname}/gnome-dconf.nix + # ../../hosts/${hostname}/desktops/gnome-dconf.nix + ../../hosts/${hostname}/desktops/hyprland-conf.nix ../../home-manager/git.nix ../../home-manager/neovim.nix ../../home-manager/bash.nix