From 1f9e5e17afe1c36d5a6969251907f548d586d904 Mon Sep 17 00:00:00 2001 From: zackartz Date: Thu, 29 Feb 2024 22:20:26 -0500 Subject: [PATCH] initial commit --- env/wayland/default.nix | 71 ++++ env/wayland/fonts.nix | 42 +++ flake.lock | 435 +++++++++++++++++++++++++ flake.nix | 49 +++ hosts/earth/configuration.nix | 174 ++++++++++ hosts/earth/hardware-configuration.nix | 45 +++ hosts/earth/nvidia.nix | 16 + modules/home-manager/default.nix | 109 +++++++ modules/home-manager/vim.nix | 83 +++++ modules/rice/dunst.nix | 68 ++++ modules/rice/gtk.nix | 87 +++++ modules/rice/hyprland/binds.nix | 63 ++++ modules/rice/hyprland/config.nix | 56 ++++ modules/rice/hyprland/default.nix | 19 ++ modules/rice/hyprland/rules.nix | 43 +++ modules/shell/default.nix | 3 + modules/shell/zsh/aliases.nix | 43 +++ modules/shell/zsh/default.nix | 45 +++ modules/shell/zsh/tools.nix | 64 ++++ 19 files changed, 1515 insertions(+) create mode 100644 env/wayland/default.nix create mode 100644 env/wayland/fonts.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/earth/configuration.nix create mode 100644 hosts/earth/hardware-configuration.nix create mode 100644 hosts/earth/nvidia.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/vim.nix create mode 100644 modules/rice/dunst.nix create mode 100644 modules/rice/gtk.nix create mode 100644 modules/rice/hyprland/binds.nix create mode 100644 modules/rice/hyprland/config.nix create mode 100644 modules/rice/hyprland/default.nix create mode 100644 modules/rice/hyprland/rules.nix create mode 100644 modules/shell/default.nix create mode 100644 modules/shell/zsh/aliases.nix create mode 100644 modules/shell/zsh/default.nix create mode 100644 modules/shell/zsh/tools.nix diff --git a/env/wayland/default.nix b/env/wayland/default.nix new file mode 100644 index 0000000..b5411fa --- /dev/null +++ b/env/wayland/default.nix @@ -0,0 +1,71 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [./fonts.nix]; + + environment.etc."greetd/environments".text = '' + Hyprland + ''; + + services = { + greetd = { + enable = true; + settings = rec { + initial_session = { + command = "Hyprland"; + user = "zack"; + }; + default_session = initial_session; + }; + }; + }; + + environment = { + variables = { + NIXOS_OZONE_WL = "1"; + __GL_GSYNC_ALLOWED = "0"; + __GL_VRR_ALLOWED = "0"; + _JAVA_AWT_WM_NONEREPARENTING = "1"; + SSH_AUTH_SOCK = "/run/user/1000/keyring/ssh"; + DISABLE_QT5_COMPAT = "0"; + GDK_BACKEND = "wayland,x11"; + ANKI_WAYLAND = "1"; + DIRENV_LOG_FORMAT = ""; + WLR_DRM_NO_ATOMIC = "1"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + QT_QPA_PLATFORM = "wayland;xcb"; + DISABLE_QT_COMPAT = "0"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + MOZ_ENABLE_WAYLAND = "1"; + WLR_BACKEND = "vulkan"; + WLR_RENDERER = "vulkan"; + XDG_SESSION_TYPE = "wayland"; + SDL_VIDEODRIVER = "wayland"; + XDG_CACHE_HOME = "/home/zack/.cache"; + CLUTTER_BACKEND = "wayland"; + }; + loginShellInit = '' + dbus-update-activation-environment --systemd DISPLAY + eval $(gnome-keyring-daemon --start --components=ssh,secrets) + eval $(ssh-agent) + ''; + }; + + hardware.pulseaudio.support32Bit = true; + + xdg.portal = { + enable = true; + config.common.default = "*"; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-hyprland + ]; + }; + + sound = { + enable = true; + mediaKeys.enable = true; + }; +} diff --git a/env/wayland/fonts.nix b/env/wayland/fonts.nix new file mode 100644 index 0000000..9bfb793 --- /dev/null +++ b/env/wayland/fonts.nix @@ -0,0 +1,42 @@ +{pkgs, ...}: { + fonts = { + packages = with pkgs; [ + material-icons + material-design-icons + roboto + work-sans + comic-neue + source-sans + twemoji-color-font + comfortaa + inter + lato + lexend + jost + dejavu_fonts + iosevka-bin + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + jetbrains-mono + (nerdfonts.override {fonts = ["Iosevka" "JetBrainsMono"];}) + ]; + + enableDefaultPackages = false; + + # this fixes emoji stuff + fontconfig = { + defaultFonts = { + monospace = [ + "Iosevka Term" + "Iosevka Term Nerd Font Complete Mono" + "Iosevka Nerd Font" + "Noto Color Emoji" + ]; + sansSerif = ["Lexend" "Noto Color Emoji"]; + serif = ["Noto Serif" "Noto Color Emoji"]; + emoji = ["Noto Color Emoji"]; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fc0ec62 --- /dev/null +++ b/flake.lock @@ -0,0 +1,435 @@ +{ + "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709204054, + "narHash": "sha256-U1idK0JHs1XOfSI1APYuXi4AEADf+B+ZU4Wifc0pBHk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f3367769a93b226c467551315e9e270c3f78b15", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708988456, + "narHash": "sha256-RCz7Xe64tN2zgWk+MVHkzg224znwqknJ1RnB7rVqUWw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1d085ea4444d26aa52297758b333b449b2aa6fca", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprcontrib": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706198673, + "narHash": "sha256-bHlxFd+3QHy6eXtTzzhwVNcyxBSOxTvBuJGNUzI4C4M=", + "owner": "hyprwm", + "repo": "contrib", + "rev": "16884001b26e6955ff4b88b4dfe4c8986e20f153", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "contrib", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1709243510, + "narHash": "sha256-e47KWaUGQc+JLUABYdG0eCeqY1fFf1xGvakpKcdOP9c=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "f590505daf90dfb4059289a906863b59663e70a6", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-plugins": { + "inputs": { + "hyprland": [ + "hyprland" + ] + }, + "locked": { + "lastModified": 1708270226, + "narHash": "sha256-PCsEiFKBDZ1VKw8rlo8D/J+22gic7ls5zDWcU3AAxGQ=", + "owner": "hyprwm", + "repo": "hyprland-plugins", + "rev": "f99822818ec8276cfd6ec99ab60c4708c9884e3d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-plugins", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1708787654, + "narHash": "sha256-7ACgM3ZuAhPqurXHUvR2nWMRcnmzGGPjLK6q4DSTelI=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "0fce791ba2334aca183f2ed42399518947550d0d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709001452, + "narHash": "sha256-FnZ54wkil54hKvr1irdKic1TE27lHQI9dKQmOJRrtlU=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "6c06334f0843c7300d1678726bb607ce526f6b36", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709150264, + "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1709155917, + "narHash": "sha256-S4yHqDKFmJpFQExP7bkOSw+RQaSr8pdOrfSFCOv3G70=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "be87309e0c1da19d99d969625300aaed36ff1b91", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "hyprcontrib": "hyprcontrib", + "hyprland": "hyprland", + "hyprland-plugins": "hyprland-plugins", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1708558866, + "narHash": "sha256-Mz6hCtommq7RQfcPnxLINigO4RYSNt23HeJHC6mVmWI=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1708696469, + "narHash": "sha256-shh5wmpeYy3MmsBfkm4f76yPsBDGk6OLYRVG+ARy2F0=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "1b713911c2f12b96c2574474686e4027ac4bf826", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..320f9a0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprland = { + url = "github:hyprwm/Hyprland/"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprland-plugins = { + url = "github:hyprwm/hyprland-plugins"; + inputs.hyprland.follows = "hyprland"; + }; + + hyprcontrib = { + url = "github:hyprwm/contrib"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + nixosConfigurations.earth = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/earth/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; +} diff --git a/hosts/earth/configuration.nix b/hosts/earth/configuration.nix new file mode 100644 index 0000000..670ca6e --- /dev/null +++ b/hosts/earth/configuration.nix @@ -0,0 +1,174 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ + config, + pkgs, + inputs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ./nvidia.nix + ../../env/wayland + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "earth"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # 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; + # 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 OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc. + + nix.settings.experimental-features = ["nix-command" "flakes"]; + + hardware.nvidia = { + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.zack = { + isNormalUser = true; + description = "zack"; + extraGroups = ["networkmanager" "wheel"]; + packages = with pkgs; [ + firefox + kate + kitty + # thunderbird + ]; + }; + + home-manager = { + extraSpecialArgs = {inherit inputs;}; + users = { + "zack" = import ../../modules/home-manager; + }; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # 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; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # 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.11"; # Did you read the comment? +} diff --git a/hosts/earth/hardware-configuration.nix b/hosts/earth/hardware-configuration.nix new file mode 100644 index 0000000..304a7f7 --- /dev/null +++ b/hosts/earth/hardware-configuration.nix @@ -0,0 +1,45 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/186288c4-cad3-4469-81b5-18abec52fa34"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/AFAB-A6F2"; + fsType = "vfat"; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/a2b1acdb-b17b-4d17-b671-73d1696fe79a";} + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/earth/nvidia.nix b/hosts/earth/nvidia.nix new file mode 100644 index 0000000..c764792 --- /dev/null +++ b/hosts/earth/nvidia.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: { + services.xserver.videoDrivers = ["nvidia"]; + + environment.variables = { + GBM_BACKEND = "nvidia-drm"; + WLR_NO_HARDWARE_CURSORS = "1"; + LIBVA_DRIVER_NAME = "nvidia"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + }; + + environment.systemPackages = with pkgs; [ + vulkan-loader + vulkan-validation-layers + vulkan-tools + ]; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..691cc96 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,109 @@ +{ + config, + pkgs, + inputs, + ... +}: { + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "zack"; + home.homeDirectory = "/home/zack"; + + imports = [ + inputs.nixvim.homeManagerModules.nixvim + ../rice/hyprland + ../rice/gtk.nix + ]; + + nixpkgs = { + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + }; + }; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing it. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + pkgs.discord + pkgs.slack + (pkgs.nerdfonts.override {fonts = ["Iosevka"];}) + pkgs.rustup + pkgs.git + pkgs.lazygit + pkgs.spotify + pkgs.neovide + pkgs.wofi + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/zack/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "nvim"; + }; + + programs.kitty = { + enable = true; + font = {name = "Iosevka Nerd Font Mono";}; + theme = "Ayu Mirage"; + }; + + programs.nixvim = ./vim.nix; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/modules/home-manager/vim.nix b/modules/home-manager/vim.nix new file mode 100644 index 0000000..67beef3 --- /dev/null +++ b/modules/home-manager/vim.nix @@ -0,0 +1,83 @@ +{ + config = { + enable = true; + + plugins = { + lualine.enable = true; + telescope.enable = true; + treesitter.enable = true; + luasnip.enable = true; + rustaceanvim.enable = true; + comment-nvim.enable = true; + lsp-format.enable = true; + toggleterm.enable = true; + which-key.enable = true; + todo-comments.enable = true; + }; + + plugins.neo-tree = { + enable = true; + enableGitStatus = true; + }; + + colorschemes.rose-pine.enable = true; + options = { + number = true; + relativenumber = true; + }; + globals.mapleader = " "; + + plugins.bufferline = { + enable = true; + }; + + plugins.lsp = { + enable = true; + servers = { + tsserver.enable = true; + lua-ls.enable = true; + rust-analyzer = { + enable = true; + installRustc = false; + installCargo = false; + }; + nil_ls.enable = true; + }; + }; + + keymaps = [ + { + action = "Neotree"; + key = "fe"; + } + { + action = "lua _lazygit_toggle()"; + key = "gg"; + } + ]; + + plugins.nvim-cmp = { + enable = true; + autoEnableSources = true; + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + ]; + snippet = {expand = "luasnip";}; + mappingPresets = ["insert"]; + mapping = { + "" = "cmp.mapping.confirm({ select = true })"; + }; + }; + + extraConfigLua = '' + local Terminal = require('toggleterm.terminal').Terminal + local lazygit = Terminal:new({ cmd = "lazygit", hidden = true, direction = "float" }) + + function _lazygit_toggle() + lazygit:toggle() + end + ''; + }; +} diff --git a/modules/rice/dunst.nix b/modules/rice/dunst.nix new file mode 100644 index 0000000..9500f58 --- /dev/null +++ b/modules/rice/dunst.nix @@ -0,0 +1,68 @@ +{ + pkgs, + theme, + ... +}: let + inherit (theme) x; +in { + services.dunst = { + enable = true; + package = pkgs.dunst.overrideAttrs (_: { + src = pkgs.fetchFromGitHub { + owner = "sioodmy"; + repo = "dunst"; + rev = "6477864bd870dc74f9cf76bb539ef89051554525"; + sha256 = "FCoGrYipNOZRvee6Ks5PQB5y2IvN+ptCAfNuLXcD8Sc="; + }; + }); + iconTheme = { + package = pkgs.catppuccin-papirus-folders; + name = "Papirus"; + }; + settings = with theme.colors; { + global = { + frame_color = "#${pink}95"; + separator_color = x pink; + width = 220; + height = 280; + offset = "0x15"; + font = "Lexend 12"; + corner_radius = 10; + origin = "top-center"; + notification_limit = 3; + idle_threshold = 120; + ignore_newline = "no"; + mouse_left_click = "close_current"; + mouse_right_click = "close_all"; + sticky_history = "yes"; + history_length = 20; + show_age_threshold = 60; + ellipsize = "middle"; + padding = 10; + always_run_script = true; + frame_width = 2; + transparency = 10; + progress_bar = true; + progress_bar_frame_width = 0; + highlight = x pink; + }; + fullscreen_delay_everything.fullscreen = "delay"; + urgency_low = { + background = "#${base}83"; + foreground = x text; + timeout = 5; + }; + urgency_normal = { + background = "#${base}83"; + foreground = "#c6d0f5"; + timeout = 6; + }; + urgency_critical = { + background = "#${base}83"; + foreground = x text; + frame_color = "#${red}80"; + timeout = 0; + }; + }; + }; +} diff --git a/modules/rice/gtk.nix b/modules/rice/gtk.nix new file mode 100644 index 0000000..d31a89c --- /dev/null +++ b/modules/rice/gtk.nix @@ -0,0 +1,87 @@ +{pkgs, ...}: { + gtk = { + enable = true; + theme = { + name = "Catppuccin-Frappe-Compact-Pink-Dark"; + package = pkgs.catppuccin-gtk.override { + accents = ["pink"]; + tweaks = ["rimless"]; + size = "compact"; + variant = "frappe"; + }; + }; + + iconTheme = { + package = pkgs.catppuccin-papirus-folders; + name = "Papirus"; + }; + font = { + name = "Lexend"; + size = 11; + }; + gtk3.extraConfig = { + gtk-xft-antialias = 1; + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintslight"; + gtk-xft-rgba = "rgb"; + gtk-application-prefer-dark-theme = 1; + }; + gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; + gtk2.extraConfig = '' + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintslight" + gtk-xft-rgba="rgb" + ''; + }; + + home = { + packages = with pkgs; [ + qt5.qttools + qt6Packages.qtstyleplugin-kvantum + libsForQt5.qtstyleplugin-kvantum + libsForQt5.qt5ct + breeze-icons + ]; + pointerCursor = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; + size = 16; + gtk.enable = true; + x11.enable = true; + }; + + sessionVariables = { + XCURSOR_SIZE = "16"; + GTK_USE_PORTAL = "1"; + }; + }; + qt = { + enable = true; + platformTheme = "qtct"; + style = { + name = "Catppuccin-Frappe-Dark"; + package = pkgs.catppuccin-kde.override { + flavour = ["frappe"]; + accents = ["pink"]; + }; + }; + }; + xdg.configFile = { + "Kvantum/catppuccin/catppuccin.kvconfig".source = builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/src/Catppuccin-Frappe-Pink/Catppuccin-Frappe-Pink.kvconfig"; + sha256 = "0pl936nchif2zsgzy4asrlc3gvv4fv2ln2myrqx13r6xra1vkcqs"; + }; + "Kvantum/catppuccin/catppuccin.svg".source = builtins.fetchurl { + url = "https://raw.githubusercontent.com/catppuccin/Kvantum/main/src/Catppuccin-Frappe-Pink/Catppuccin-Frappe-Pink.svg"; + sha256 = "1b92j0gb65l2pvrf90inskr507a1kwin1zy0grwcsdyjmrm5yjrv"; + }; + "Kvantum/kvantum.kvconfig".text = '' + [General] + theme=catppuccin + + [Applications] + catppuccin=qt5ct, org.qbittorrent.qBittorrent, hyprland-share-picker + ''; + }; +} diff --git a/modules/rice/hyprland/binds.nix b/modules/rice/hyprland/binds.nix new file mode 100644 index 0000000..e6fff9e --- /dev/null +++ b/modules/rice/hyprland/binds.nix @@ -0,0 +1,63 @@ +{ + config, + lib, + ... +}: let + mod = "SUPER"; + modshift = "${mod}SHIFT"; + + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} (stolen from fufie) + workspaces = builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "${mod}, ${ws}, workspace, ${toString (x + 1)}" + "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10); +in { + wayland.windowManager.hyprland.settings = { + bind = + [ + ''${mod},RETURN,exec,kitty'' + + "${mod},R,exec,wofi" + "${mod},Q,killactive" + "${mod},P,pseudo" + + "${mod},H,movefocus,l" + "${mod},L,movefocus,r" + "${mod},K,movefocus,u" + "${mod},J,movefocus,d" + + "${mod},T,togglegroup," # group focused window + "${modshift},G,changegroupactive," # switch within the active group + "${mod},V,togglefloating," # toggle floating for the focused window + "${mod},F,fullscreen," # fullscreen focused window + + # workspace controls + "${modshift},right,movetoworkspace,+1" # move focused window to the next ws + "${modshift},left,movetoworkspace,-1" # move focused window to the previous ws + "${mod},mouse_down,workspace,e+1" # move to the next ws + "${mod},mouse_up,workspace,e-1" # move to the previous ws + + "${mod},Print,exec, pauseshot" + ",Print,exec, grim - | wl-copy" + "${modshift},O,exec,wl-ocr" + + "${mod},Period,exec, tofi-emoji" + + "${modshift},L,exec,swaylock --grace 0" # lock screen + ] + ++ workspaces; + + bindm = [ + "${mod},mouse:272,movewindow" + "${mod},mouse:273,resizewindow" + ]; + }; +} diff --git a/modules/rice/hyprland/config.nix b/modules/rice/hyprland/config.nix new file mode 100644 index 0000000..9c26a47 --- /dev/null +++ b/modules/rice/hyprland/config.nix @@ -0,0 +1,56 @@ +# home.nix +{ + wayland.windowManager.hyprland.settings = { + exec-once = [ + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + ]; + + general = { + # gaps + gaps_in = 6; + gaps_out = 11; + + # border thiccness + border_size = 2; + + + # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse) + apply_sens_to_raw = 0; + }; + + input = { +kb_layout = "us"; +sensitivity = 0; # -1.0 - 1.0, 0 means no modification. +accel_profile = "flat"; +force_no_accel = true; +}; + + decoration = { + # fancy corners + rounding = 7; + # blur + blur = { + enabled = true; + size = 3; + passes = 3; + ignore_opacity = false; + new_optimizations = 1; + xray = true; + contrast = 0.7; + brightness = 0.8; + }; + + # shadow config + drop_shadow = "no"; + shadow_range = 20; + shadow_render_power = 5; + "col.shadow" = "rgba(292c3cee)"; + }; + + xwayland = { + force_zero_scaling = true; + }; + + monitor = "DP-1,2560x1440@240,0x0,1"; + }; +} diff --git a/modules/rice/hyprland/default.nix b/modules/rice/hyprland/default.nix new file mode 100644 index 0000000..0d87aaf --- /dev/null +++ b/modules/rice/hyprland/default.nix @@ -0,0 +1,19 @@ +{ + pkgs, + lib, + inputs, + ... +}: { +imports = [./config.nix ./binds.nix]; + wayland.windowManager.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.default; + systemd = { + variables = ["--all"]; + extraCommands = [ + "systemctl --user stop graphical-session.target" + "systemctl --user start hyprland-session.target" + ]; + }; + }; +} diff --git a/modules/rice/hyprland/rules.nix b/modules/rice/hyprland/rules.nix new file mode 100644 index 0000000..994c76a --- /dev/null +++ b/modules/rice/hyprland/rules.nix @@ -0,0 +1,43 @@ +{...}: { + wayland.windowManager.hyprland.settings = { + layerrule = [ + "blur, ^(gtk-layer-shell)$" + "blur, ^(launcher)$" + "ignorezero, ^(gtk-layer-shell)$" + "ignorezero, ^(launcher)$" + "blur, notifications" + "ignorezero, notifications" + "blur, bar" + "ignorezero, bar" + "ignorezero, ^(gtk-layer-shell|anyrun)$" + "blur, ^(gtk-layer-shell|anyrun)$" + "noanim, launcher" + "noanim, bar" + ]; + windowrulev2 = [ + # only allow shadows for floating windows + "noshadow, floating:0" + "tile, title:Spotify" + + "idleinhibit focus, class:^(mpv)$" + "idleinhibit focus,class:foot" + "idleinhibit fullscreen, class:^(firefox)$" + + "float, title:^(Picture-in-Picture)$" + "pin, title:^(Picture-in-Picture)$" + + "float,class:udiskie" + + "workspace special silent,class:^(pavucontrol)$" + + "float, class:^(imv)$" + + # throw sharing indicators away + "workspace special silent, title:^(Firefox — Sharing Indicator)$" + "workspace special silent, title:^(.*is sharing (your screen|a window)\.)$" + + "workspace 4, title:^(.*(Disc|WebC)ord.*)$" + "workspace 2, class:^(firefox)$" + ]; + }; +} diff --git a/modules/shell/default.nix b/modules/shell/default.nix new file mode 100644 index 0000000..ed9c506 --- /dev/null +++ b/modules/shell/default.nix @@ -0,0 +1,3 @@ +{ +imports = [ ./zsh/default.nix ]; +} diff --git a/modules/shell/zsh/aliases.nix b/modules/shell/zsh/aliases.nix new file mode 100644 index 0000000..b9a477d --- /dev/null +++ b/modules/shell/zsh/aliases.nix @@ -0,0 +1,43 @@ +{ + pkgs, + lib, + config, + ... +}: +with lib; +with pkgs; { + ytmp3 = '' + ${getExe yt-dlp} -x --continue --add-metadata --embed-thumbnail --audio-format mp3 --audio-quality 0 --metadata-from-title="%(artist)s - %(title)s" --prefer-ffmpeg -o "%(title)s.%(ext)s"''; + cat = "${getExe bat} --style=plain"; + vpn = "mullvad"; + uuid = "cat /proc/sys/kernel/random/uuid"; + grep = getExe ripgrep; + fzf = getExe skim; + untar = "tar -xvf"; + untargz = "tar -xzf"; + MANPAGER = "sh -c 'col -bx | bat -l man -p'"; + du = getExe du-dust; + ps = getExe procs; + m = "mkdir -p"; + fcd = "cd $(find -type d | fzf)"; + l = "ls -lF --time-style=long-iso --icons"; + sc = "sudo systemctl"; + scu = "systemctl --user "; + la = "${getExe eza} -lah --tree"; + ls = "${getExe eza} -h --git --icons --color=auto --group-directories-first -s extension"; + tree = "${getExe eza} --tree --icons --tree"; + kys = "shutdown now"; + gpl = "curl https://www.gnu.org/licenses/gpl-3.0.txt -o LICENSE"; + agpl = "curl https://www.gnu.org/licenses/agpl-3.0.txt -o LICENSE"; + g = "git"; + n = "nix"; + mnt = "udisksctl mount -b"; + umnt = "udisksctl unmount -b"; + burn = "pkill -9"; + diff = "diff --color=auto"; + ".." = "cd .."; + "..." = "cd ../../"; + "...." = "cd ../../../"; + "....." = "cd ../../../../"; + "......" = "cd ../../../../../"; +} diff --git a/modules/shell/zsh/default.nix b/modules/shell/zsh/default.nix new file mode 100644 index 0000000..9af4d53 --- /dev/null +++ b/modules/shell/zsh/default.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: { + home.sessionVariables.STARSHIP_CACHE = "${config.xdg.cacheHome}/starship"; + + programs.zsh = { + enable = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + sessionVariables = { + LC_ALL = "en_US.UTF-8"; + ZSH_AUTOSUGGEST_USE_ASYNC = "true"; + SSH_AUTH_SOCK = "/run/user/1000/keyring/ssh"; + }; + history = { + save = 2137; + size = 2137; + expireDuplicatesFirst = true; + ignoreDups = true; + ignoreSpace = true; + }; + + dirHashes = { + music = "$HOME/Music"; + media = "/run/media/$USER"; + }; + + shellAliases = import ./aliases.nix {inherit pkgs lib config;}; + plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.7.0"; + sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; + }; + } + ]; + }; +} diff --git a/modules/shell/zsh/tools.nix b/modules/shell/zsh/tools.nix new file mode 100644 index 0000000..f84f55a --- /dev/null +++ b/modules/shell/zsh/tools.nix @@ -0,0 +1,64 @@ +{pkgs, ...}: { + services = { + udiskie.enable = true; + gpg-agent = { + enable = true; + pinentryFlavor = "gnome3"; + enableSshSupport = true; + enableZshIntegration = true; + }; + }; + programs = { + gpg.enable = true; + man.enable = true; + eza.enable = true; + dircolors = { + enable = true; + enableZshIntegration = true; + }; + + skim = { + enable = true; + enableZshIntegration = true; + defaultCommand = "rg --files --hidden"; + changeDirWidgetOptions = [ + "--preview 'eza --icons --git --color always -T -L 3 {} | head -200'" + "--exact" + ]; + }; + direnv = { + enable = true; + nix-direnv.enable = true; + }; + tealdeer = { + enable = true; + settings = { + display = { + compact = false; + use_pager = true; + }; + updates = { + auto_update = true; + }; + }; + }; + bat = { + enable = true; + config = { + pager = "less -FR"; + theme = "catppuccin-frappe"; + }; + themes = { + catppuccin-mocha = { + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + sha256 = "6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; + }; + file = "Catppuccin-frappe.tmTheme"; + }; + }; + }; + }; +}