diff --git a/.config/fish/config.fish b/.config/fish/config-old.fish similarity index 84% rename from .config/fish/config.fish rename to .config/fish/config-old.fish index 4f74db6..d6795ed 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config-old.fish @@ -6,11 +6,10 @@ if status is-interactive echo onefetch end - test -f .nvmrc && nvm use > /dev/null + # test -f .nvmrc && nvm use > /dev/null end - #fastfetch -l arch echo -e "\n" - fastfetch -l arch --color-keys (set_color "09BC8A" | string sub -s 3 -e -1) --color-title (set_color "75DDDD" | string sub -s 3 -e -1) + fastfetch --color-keys (set_color "09BC8A" | string sub -s 3 -e -1) --color-title (set_color "75DDDD" | string sub -s 3 -e -1) test -f .nvmrc && nvm use > /dev/null end set PATH $PATH $HOME/.cargo/bin $HOME/.local/share/pnpm $HOME/.local/bin $HOME/.spicetify $HOME/.bun/bin @@ -38,7 +37,7 @@ fish_ssh_agent #end # <<< conda initialize <<< -eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv) +# eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv) set -x PERL5LIB "/home/dan/perl5/lib/perl5:$PERL5LIB"; set -x PERL_LOCAL_LIB_ROOT "/home/dan/perl5:$PERL_LOCAL_LIB_ROOT"; set -x PERL_MB_OPT "--install_base \"/home/dan/perl5\""; diff --git a/.config/hypr/hypridle.conf b/.config/hypr/hypridle.conf new file mode 100644 index 0000000..9e13fc3 --- /dev/null +++ b/.config/hypr/hypridle.conf @@ -0,0 +1,14 @@ +general { + lock_cmd = hyprlock # dbus/sysd lock command (loginctl lock-session) + unlock_cmd = pkill -USR1 hyprlock # same as above, but unlock + before_sleep_cmd = hyprlock # command ran before sleep + # after_sleep_cmd = notify-send "Awake!" # command ran after sleep + ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) + ignore_systemd_inhibit = false # whether to ignore systemd-inhibit --what=idle inhibitors +} + +listener { + timeout = 500 # in seconds + on-timeout = hyprlock # command to run when timeout has passed + # on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired. +} \ No newline at end of file diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 9734b2f..0e70844 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -6,10 +6,10 @@ #autogenerated = 1 # remove this line to remove the warning #env=LIBSEAT_BACKEND,seatd -env = HYPRLAND_LOG_WLR,1 +# env = HYPRLAND_LOG_WLR,1 #env = WLR_DRM_DEVICES,$HOME/.config/hypr/nvidia:$HOME/.config/hypr/amd #env = WLR_DRM_DEVICES,$HOME/.config/hypr/amd:$HOME/.config/hypr/nvidia -env = WLR_DRM_DEVICES,$HOME/.config/hypr/amd-render:$HOME/.config/hypr/nvidia-render +# env = WLR_DRM_DEVICES,$HOME/.config/hypr/amd-render:$HOME/.config/hypr/nvidia-render #env = LIBVA_DRIVER_NAME,nvidia #env = XDG_SESSION_TYPE,wayland #env = GBM_BACKEND,nvidia-drm @@ -43,7 +43,7 @@ exec-once=swaybg -m fill -i ~/.config/hypr/wallpapers/sunflowers.jpg exec-once=waybar exec-once=blueman-applet exec-once=dunst -exec-once=udev-block-notify +# exec-once=udev-block-notify #exec-once=~/.config/hypr/scripts/sleep.sh exec-once=echo us > /tmp/kb_layout #exec-once=hyprctl setcursor Sweet 30 @@ -53,9 +53,11 @@ exec-once=kdeconnect-indicator #$swaylock = swaylock --screenshots --clock --indicator --effect-blur 6x6 --fade-in 0.2 --ring-color 4e9dc2 --key-hl-color 71b0ce $swaylock = hyprlock +exec-once=hypridle -exec-once=swayidle -w timeout 300 '$swaylock --grace 2' before-sleep '$swaylock' -exec-once=/usr/lib/pam_kwallet_init +# exec-once=swayidle -w timeout 300 '$swaylock --grace 2' before-sleep '$swaylock' +# Needs repackaging... +# exec-once=/usr/lib/pam_kwallet_init env = QT_QPA_PLATFORMTHEME,qt5ct env = QT_AUTO_SCREEN_SCALE_FACTOR,1 @@ -238,7 +240,7 @@ bind = SUPER, P, exec, pkill rofi || $dir/rofi/bin/powermenu $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, T, exec, warp-terminal #kitty +bind = $mainMod, T, exec, kitty bind=$mainMod,K,exec,kitty bind=SUPER,B,exec,vivaldi-stable bind = $mainMod, Q, killactive, @@ -313,7 +315,8 @@ bind = ALT, tab, cyclenext, bind = ALT+SHIFT, tab, cyclenext, prev bind = ,Print,exec,grim - | wl-copy -bind = SUPER+SHIFT,S,exec,grim -g "$(slurp)" - | wl-copy +bind = SUPER+SHIFT,S,exec,spectacle --copy-image --region --background # no gui +# bind = SUPER+SHIFT,S,exec,grim -g "$(slurp)" - | wl-copy bind = SUPER, L,exec,$swaylock # Move active window to a workspace with mainMod + SHIFT + [0-9] diff --git a/.config/hypr/hyprlock.conf b/.config/hypr/hyprlock.conf new file mode 100644 index 0000000..c8c7bf9 --- /dev/null +++ b/.config/hypr/hyprlock.conf @@ -0,0 +1,50 @@ +general { + +} + +background { + monitor = + path = screenshot + color = rgba(25, 20, 20, .2) + + # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations + blur_passes = 4 # 0 disables blurring + blur_size = 7 + noise = 0.0117 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 +} + +input-field { + monitor = + size = 200, 50 + outline_thickness = 3 + dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = false + dots_rounding = -1 # -1 default circle, -2 follow input-field rounding + outer_color = rgb(151515) + inner_color = rgb(200, 200, 200) + font_color = rgb(10, 10, 10) + fade_on_empty = true + fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered. + placeholder_text = Password # Text rendered in the input box when it's empty. + hide_input = false + rounding = -1 # -1 means complete rounding (circle/oval) + check_color = rgb(204, 136, 34) + fail_color = rgb(204, 34, 34) # if authentication failed, changes outer_color and fail message color + fail_text = $FAIL ($ATTEMPTS) # can be set to empty + fail_timeout = 2000 # milliseconds before fail_text and fail_color disappears + fail_transition = 300 # transition time in ms between normal outer_color and fail_color + capslock_color = -1 + numlock_color = -1 + bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above) + invert_numlock = false # change color if numlock is off + swap_font_color = false # see below + + position = 0, -20 + halign = center + valign = center +} \ No newline at end of file diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf index 888368a..1a3628d 100644 --- a/.config/kitty/kitty.conf +++ b/.config/kitty/kitty.conf @@ -1,6 +1,6 @@ font_family Fira Code Retina font_features FiraCode-Retina +zero -background_opacity 0.1 +background_opacity 0.3 shell fish #map ctrl+shift+c copy_to_clipboard #map ctrl+shift+v paste_from_clipboard diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index a39a686..089c6fc 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -59,11 +59,11 @@ }, "custom/weather": { - "exec": "python ~/.config/waybar/weather.py", - "restart-interval": 300, - "return-type": "json", - "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/c3e96d6cc4965fc54f88296b54449571c4107c73b9638c16aafc83575b4ddf2e" - // "format-alt": "{alt}", + "exec": "python ~/.config/waybar/weather.py", + "restart-interval": 300, + "return-type": "json", + "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/c3e96d6cc4965fc54f88296b54449571c4107c73b9638c16aafc83575b4ddf2e" + // "format-alt": "{alt}", }, "custom/spotify": { "exec": "python ~/.config/waybar/player.py", diff --git a/README.md b/README.md index 16297ea..d1b5354 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Dotfiles -My dotfiles. Moved from KDE plasma config to hyprland. +My dotfiles and nix setup incl. scripts for hyprland and some other goodies. super key = windows key @@ -14,7 +14,7 @@ Please do edit configuration of at least hyprland - default configuration is ver ## Used software -I'm using Arch linux. +I'm using NixOS. - hyprland - wayland compositor and window manager (also adds blur and rounded corners). Really barebones, see below for shortcuts (read the config file for up to date shortcuts) - fish - shell (friendly, interactive, doesn't implement POSIX, I recommend reading it's docs first) @@ -25,13 +25,12 @@ I'm using Arch linux. - nushell - for scripting and data management - I don't use it and it's not required for the current setup, but I'm planning to use it in the future. - rofi - application launcher, general "chooser" (used for power menu, notification actions, etc) - waybar - the top status bar -- lightly (AUR) - QT theme, set it via `qt5ct`. Adds blur to *most* QT apps, but mainly also improves the general look and feal of QT apps. Some blur is broken on wayland. - hyprlock - Fancy lock screen - spicetify - custom spotify theme - VSCode - code editor. Current theme/config is not in dotfiles here, but the theme used is Atom One Dark, and the font is Fira Code. - dolphin - file browser - polkit-kde-authentication-agent-1 - required for sudo gui prompts (like when you open dolphin as root) -- blueman-applet - bluetooth app indicator +- blueman - bluetooth app indicator - swaybg - for showing wallpaper - activity-watch and awatcher - for program usage statistics - nm-applet - network manager app indicator diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..efb360e --- /dev/null +++ b/configuration.nix @@ -0,0 +1,164 @@ +# 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, ... }: +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = [ "ntfs" ]; + + networking.hostName = "lenovo-nix"; + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + networking.networkmanager.enable = true; + time.timeZone = "Europe/Prague"; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "cs_CZ.UTF-8"; + LC_IDENTIFICATION = "cs_CZ.UTF-8"; + LC_MEASUREMENT = "cs_CZ.UTF-8"; + LC_MONETARY = "cs_CZ.UTF-8"; + LC_NAME = "cs_CZ.UTF-8"; + LC_NUMERIC = "cs_CZ.UTF-8"; + LC_PAPER = "cs_CZ.UTF-8"; + LC_TELEPHONE = "cs_CZ.UTF-8"; + LC_TIME = "cs_CZ.UTF-8"; + }; + + services.xserver.enable = false; + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + services.xserver = { + xkb = { + layout = "us"; + variant = ""; + }; + #libinput.enable = true; + }; + + services.printing.enable = true; + + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + #jack.enable = true; + }; + + users.users.dan = { + isNormalUser = true; + description = "John"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + kdePackages.kate + # thunderbird + ]; + }; + home-manager.useGlobalPkgs = true; + home-manager.users.dan = import ./home.nix; + + # Other defaults are set in home.nix + environment.sessionVariables.DEFAULT_BROWSER = "firefox"; + + programs.firefox.enable = true; + programs.hyprland.enable = true; + programs.hyprlock.enable = true; + services.hypridle.enable = true; + programs.fish.enable = true; + services.openssh.enable = true; + services.tailscale = { + enable = true; + useRoutingFeatures = "both"; + openFirewall = true; + extraUpFlags = [ "--advertise-exit-node" ]; + }; + hardware.opentabletdriver.enable = true; + + + environment.systemPackages = with pkgs; [ + git + nvtopPackages.full + btop + lshw + ]; + + nixpkgs.config.allowUnfree = true; + + # The nvidia fun part + hardware.opengl.enable = true; + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + prime = { + # hardware specific, beware! + amdgpuBusId = "PCI:01:00:0"; + nvidiaBusId = "PCI:06:00:0"; + + offload = { + enable = true; + enableOffloadCmd = true; + }; + }; + # 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; + }; + + security.polkit.enable = true; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 57621 # Spotify app discovery + ]; + networking.firewall.allowedUDPPorts = [ + 5353 # Google cast discovery + ]; + # 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 = "24.05"; # Did you read the comment? +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..07cc94b --- /dev/null +++ b/home.nix @@ -0,0 +1,94 @@ +{ pkgs, ...}: { + home = { + stateVersion = "24.05"; + + packages = with pkgs; [ + grc + onefetch + fira-code + kitty + nushell + rofi-wayland + rustup + discord + spotify + spicetify-cli + meslo-lgs-nf + waybar + chromium + firefox + dunst + sccache + discord + spotify + spicetify-cli + meslo-lgs-nf + blueman + swaybg + activitywatch + networkmanagerapplet + kubectl + duf + dust + jetbrains.rust-rover + jetbrains.webstorm + mongodb-compass + hashcat + tldr + dunst + grim + slurp + wl-clipboard + + strace + ghidra + python3 + ]; + }; + programs = { + fish = { + enable = true; + interactiveShellInit = '' + set fish_greeting # Disable greeting + ''; + shellInit = '' + source ~/.config/fish/config-old.fish + ''; + plugins = with pkgs.fishPlugins; [ + { name = "grc"; src = grc.src; } + { name = "tide"; src = tide.src; } + ]; + }; + vscode = { + enable = true; + extensions = with pkgs.vscode-extensions; [ + + ]; + }; + git = { + enable = true; + userName = "Daniel Bulant"; + userEmail = "danbulant@gmail.com"; + }; + btop.enable = true; + bat.enable = true; + lsd.enable = true; + fastfetch.enable = true; + mise.enable = true; + direnv.enable = true; + # firefox.enable = true; + }; + services.kdeconnect.enable = true; + services.kdeconnect.indicator = true; + xdg.mimeApps = { + enable = true; + + defaultApplications = { + "text/html" = "firefox.desktop"; + "x-scheme-handler/http" = "firefox.desktop"; + "x-scheme-handler/https" = "firefox.desktop"; + "x-scheme-handler/about" = "firefox.desktop"; + "x-scheme-handler/unknown" = "firefox.desktop"; + }; + }; +} \ No newline at end of file diff --git a/setup-nix-channels.sh b/setup-nix-channels.sh new file mode 100644 index 0000000..30ea909 --- /dev/null +++ b/setup-nix-channels.sh @@ -0,0 +1,3 @@ +sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager +sudo nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardware +sudo nix-channel --update \ No newline at end of file diff --git a/sync-nix.sh b/sync-nix.sh new file mode 100755 index 0000000..f0dfd8f --- /dev/null +++ b/sync-nix.sh @@ -0,0 +1,5 @@ +echo "Copying configurations" +cp .config/* ~/.config/ -r +sudo cp configuration.nix /etc/nixos/configuration.nix +sudo cp home.nix /etc/nixos/home.nix +sudo nixos-rebuild switch \ No newline at end of file diff --git a/upgrade-nix.sh b/upgrade-nix.sh new file mode 100644 index 0000000..7b581ef --- /dev/null +++ b/upgrade-nix.sh @@ -0,0 +1 @@ +sudo nixos-rebuild --upgrade switch \ No newline at end of file