diff --git a/README.md b/README.md index 6ed05b8..456b5ca 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,13 @@

NixOS & Hyprland with Catppuccin Macchiato Theme Configuration

- - + +![nixos](https://img.shields.io/badge/NixOS-24273A.svg?style=flat&logo=nixos&logoColor=CAD3F5) +![nixpkgs](https://img.shields.io/badge/nixpkgs-unstable-informational.svg?style=flat&logo=nixos&logoColor=CAD3F5&colorA=24273A&colorB=8aadf4) +![linux kernel](https://img.shields.io/badge/linux_kernel-mainline-informational.svg?style=flat&logo=linux&logoColor=f4dbd6&colorA=24273A&colorB=b7bdf8) +![hyprland](https://img.shields.io/badge/hyprland-development-informational.svg?style=flat&logo=wayland&logoColor=eed49f&colorA=24273A&colorB=91d7e3) +![rust](https://img.shields.io/badge/rust-nightly-informational.svg?style=flat&logo=rust&logoColor=f5a97f&colorA=24273A&colorB=f5a97f) +
![Showcase Gif](home/Pictures/Records/record.gif) @@ -24,6 +29,17 @@ This repository houses my NixOS Linux configuration, featuring the Hyprland wind 🚨It's essential to note that this configuration is not minimalistic or lightweight and may require some disk space and knowledge to understand. If you're looking for something simpler, this configuration may not be suitable for you. +This system leverages cutting-edge channels and versions of software to provide you with the latest updates and features. Notably, it utilizes: + +- **nixpkgs**: unstable +- **hyprland**: development version +- **linux kernel**: mainline +- **rust**: nightly version + +This approach ensures that you stay on the forefront of technology, receiving the most recent software advancements promptly. 🚨However, it's important to note that this emphasis on bleeding-edge software may impact the stability of the system. + +You have the flexibility to customize these configurations according to your needs by modifying the respective configuration files. + ## 🌟 Showcase The showcased images do not reflect the latest version of the system's appearance. The final setup may vary slightly. @@ -39,7 +55,7 @@ The showcased images do not reflect the latest version of the system's appearanc | Component | Version/Name | |-----------------------|-----------------------------| | Distro | NixOS | -| Kernel | Zen | +| Kernel | Mainline | | Shell | Fish | | Display Server | Wayland | | WM (Compositor) | Hyprland | @@ -86,10 +102,12 @@ And many other useful utilities. The full list can be found in the system config 1. Download and Install NixOS from the [official site](https://nixos.org/download). 2. Temporarily install ripgrep and fish using the command: `nix-shell -p ripgrep fish --run fish`. You can also use classic bash and grep for the next step without installing fish and ripgrep. -3. Run the command `rg --hidden FIXME` and change/add lines to match your device, swaps, partitions, and file systems in the configuration files (`/etc/nixos/configuration.nix` & `/etc/nixos/hardware-configuration.nix`). +3. Run the command `rg --hidden FIXME` and change/add lines to match your device, swaps, partitions, and file systems in the configuration files (`/etc/nixos/configuration.nix` & `/etc/nixos/hardware-configuration.nix`). 🚨Ensure that you configure USBGuard in the `configuration.nix` file to avoid potential issues. By default, USBGuard blocks all USB devices, which can lead to the disabling of crucial hardware components such as the integrated camera, bluetooth, wifi, etc. To configure USBGuard properly, add your trusted USB devices to the configuration. You can obtain a list of all connected devices by using the `lsusb` command from the usbutils package. +Failure to configure USBGuard appropriately may result in the inability to connect any USB devices to your machine. If needed, you can also disable USBGuard altogether by setting `services.usbguard.enable` to `false` in the configuration:`services.usbguard.enable = false;`. +This step ensures that USBGuard is not actively blocking any USB devices. 4. To change the default username and/or hostname, run the command `rg --hidden 'xnm'` to find and fix all instances of the username, and `rg --hidden 'isitreal-laptop'` for the hostname. Make sure to change the username to match yours to avoid login issues. 5. Copy all files (with replacements) from the `home` directory to your `$HOME` directory in Linux. -6. Copy all files (with replacements) from the `nixos` directory to `/etc/nixos/`. It's recommended not to copy and replace `hardware-configuration.nix`; only copy it if you have already change it for your hardware. +6. Copy all files (with replacements) from the `nixos` directory to `/etc/nixos/`. 🚨It's recommended not to copy and replace `hardware-configuration.nix`; use default generated one, or only copy my `hardware-configuration.nix` if you have already change it for your hardware. 7. Run the command `sudo nixos-rebuild switch`. After this, you will have a complete system. You can also use flakes after first setup by running `sudo nixos-rebuild switch --flake /etc/nixos` if needed. ## ⌨️ Keybindings @@ -109,6 +127,11 @@ And many other useful utilities. The full list can be found in the system config | SUPER + SHIFT + O | Toggle split | | SUPER + SHIFT + P | Toggle pseudo | | SUPER + SHIFT + M | Exit from `hyprland` | +| SUPER + CTRL + E | Expose all windows using `pyprland` | +| SUPER + CTRL + M | Expose all minimized windows using `pyprland` | +| SUPER + M | Minimize or restore a window using `pyprland` | +| SUPER + CTRL + T | Launch scratchpad with `wezterm` using `pyprland` | +| SUPER + CTRL + V | Launch scratchpad with `pavucontrol` using `pyprland` | | SUPER + T | Launch `wezterm` | | SUPER + D | Launch `rofi -drun` | | SUPER + B | Launch `qutebrowser` | @@ -124,7 +147,8 @@ And many other useful utilities. The full list can be found in the system config | SUPER + E | Launch `swappy` to edit last taken screenshot | | SUPER + R | Record screen area (MP4) | | SUPER + SHIFT + R | Record screen area (GIF) | -| SUPER + C | Color picker | +| SUPER + C | Launch color picker (using `hyperpicer`) | +| SUPER + Z | Toggle Zoom (with `pyprland`)| | SUPER + V | Launch clipboard menu (`rofi -dmenu`) | | SUPER + SHIFT + V | Launch clipboard menu (`rofi -dmenu`) (copy to clipboard) | | SUPER + X | Launch clipboard deletion item menu (`rofi -dmenu`) | @@ -153,12 +177,13 @@ Here are some tips to enhance your Rust experience on this system: - If you are working on multiple projects with distinct `rust-toolchain.toml` files or need to switch between stable and nightly Rust versions, consider the following options: - - Set up a Nix environment using `flake.nix` and [rust-overlay](https://github.com/oxalica/rust-overlay) for each project separately. Utilize `nix develop` to manage project-specific Rust environments. + - Set up a Nix environment using `flake.nix` and [rust-overlay](https://github.com/oxalica/rust-overlay) for each project separately. Utilize `nix develop` or `direnv` to manage project-specific Rust environments. - Alternatively, you can install `rustup` through `configuration.nix` and nixpkgs for a system-wide Rust setup. This allows you to manage Rust versions globally through `rustup`. 2. **Troubleshooting Compilation Issues:** - If you encounter problems during Rust compilation, especially those related to OpenSSL or SQLite (refer [here](https://nixos.wiki/wiki/Rust#Building_Rust_crates_that_require_external_system_libraries)), leverage the `rustenv` fish function. This function is an alias for the `nix-shell -p pkg-config openssl sqlite protobuf --run fish` command, opening a Nix shell with the necessary dependencies for seamless code compilation. Additionally, if you use Nix shell, compilation will occur in the runtime directory, which might be insufficient for some projects. You can adjust the runtime directory size in `configuration.nix` under `services.logind.extraConfig="RuntimeDirectorySize=8G"`. + If you encounter issues during Rust compilation, particularly those related to OpenSSL, SQLite, Wayland, or any other program utilized by `pkg-config` in the compilation process (see [here](https://nixos.wiki/wiki/Rust#Building_Rust_crates_that_require_external_system_libraries)), you can employ the `nix-shell -p pkg-config {your_dependency} [other_dependencies] --run fish` command. This command opens a Nix shell with the necessary dependencies, facilitating seamless code compilation. + Moreover, when using the Nix shell, be aware that the compilation takes place in the runtime directory, which might be insufficient for certain projects. To address this, you can adjust the runtime directory size in the `configuration.nix` file under `services.logind.extraConfig="RuntimeDirectorySize=8G"`. 3. **Cross-Compilation:** For cross-compilation, consider using tools like `zigbuild` or `cross`. Personally, I find `zigbuild` preferable, but both are valuable options for your cross-compilation needs. @@ -182,7 +207,7 @@ Here are some tips to enhance your Rust experience on this system: - `bacon` 5. **Environment Setup:** - You can set up your Rust project environment on this system using `nix develop` or `nix-shell` with `default.nix`, `shell.nix`, or `flake.nix` to create a tailored environment for your Rust project. + You can set up your Rust project environment on this system using `nix develop` or `nix-shell` with `default.nix`, `shell.nix`, or `flake.nix` to create a tailored environment for your Rust project (Also, I personally recommend using it alongside with [direnv](https://direnv.net/)). ## 📜 License diff --git a/home/.cargo/.crates.toml b/home/.cargo/.crates.toml new file mode 100644 index 0000000..fe8d4f7 --- /dev/null +++ b/home/.cargo/.crates.toml @@ -0,0 +1,6 @@ +[v1] +"cargo-contract 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-contract"] +"cargo-dylint 2.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["cargo-dylint"] +"contracts-node 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = ["substrate-contracts-node"] +"dylint-link 2.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = ["dylint-link"] +"ink-lsp-server 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = ["ink-lsp-server"] diff --git a/home/.config/felix/config.yaml b/home/.config/felix/config.yaml index 725b70d..063e518 100644 --- a/home/.config/felix/config.yaml +++ b/home/.config/felix/config.yaml @@ -57,5 +57,6 @@ syntax_highlight: true # For more details, see https://docs.rs/termion/1.5.6/termion/color/index.html color: dir_fg: LightCyan + dirty_fg: LightGreen file_fg: LightWhite symlink_fg: LightYellow diff --git a/home/.config/fish/config.fish b/home/.config/fish/config.fish index 74c7b40..a62bc18 100644 --- a/home/.config/fish/config.fish +++ b/home/.config/fish/config.fish @@ -8,9 +8,8 @@ alias ldocker="lazydocker" alias conf="z ~/.config" alias nixos="z /etc/nixos" alias store="z /nix/store" -alias rustenv="nix-shell -p pkg-config openssl sqlite protobuf --run fish" # run this command first if you have trouble with openssl, sqlite or protobuf during compiling a rust project (more https://nixos.wiki/wiki/Rust#Building_Rust_crates_that_require_external_system_libraries) alias nswitch="sudo nixos-rebuild switch --flake /etc/nixos" -alias nswitchu="sudo nixos-rebuild switch --flake /etc/nixos --upgrade --update-input nixpkgs --update-input rust-overlay --commit-lock-file" +alias nswitchu="sudo nixos-rebuild switch --flake /etc/nixos --update-input nixpkgs --update-input rust-overlay --update-input hyprland --commit-lock-file --upgrade " alias ncsu="sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos" alias nsgc="sudo nix-store --gc" alias ncg="sudo nix-collect-garbage -d" diff --git a/home/.config/fish/functions/startup.fish b/home/.config/fish/functions/autostart.fish similarity index 82% rename from home/.config/fish/functions/startup.fish rename to home/.config/fish/functions/autostart.fish index 594aaab..d9eae61 100644 --- a/home/.config/fish/functions/startup.fish +++ b/home/.config/fish/functions/autostart.fish @@ -1,4 +1,5 @@ -function startup +function autostart + pypr & \ wpaperd & \ waybar & \ poweralertd & \ @@ -6,4 +7,4 @@ function startup avizo-service & \ systemctl --user start psi-notify &\ swayidle -w -end \ No newline at end of file +end diff --git a/home/.config/hypr/hyprland.conf b/home/.config/hypr/hyprland.conf index 7088822..0d89be5 100644 --- a/home/.config/hypr/hyprland.conf +++ b/home/.config/hypr/hyprland.conf @@ -19,7 +19,7 @@ monitor=,preferred,auto,1.2 # See https://wiki.hyprland.org/Configuring/Keywords/ for more # Execute your favorite apps at launch -exec-once = fish -c startup +exec-once = fish -c autostart # Source a file (multi-file configs) @@ -195,7 +195,23 @@ submap=reset # keybinds further down will be global again... +# Scrachpads +bind = $mainMod CTRL, T, exec, pypr toggle term +$dropterm = ^(wezterm_dropdown)$ +windowrule = float, $dropterm +windowrule = workspace special:scratch_term silent, $dropterm + +bind = $mainMod CTRL, V, exec, pypr toggle volume +$volume_sidemenu = ^(pavucontrol)$ +windowrule = float, $volume_sidemenu +windowrule = workspace special:scratch_volume silent, $volume_sidemenu + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod CTRL, M, togglespecialworkspace, minimized +bind = $mainMod, M, exec, pypr toggle_minimized +bind = $mainMod CTRL, E, exec, pypr expose +bind = $mainMod, Z, exec, pypr zoom + bind = $mainMod, T, exec, wezterm bind = $mainMod SHIFT, T, exec, telegram-desktop bind = $mainMod, B, exec, qutebrowser diff --git a/home/.config/hypr/pyprland.toml b/home/.config/hypr/pyprland.toml new file mode 100644 index 0000000..df33177 --- /dev/null +++ b/home/.config/hypr/pyprland.toml @@ -0,0 +1,22 @@ +[pyprland] +plugins = [ + "scratchpads", + "magnify", + "expose", +] + +[scratchpads.term] +command = "wezterm start --class wezterm_dropdown" +animation = "fromTop" +unfocus = "hide" +excludes = "*" +lazy = true + +[scratchpads.volume] +command = "pavucontrol --class volume_sidemenu" +animation = "fromRight" +class = "volume_sidemenu" +size = "40% 70%" +unfocus = "hide" +excludes = "*" +lazy = true diff --git a/home/Projects/optimized-pre-config-rust/.cargo/config.toml b/home/Projects/optimized-pre-config-rust/.cargo/config.toml index bf0d4e9..833fb84 100644 --- a/home/Projects/optimized-pre-config-rust/.cargo/config.toml +++ b/home/Projects/optimized-pre-config-rust/.cargo/config.toml @@ -1 +1 @@ -rustflags = ["-C", "link-arg=-fuse-ld=/path/to/mold", "-Zcodegen-backend=cranelift" ] # Change '/path/to/mold' and DON'T use it in production, only for dev needs +rustflags = ["-C", "link-arg=-fuse-ld=/path/to/mold", "-Z", "threads=8" ] # Change '/path/to/mold', use with nightly version of Rust diff --git a/home/Projects/optimized-pre-config-rust/rust-toolchain.toml b/home/Projects/optimized-pre-config-rust/rust-toolchain.toml index 69e9adb..c4ea275 100644 --- a/home/Projects/optimized-pre-config-rust/rust-toolchain.toml +++ b/home/Projects/optimized-pre-config-rust/rust-toolchain.toml @@ -2,6 +2,7 @@ channel = "nightly" components = [ "rust-src", "rust-analyzer", "rustc-codegen-cranelift", "miri", "llvm-tools", "rust-docs-json" ] targets = [ + "wasm32-unknown-unknown", "wasm32-wasi", "wasm32-wasi-preview1-threads", "x86_64-pc-windows-gnu", diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 99f0809..2ad3c89 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ pkgs, lib, ... }: +{ inputs, pkgs, lib, ... }: { imports = @@ -49,7 +49,10 @@ }; # # Enable Hyprland - programs.hyprland.enable = true; + programs.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + }; environment.sessionVariables.NIXOS_OZONE_WL = "1"; environment.sessionVariables.WLR_NO_HARDWARE_CURSORS = "1"; @@ -130,6 +133,8 @@ nix.settings = { experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; }; # Optimize storage and automatic scheduled GC running @@ -141,7 +146,7 @@ nix.gc = { automatic = true; dates = "weekly"; - options = "--delete-older-than 15d"; + options = "--delete-older-than 7d"; }; # Change runtime directory size @@ -155,13 +160,14 @@ enable = true; operation = "switch"; # If you don't want to apply updates immediately, only after rebooting, use `boot` option in this case flake = "/etc/nixos"; - flags = [ "--update-input" "nixpkgs" "--update-input" "rust-overlay" "--commit-lock-file" ]; + flags = [ "--update-input" "nixpkgs" "--update-input" "rust-overlay" "--update-input" "hyprland" "--commit-lock-file" ]; dates = "daily"; # channel = "https://nixos.org/channels/nixos-unstable"; }; + # Linux Kernel - boot.kernelPackages = pkgs.linuxKernel.packages.linux_zen; + boot.kernelPackages = pkgs.linuxKernel.packages.linux_testing; # Enable networking networking.networkmanager = { @@ -299,9 +305,10 @@ enable = true; dbus.enable = true; implicitPolicyTarget = "block"; - # FIXME: set yours pref USB devices + # FIXME: set yours pref USB devices (change {id} to your trusted USB device), use `lsusb` command (from usbutils package) to get list of all connected USB devices including integrated devices like camera, bluetooth, wifi, etc. with their IDs rules = '' - allow id {id} + allow id {id} # device 1 + allow id {id} # device 2 ''; }; services.clamav = { @@ -552,6 +559,7 @@ htop bottom btop + kmon cmatrix pipes-rs @@ -598,6 +606,7 @@ wtype wlrctl hyprpicker + pyprland waybar rofi-wayland dunst diff --git a/nixos/flake.nix b/nixos/flake.nix index 9dd1b99..75f622b 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -4,6 +4,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; + hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { nixpkgs, rust-overlay, ... } @ inputs: diff --git a/nixos/rust-toolchain.toml b/nixos/rust-toolchain.toml index 2349ea2..c4ea275 100644 --- a/nixos/rust-toolchain.toml +++ b/nixos/rust-toolchain.toml @@ -1,9 +1,10 @@ [toolchain] -channel = "stable" -components = [ "rust-src", "rust-analyzer" ] +channel = "nightly" +components = [ "rust-src", "rust-analyzer", "rustc-codegen-cranelift", "miri", "llvm-tools", "rust-docs-json" ] targets = [ "wasm32-unknown-unknown", "wasm32-wasi", + "wasm32-wasi-preview1-threads", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu", ]