commit b51cdf718aceb7f93598ef7a16cc4d714b9463f2 Author: xeovalyte Date: Sat Mar 9 17:18:36 2024 +0100 initial configuration diff --git a/README.md b/README.md new file mode 100644 index 0000000..0111148 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Xeovalyte Dotfiles with Nix + +## New system install guide + +### 1. Install Nixos with ISO +[Nixos download](https://nixos.org/download) + +### 2. Copy hardware configuration to hosts directory + +### 3. Generate ssh-keys + +**Archserver** +1. `ssh-keygen -f ~/.ssh/archserver` +2. `ssh-copy-id -i ~/.ssh/archserver 192.168.1.20` + +**Gitea** +1. `ssh-keygen -f ~/.ssh/gitea -t ed25519 -C "me+gitea@xeovalyte.dev"` +2. Upload to [Gitea](https://gitea.xeovalyt.dev) +3. Verify ssh key (follow instructions on Gitea) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4eb8eef --- /dev/null +++ b/flake.lock @@ -0,0 +1,293 @@ +{ + "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, + "firefox-addons": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1709904588, + "narHash": "sha256-8JsZyeV8NY8LfSn39SQ9Vn4Sp8DzLLBi0MwA/RGoB6k=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "d1ca09b4bdb38be343b5b0a7556c2c5007f523d2", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1629284811, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "getchoo": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1709590065, + "narHash": "sha256-dyB0W+xKL+9Inj+SM0WnmJwQeimiMpH5YNvDXNwFDk4=", + "owner": "getchoo", + "repo": "nix-exprs", + "rev": "c0720f0dc9b8b5da10fca4949734703531961d20", + "type": "github" + }, + "original": { + "owner": "getchoo", + "repo": "nix-exprs", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706981411, + "narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "652fda4ca6dafeb090943422c34ae9145787af37", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "hypridle": { + "inputs": { + "hyprlang": "hyprlang", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1709223573, + "narHash": "sha256-xi7yscjt7t8tFcJDgHzxgW15Obcp7dEghG41f6tUmRc=", + "owner": "hyprwm", + "repo": "hypridle", + "rev": "029f08805a2297966d295a52a6e62c3801926a52", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hypridle", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hypridle", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708212860, + "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_2": { + "inputs": { + "nixpkgs": [ + "hyprlock", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708212860, + "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlock": { + "inputs": { + "hyprlang": "hyprlang_2", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1709847152, + "narHash": "sha256-CRhe53TZ8MvfrIQojbTevoe2OpiCrS7ZxovtR94VYs0=", + "owner": "hyprwm", + "repo": "hyprlock", + "rev": "e9a57f0dae1dfa02240040f5975d048175440c2c", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlock", + "type": "github" + } + }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709677081, + "narHash": "sha256-tix36Y7u0rkn6mTm0lA45b45oab2cFLqAzDbJxeXS+c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "880992dcc006a5e00dd0591446fdf723e6a51a64", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-23.11", + "type": "indirect" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "firefox-addons": "firefox-addons", + "getchoo": "getchoo", + "home-manager": "home-manager", + "hypridle": "hypridle", + "hyprlock": "hyprlock", + "nix-colors": "nix-colors", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + }, + "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": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b8400d5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,62 @@ +{ + description = "Nixos configuration for Xeovalyte"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-23.11"; + + nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nix-colors.url = "github:misterio77/nix-colors"; + + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprlock = { + url = "github:/hyprwm/hyprlock"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hypridle = { + url = "github:/hyprwm/hypridle"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + getchoo = { + url = "github:getchoo/nix-exprs"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; + }; + + outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, home-manager, nix-colors, ... }: + let + overlay-unstable = final: prev: { + unstable = nixpkgs-unstable.legacyPackages.${prev.system}; + }; + in + { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + + ./hosts/laptop + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.extraSpecialArgs = { inherit inputs nix-colors; }; + home-manager.users.xeovalyte.imports = [ ./hosts/laptop/home.nix ]; + } + ]; + }; + }; + }; +} diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix new file mode 100644 index 0000000..180c345 --- /dev/null +++ b/hosts/laptop/default.nix @@ -0,0 +1,109 @@ +# 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 + ../../modules/system/desktop/hyprland.nix + ../../modules/system/programs/syncthing.nix + ../../modules/system/programs/thunar.nix + ../../modules/system/utils/common.nix + ../../modules/system/utils/fprint.nix + ../../modules/system/utils/garbage-collection.nix + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "xv-laptop"; # Define your hostname. + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "nl_NL.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "nl_NL.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "nl_NL.UTF-8"; + }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + # services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + # 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 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.xeovalyte = { + isNormalUser = true; + description = "Timo Boomers"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + # 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/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix new file mode 100644 index 0000000..502f011 --- /dev/null +++ b/hosts/laptop/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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" "thunderbolt" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e8be61cf-dea9-4a94-a414-38a4246c8a5b"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0C1D-2896"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/c6c5b3d7-7d49-4aff-ba91-cb0ac68808a6"; } + ]; + + # 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.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix new file mode 100644 index 0000000..5bb6e58 --- /dev/null +++ b/hosts/laptop/home.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +{ + imports = [ + ../../modules/home/desktop/hyprland + ../../modules/home/programs/common.nix + ../../modules/home/programs/firefox.nix + ../../modules/home/programs/kitty.nix + ../../modules/home/programs/neovim + ../../modules/home/theme + ../../modules/home/theme/blueish.nix + ../../modules/home/utils/fonts.nix + ]; + + home = { + username = "xeovalyte"; + homeDirectory = "/home/xeovalyte"; + }; + + home.packages = with pkgs; [ + # Desktop Applications + firefox + webcord + logseq + + # CLI tools + btop + ]; + + home.stateVersion = "23.11"; +} diff --git a/modules/home/desktop/hyprland/default.nix b/modules/home/desktop/hyprland/default.nix new file mode 100644 index 0000000..e87c147 --- /dev/null +++ b/modules/home/desktop/hyprland/default.nix @@ -0,0 +1,145 @@ +{ pkgs, ... }: + +{ + imports = [ + ./waybar.nix + ./hyprpaper.nix + ./hyprlock.nix + ./hypridle.nix + ./fixes.nix + ]; + + home.packages = with pkgs; [ + rofi + kitty + wev + brightnessctl + playerctl + wl-clipboard + grimblast + nwg-bar + powertop + ]; + + wayland.windowManager.hyprland = { + enable = true; + package = pkgs.unstable.hyprland; + settings = { + monitor = ",preferred,auto,1.566667"; + + exec-once = [ + "waybar" + "hyprpaper" + ]; + + "$mod" = "SUPER"; + + input = { + follow_mouse = 2; + touchpad = { + natural_scroll = true; + clickfinger_behavior = true; + }; + }; + + general = { + gaps_in = "5"; + gaps_out = "10"; + border_size = "2"; + + "col.active_border" = "rgba(00bfffee) rgba(36b7e2ee) 45deg"; + "col.inactive_border" = "rgba(0a3543aa)"; + + layout = "dwindle"; + }; + + decoration = { + rounding = "5"; + drop_shadow = "false"; + blur.enabled = "false"; + shadow_render_power = "3"; + "col.shadow" = "rgba(1a1a1aee)"; + }; + + gestures = { + workspace_swipe = "on"; + workspace_swipe_distance = "200"; + }; + + misc = { + vfr = "true"; + }; + + bind = [ + "$mod, Q, exec, kitty" + "$mod, SPACE, exec, rofi -show drun" + ",Print, exec, grimblast copy area" + "$mod,ESCAPE, exec, nwg-bar" + + "$mod, C, killactive" + "$mod, V, togglefloating" + "$mod, F, fullscreen, 0" + "$mod, M, fullscreen, 1" + "$mod, L, exec, hyprlock" + + "$mod, h, movefocus, l" + "$mod, l, movefocus, r" + "$mod, k, movefocus, u" + "$mod, j, movefocus, d" + + "$mod SHIFT, h, movewindow, l" + "$mod SHIFT, l, movewindow, r" + "$mod SHIFT, k, movewindow, u" + "$mod SHIFT, j, movewindow, d" + + "$mod ALT, h, resizeactive, -20 0" + "$mod ALT, l, resizeactive, 20 0" + "$mod ALT, k, resizeactive, 0 -20" + "$mod ALT, j, resizeactive, 0 20" + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + + "$mod SHIFT, 1, movetoworkspace, 1" + "$mod SHIFT, 2, movetoworkspace, 2" + "$mod SHIFT, 3, movetoworkspace, 3" + "$mod SHIFT, 4, movetoworkspace, 4" + "$mod SHIFT, 5, movetoworkspace, 5" + "$mod SHIFT, 6, movetoworkspace, 6" + "$mod SHIFT, 7, movetoworkspace, 7" + "$mod SHIFT, 8, movetoworkspace, 8" + ]; + + bindle = [ + # Volume control + ",XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + + # Brightness control + ",XF86MonBrightnessUp, exec, brightnessctl set 5%+" + ",XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ]; + + bindl= [ + # Toggle audio mute + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + + # Media control + ",XF86AudioPlay, exec, playerctl play-pause" + ",XF86AudioNext, exec, playerctl next" + ",XF86AudioPrev, exec, playerctl previous" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + }; +} diff --git a/modules/home/desktop/hyprland/fixes.nix b/modules/home/desktop/hyprland/fixes.nix new file mode 100644 index 0000000..4df5bdf --- /dev/null +++ b/modules/home/desktop/hyprland/fixes.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + home.file.".config/electron-flags.conf" = { + enable = true; + executable = false; + text ='' + --enable-features=UseOzonePlatform --ozone-platform=wayland + ''; + }; + + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + + programs.bash = { + enable = true; + #sessionVariables = { + # NIXOS_OZONE_WL = "1"; + #}; + }; +} diff --git a/modules/home/desktop/hyprland/hypridle.nix b/modules/home/desktop/hyprland/hypridle.nix new file mode 100644 index 0000000..331729f --- /dev/null +++ b/modules/home/desktop/hyprland/hypridle.nix @@ -0,0 +1,35 @@ +{ inputs, pkgs, ... }: + +{ + imports = [ + inputs.hypridle.homeManagerModules.default + ]; + + services.hypridle = { + enable = true; + lockCmd = "pidof ${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock || ${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; # avoid starting multiple hyprlock instances. + beforeSleepCmd = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; # lock before suspend. + afterSleepCmd = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. + + listeners = [ + { + timeout = 120; # 2.5min. + onTimeout = "${pkgs.brightnessctl}/bin/brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + onResume = "${pkgs.brightnessctl}/bin/brightnessctl -r"; + } + { + timeout = 300; # 5min + onTimeout = "${inputs.hyprlock.packages.${pkgs.system}.hyprlock}/bin/hyprlock"; + } + { + timeout = 380; # 5.5min + onTimeout = "${pkgs.hyprland}/bin/hyprctl dispatch dpms off"; # screen off when timeout has passed + onResume = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; + } + { + timeout = 600; # 30min + onTimeout = "systemctl suspend"; # suspend pc + } + ]; + }; +} diff --git a/modules/home/desktop/hyprland/hyprlock.nix b/modules/home/desktop/hyprland/hyprlock.nix new file mode 100644 index 0000000..0347365 --- /dev/null +++ b/modules/home/desktop/hyprland/hyprlock.nix @@ -0,0 +1,42 @@ +{ inputs, config, ... }: + +{ + imports = [ + inputs.hyprlock.homeManagerModules.default + ]; + + programs.hyprlock = { + enable = true; + backgrounds = [ + { + monitor = ""; + path = "$HOME/Pictures/wallpaper-2.png"; + blur_passes = 1; + } + ]; + input-fields = [{ + monitor = ""; + size = { + width = 400; + }; + fade_on_empty = false; + dots_size = 0.3; + dots_center = true; + outline_thickness = -1; + outer_color = "0xff${config.colorScheme.palette.base05}"; + inner_color = "0xff${config.colorScheme.palette.base00}"; + font_color = "0xff${config.colorScheme.palette.base05}"; + placeholder_text = "Press enter for fingerprint"; + position.x = 0; + position.y = -50; + }]; + labels = [{ + font_size = 80; + color = "0xff${config.colorScheme.palette.base06}"; + position.x = 0; + position.y = 250; + font_family = "DejaVuSansM Nerd Font Mono"; + text = "$TIME"; + }]; + }; +} diff --git a/modules/home/desktop/hyprland/hyprpaper.nix b/modules/home/desktop/hyprland/hyprpaper.nix new file mode 100644 index 0000000..47c09f3 --- /dev/null +++ b/modules/home/desktop/hyprland/hyprpaper.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ + hyprpaper + ]; + + home.file.".config/hypr/hyprpaper.conf" = { + enable = true; + executable = false; + text ='' + preload = ~/Pictures/wallpaper.png + preload = ~/Pictures/wallpaper-1.png + preload = ~/Pictures/wallpaper-2.png + + wallpaper = eDP-1,~/Pictures/wallpaper-2.png + ipc = off + ''; + }; +} diff --git a/modules/home/desktop/hyprland/waybar.nix b/modules/home/desktop/hyprland/waybar.nix new file mode 100644 index 0000000..653005b --- /dev/null +++ b/modules/home/desktop/hyprland/waybar.nix @@ -0,0 +1,142 @@ +{ ... }: + +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 32; + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ + "tray" + "pulseaudio" + "battery" + ]; + + # Modules left + "hyprland/workspaces" = { + "format" = "{icon}"; + "on-scroll-up" = "hyprctl dispatch workspace e+1"; + "on-scroll-down" = "hyprctl dispatch workspace e-1"; + "on-click" = "activate"; + "persistent-workspaces" = { + "1" = []; + "2" = []; + "3" = []; + "4" = []; + "5" = []; + "6" = []; + "7" = []; + "8" = []; + }; + "format-icons" = { + "default" = ""; + "empty" = ""; + "active" = ""; + }; + }; + "hyprland/window" = { + "max-length" = 200; + "seperate-outputs" = true; + }; + + # Modules middle + "clock" = { + "interval" = 1; + "format" = "{:%a %d %b | %H:%M:%S}"; + }; + + # Modules right + "tray" = { + "spacing" = 10; + "icon-size" = 21; + }; + + "battery" = { + "bat" = "BAT1"; + "interval" = 60; + "states" = { + "warning" = 30; + "critical" = 15; + }; + "format" = "{icon} {capacity}%"; + "format-icons" = [ "" "" "" "" "" ]; + }; + "pulseaudio" = { + "format" = "{icon} {volume}%"; + "format-bluetooth" = "{volume}% {icon}"; + "format-muted" = "󰝟"; + "format-icons" = { + "headphone" = ""; + "hands-free" = ""; + "headset" = ""; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = ["" ""]; + }; + "scroll-step" = 1; + "on-click" = "pavucontrol"; + "ignored-sinks" = ["Easy Effects Sink"]; + }; + }; + }; + style = '' + * { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: DejaVuSansM Nerd Font; + } + + #workspaces,#window,#clock,#battery,#tray,#pulseaudio { + background-color: @theme_bg_color; + border-radius: 50px; + padding: 0px 15px; + margin: 5px 3px 0px 3px; + } + + #workspaces { + margin-left: 10px; + padding: 0px 5px; + font-size: 15px; + } + + window#waybar.empty #window { + background-color: transparent; + } + + window#waybar { + background-color: transparent; + font-size: 12px; + } + + #workspaces button.active { + color: @theme_text_color; + } + + #workspaces button { + color: shade(@theme_text_color, 0.5); + padding: 2px 5px; + } + + #battery { + margin-right: 10px; + } + + #battery.warning { + background-color: #ff8000; + } + + #battery.critical { + background-color: #f00; + } + ''; + }; +} diff --git a/modules/home/programs/common.nix b/modules/home/programs/common.nix new file mode 100644 index 0000000..e391381 --- /dev/null +++ b/modules/home/programs/common.nix @@ -0,0 +1,8 @@ +{ pkgs, ...}: + +{ + home.packages = with pkgs; [ + libreoffice + onlyoffice-bin + ]; +} diff --git a/modules/home/programs/firefox.nix b/modules/home/programs/firefox.nix new file mode 100644 index 0000000..1afbbb9 --- /dev/null +++ b/modules/home/programs/firefox.nix @@ -0,0 +1,83 @@ +{ inputs, pkgs, ... }: + +{ + programs.firefox = { + enable = true; + profiles.xeovalyte = { + search.engines = { + "Nix" = { + urls = [{ + template = "https://mynixos.com/search"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@nix" ]; + }; + + "SearXNG" = { + urls = [{ + template = "https:/search.xeovalyte.dev/search"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + + definedAliases = [ "@searxng" ]; + }; + + "Startpage" = { + urls = [{ + template = "https:/startpage.com/sp/search"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + + definedAliases = [ "@sp" ]; + }; + + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; + "eBay".metaData.hidden = true; + }; + search.force = true; + search.default = "SearXNG"; + + settings = { + "browser.disableResetPrompt" = true; + "browser.download.panel.shown" = true; + "browser.download.useDownloadDir" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + "browser.shell.checkDefaultBrowser" = false; + "browser.shell.defaultBrowserCheckCount" = 1; + "dom.security.https_only_mode" = true; + "privacy.trackingProtection.enabled" = true; + "browser.toolbars.bookmarks.visibility" = "never"; + "browser.translations.neverTranslateLanguages" = "nl"; + "browser.newtabpage.pinned" = [ + { + label = "Server"; + url = "https://home.xeovalyte.dev"; + } + { + label = "Youtube"; + url = "https://youtube.com"; + } + { + label = "Schoolportaal"; + url = "https://coenecoopcollege.sharepoint.com/"; + } + ]; + "signon.rememberSignons" = false; + }; + + extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ + bitwarden + ublock-origin + ]; + }; + }; +} diff --git a/modules/home/programs/git.nix b/modules/home/programs/git.nix new file mode 100644 index 0000000..0080aaf --- /dev/null +++ b/modules/home/programs/git.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: + +{ + home.packages = with pkgs; [ + lazygit + ]; + + programs.git = { + enable = true; + userEmail = "me+gitea@xeovalyte.dev"; + userName = "xeovalyte"; + extraConfig = { + commit.gpgsign = true; + gpg.format = "ssh"; + user.signingkey = "~/.ssh/gitea.pub"; + }; + }; +} diff --git a/modules/home/programs/kitty.nix b/modules/home/programs/kitty.nix new file mode 100644 index 0000000..f646560 --- /dev/null +++ b/modules/home/programs/kitty.nix @@ -0,0 +1,13 @@ +{ pkgs, config, ... }: + +{ + programs.kitty = { + enable = true; + settings = { + foreground = "#${config.colorScheme.palette.base05}"; + background = "#${config.colorScheme.palette.base00}"; + background_opacity = "0.6"; + font_family = "DejaVuSansM Nerd Font Mono"; + }; + }; +} diff --git a/modules/home/programs/modrinth.nix b/modules/home/programs/modrinth.nix new file mode 100644 index 0000000..1990fe1 --- /dev/null +++ b/modules/home/programs/modrinth.nix @@ -0,0 +1,12 @@ +{ inputs, pkgs, ... }: + +{ + nix.settings = { + substituters = ["https://getchoo.cachix.org"]; + trusted-public-keys = ["getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE="]; + }; + + home.packages = with inputs.getchoo.packages.${pkgs.system}; [ + modrinth-app + ]; +} diff --git a/modules/home/programs/neovim/autocmd.lua b/modules/home/programs/neovim/autocmd.lua new file mode 100644 index 0000000..1ea5e7d --- /dev/null +++ b/modules/home/programs/neovim/autocmd.lua @@ -0,0 +1,11 @@ +local api = vim.api + +api.nvim_create_autocmd( + "FileType", + { pattern = "markdown", command = "setlocal spell" } +) + +api.nvim_create_autocmd( + "FileType", + { pattern = "markdown", command = "setlocal complete+=kspell" } +) diff --git a/modules/home/programs/neovim/colorscheme.lua b/modules/home/programs/neovim/colorscheme.lua new file mode 100644 index 0000000..bf480e1 --- /dev/null +++ b/modules/home/programs/neovim/colorscheme.lua @@ -0,0 +1,4 @@ +require('onedark').setup { + style = 'deep' +} +require('onedark').load() diff --git a/modules/home/programs/neovim/default.nix b/modules/home/programs/neovim/default.nix new file mode 100644 index 0000000..31826c0 --- /dev/null +++ b/modules/home/programs/neovim/default.nix @@ -0,0 +1,126 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + home.packages = with pkgs; [ + ripgrep + marksman + wl-clipboard + ]; + + programs.neovim = + let + toLua = str: "lua << EOF\n${str}\nEOF\n"; + toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; + in + { + enable = true; + coc = { + enable = false; + settings = { + languageserver = { + arduino = { + command = ["steam-run" "arduino-language-server"]; + rootPatterns = ["*.ino"]; + filetypes = ["arduino"]; + args = ["-cli" "steam-run" "arduino-cli" "-clangd" "steam-run" "clangd" "-cli-config" "/home/xeovalyte/.arduino15/arduino-cli.yaml"]; + }; + }; + }; + }; + + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + extraLuaConfig = '' + ${builtins.readFile ./options.lua} + ${builtins.readFile ./keymaps.lua} + ${builtins.readFile ./autocmd.lua} + ''; + + plugins = with pkgs.vimPlugins; [ + nvim-web-devicons + + { + plugin = nvim-autopairs; + config = toLua "require(\"nvim-autopairs\").setup{}"; + } + + { + plugin = telescope-nvim; + } + plenary-nvim + + { + plugin = nvim-lspconfig; + config = toLuaFile ./plugins/lsp.lua; + } + neodev-nvim + mason-nvim + mason-lspconfig-nvim + which-key-nvim + rustaceanvim + lsp-inlayhints-nvim + nvim-dap + + { + plugin = markdown-preview-nvim; + config = toLuaFile ./plugins/markdown-preview.lua; + } + + { + plugin = nvim-cmp; + config = toLuaFile ./plugins/cmp.lua; + } + cmp_luasnip + cmp-nvim-lsp + luasnip + friendly-snippets + + { + plugin = nvim-tree-lua; + config = toLuaFile ./plugins/nvim-tree.lua; + } + + { + plugin = toggleterm-nvim; + config = toLuaFile ./plugins/toggleterm.lua; + } + + { + plugin = (nvim-treesitter.withPlugins (p: [ + p.tree-sitter-nix + p.tree-sitter-bash + p.tree-sitter-json + p.tree-sitter-rust + p.tree-sitter-vue + p.tree-sitter-arduino + p.tree-sitter-html + p.tree-sitter-css + p.tree-sitter-javascript + ])); + config = toLuaFile ./plugins/treesitter.lua; + } + + { + plugin = onedark-nvim; + config = toLuaFile ./colorscheme.lua; + } + + { + plugin = presence-nvim; + config = toLua "require(\"presence\").setup()"; + } + + { + plugin = bufferline-nvim; + config = toLuaFile ./plugins/bufferline.lua; + } + ]; + }; +} diff --git a/modules/home/programs/neovim/keymaps.lua b/modules/home/programs/neovim/keymaps.lua new file mode 100644 index 0000000..6ee9be0 --- /dev/null +++ b/modules/home/programs/neovim/keymaps.lua @@ -0,0 +1,90 @@ +local function map(mode, lhs, rhs, opts) + opts = opts or {} + opts.silent = opts.silent ~= false + if opts.remap and not vim.g.vscode then + opts.remap = nil + end + vim.keymap.set(mode, lhs, rhs, opts) +end + +-- better up/down +map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) + +-- Move to window using the hjkl keys +map("n", "", "h", { desc = "Go to left window", remap = true }) +map("n", "", "j", { desc = "Go to lower window", remap = true }) +map("n", "", "k", { desc = "Go to upper window", remap = true }) +map("n", "", "l", { desc = "Go to right window", remap = true }) + +-- Resize window using arrow keys +map("n", "", "resize +2", { desc = "Increase window height" }) +map("n", "", "resize -2", { desc = "Decrease window height" }) +map("n", "", "vertical resize -2", { desc = "Decrease window width" }) +map("n", "", "vertical resize +2", { desc = "Increase window width" }) + +-- Move Lines +map("n", "", "m .+1==", { desc = "Move down" }) +map("n", "", "m .-2==", { desc = "Move up" }) +map("i", "", "m .+1==gi", { desc = "Move down" }) +map("i", "", "m .-2==gi", { desc = "Move up" }) +map("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) + +-- Clear search with +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) + +-- Clear search, diff update and redraw +-- taken from runtime/lua/_editor.lua +map( + "n", + "ur", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / clear hlsearch / diff update" } +) + +-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n +map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" }) +map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) +map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) + +-- Add undo break-points +map("i", ",", ",u") +map("i", ".", ".u") +map("i", ";", ";u") + +-- save file +map({ "i", "x", "n", "s" }, "", "w", { desc = "Save file" }) + +--keywordprg +map("n", "K", "norm! K", { desc = "Keywordprg" }) + +-- better indenting +map("v", "<", "", ">gv") + +-- new file +map("n", "fn", "enew", { desc = "New File" }) + +-- Toggle NeoTree +map("n", "e", "NvimTreeToggle", { desc = "Toggle file explorer" }) + +-- Telescope +map("n", "ff", "Telescope find_files", { desc = "Telescope find files" }) +map("n", "fg", "Telescope live_grep", { desc = "Telescope find files" }) +map("n", "fb", "Telescope buffers", { desc = "Telescope find files" }) + +-- LSP +map("n", "gl", "lua vim.diagnostic.open_float()", { desc = "Show diagnostics" }) +map("n", "gd", "lua vim.lsp.buf.definition()", { desc = "Show diagnostics" }) +map("n", "gD", "lua vim.lsp.buf.declaration()", { desc = "Show diagnostics" }) +map("n", "K", "lua vim.lsp.buf.hover()", { desc = "Show diagnostics" }) + +-- Buffers +map("n", "", "bn", { desc = "Cycle to next buffer" }) +map("n", "", "bp", { desc = "Cycle to previous buffer" }) +map("n", "bq", "b#|bd#", { desc = "Close current buffer" }) +map("n", "bq", "BufferLineCloseOthers", { desc = "Close all other buffers" }) diff --git a/modules/home/programs/neovim/options.lua b/modules/home/programs/neovim/options.lua new file mode 100644 index 0000000..7aaad15 --- /dev/null +++ b/modules/home/programs/neovim/options.lua @@ -0,0 +1,57 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +local opt = vim.opt + +opt.autowrite = true -- Enable auto write +opt.clipboard = "unnamedplus" -- Sync with system clipboard +opt.completeopt = "menu,menuone,noselect" +opt.conceallevel = 3 -- Hide * markup for bold and italic +opt.confirm = true -- Confirm to save changes before exiting modified buffer +opt.cursorline = true -- Enable highlighting of the current line +opt.expandtab = true -- Use spaces instead of tabs +opt.formatoptions = "jcroqlnt" -- tcqj +opt.grepformat = "%f:%l:%c:%m" +opt.grepprg = "rg --vimgrep" +opt.ignorecase = true -- Ignore case +opt.inccommand = "nosplit" -- preview incremental substitute +opt.laststatus = 0 +opt.list = true -- Show some invisible characters (tabs... +opt.mouse = "a" -- Enable mouse mode +opt.number = true -- Print line number +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup +opt.relativenumber = true -- Relative line numbers +opt.scrolloff = 4 -- Lines of context +opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent +opt.shortmess:append({ W = true, I = true, c = true }) +opt.showmode = false -- Dont show mode since we have a statusline +opt.sidescrolloff = 8 -- Columns of context +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.smartcase = true -- Don't ignore case with capitals +opt.smartindent = true -- Insert indents automatically +opt.spelllang = { "en", "nl" } +opt.spell = false -- Enable spell +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current +opt.tabstop = 2 -- Number of spaces tabs count for +opt.termguicolors = true -- True color support +opt.timeoutlen = 300 +opt.undofile = true +opt.undolevels = 10000 +opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.wildmode = "longest:full,full" -- Command-line completion mode +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap + +if vim.fn.has("nvim-0.9.0") == 1 then + opt.splitkeep = "screen" + opt.shortmess:append({ C = true }) +end + +-- Fix markdown indentation settings +vim.g.markdown_recommended_style = 0 + +vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] diff --git a/modules/home/programs/neovim/plugins/bufferline.lua b/modules/home/programs/neovim/plugins/bufferline.lua new file mode 100644 index 0000000..0a53ed3 --- /dev/null +++ b/modules/home/programs/neovim/plugins/bufferline.lua @@ -0,0 +1,12 @@ +require('bufferline').setup{ + options = { + offsets = { + { + filetype = "NvimTree", + text = "File Explorer", + highlight = "Directory", + separator = true -- use a "true" to enable the default, or set your own character + } + } + } +} diff --git a/modules/home/programs/neovim/plugins/cmp.lua b/modules/home/programs/neovim/plugins/cmp.lua new file mode 100644 index 0000000..cf2b7a7 --- /dev/null +++ b/modules/home/programs/neovim/plugins/cmp.lua @@ -0,0 +1,46 @@ +local cmp = require('cmp') +local luasnip = require('luasnip') + +require('luasnip.loaders.from_vscode').lazy_load() +luasnip.config.setup {} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} diff --git a/modules/home/programs/neovim/plugins/lsp.lua b/modules/home/programs/neovim/plugins/lsp.lua new file mode 100644 index 0000000..3867e31 --- /dev/null +++ b/modules/home/programs/neovim/plugins/lsp.lua @@ -0,0 +1,42 @@ +require("mason").setup{ + PATH = "append", +} +require("mason-lspconfig").setup() +require('neodev').setup() + +local lspconfig = require('lspconfig') + +vim.g.rustaceanvim = { + inlay_hints = { + highlight = "NonText", + }, + tools = { + hover_actions = { + auto_focus = true, + }, + }, + server = { + on_attach = function(client, bufnr) + require("lsp-inlayhints").on_attach(client, bufnr) + end, + }, +} + +lspconfig.tsserver.setup{} + +lspconfig.spyglassmc_language_server.setup{} + +lspconfig.arduino_language_server.setup{ + cmd = { + "steam-run","arduino-language-server", + "-cli-config", "/home/xeovalyte/.arduino15/arduino-cli.yaml", + "-cli", "/usr/bin/arduino-cli", + "-clangd", "steam-run clangd" + } +} + +lspconfig.tailwindcss.setup{} + +lspconfig.volar.setup{} + +lspconfig.marksman.setup{} diff --git a/modules/home/programs/neovim/plugins/markdown-preview.lua b/modules/home/programs/neovim/plugins/markdown-preview.lua new file mode 100644 index 0000000..5004380 --- /dev/null +++ b/modules/home/programs/neovim/plugins/markdown-preview.lua @@ -0,0 +1,2 @@ +vim.g.mkdp_auto_start = 0 +vim.g.mkdp_auto_close = 0 diff --git a/modules/home/programs/neovim/plugins/nvim-tree.lua b/modules/home/programs/neovim/plugins/nvim-tree.lua new file mode 100644 index 0000000..6314204 --- /dev/null +++ b/modules/home/programs/neovim/plugins/nvim-tree.lua @@ -0,0 +1,20 @@ +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '', api.tree.change_root_to_parent, opts('Up')) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) + vim.keymap.set('n', '.', api.tree.change_root_to_node, opts('CD')) +end + +-- pass to setup along with your other options +require("nvim-tree").setup { + on_attach = my_on_attach, +} diff --git a/modules/home/programs/neovim/plugins/toggleterm.lua b/modules/home/programs/neovim/plugins/toggleterm.lua new file mode 100644 index 0000000..c5fa966 --- /dev/null +++ b/modules/home/programs/neovim/plugins/toggleterm.lua @@ -0,0 +1,7 @@ +require("toggleterm").setup{ + open_mapping = [[]], + direction = 'float', + float_opts = { + border = 'curved' + } +} diff --git a/modules/home/programs/neovim/plugins/treesitter.lua b/modules/home/programs/neovim/plugins/treesitter.lua new file mode 100644 index 0000000..1c1ab24 --- /dev/null +++ b/modules/home/programs/neovim/plugins/treesitter.lua @@ -0,0 +1,9 @@ +require("nvim-treesitter.configs").setup{ + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, +} diff --git a/modules/home/programs/ssh.nix b/modules/home/programs/ssh.nix new file mode 100644 index 0000000..9123910 --- /dev/null +++ b/modules/home/programs/ssh.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: + +{ + programs.ssh = { + enable = true; + matchBlocks = { + archserver = { + hostname = "192.168.1.20"; + user = "xeovalyte"; + identityFile = "~/.ssh/archserver"; + }; + + gitea = { + hostname = "gitea.xeovalyte.dev"; + port = 2222; + user = "git"; + identityFile = "~/.ssh/gitea"; + }; + }; + }; +} diff --git a/modules/home/theme/README.md b/modules/home/theme/README.md new file mode 100644 index 0000000..0a0b843 --- /dev/null +++ b/modules/home/theme/README.md @@ -0,0 +1,2 @@ +# Base16 themes +https://tinted-theming.github.io/base16-gallery/ diff --git a/modules/home/theme/blueish.nix b/modules/home/theme/blueish.nix new file mode 100644 index 0000000..f6246e7 --- /dev/null +++ b/modules/home/theme/blueish.nix @@ -0,0 +1,9 @@ +{ nix-colors, ... }: + +{ + imports = [ + nix-colors.homeManagerModules.default + ]; + + colorScheme = nix-colors.colorSchemes.da-one-sea; +} diff --git a/modules/home/theme/default.nix b/modules/home/theme/default.nix new file mode 100644 index 0000000..0901384 --- /dev/null +++ b/modules/home/theme/default.nix @@ -0,0 +1,35 @@ +{ config, nix-colors, pkgs, lib, ... }: +let + inherit + (nix-colors.lib-contrib { inherit pkgs; }) + gtkThemeFromScheme; +in +{ + gtk = { + enable = true; + theme = { + name = "${config.colorScheme.slug}"; + package = gtkThemeFromScheme { scheme = config.colorScheme; }; + }; + iconTheme = { + package = pkgs.qogir-icon-theme; + name = "Qogir-dark"; + }; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + style = { + name = "gtk2"; + package = pkgs.qt6Packages.qt6gtk2; + }; + }; + + home.pointerCursor = { + package = pkgs.phinger-cursors; + name = "phinger-cursors"; + size = 24; + gtk.enable = true; + }; +} diff --git a/modules/home/utils/fonts.nix b/modules/home/utils/fonts.nix new file mode 100644 index 0000000..97233c1 --- /dev/null +++ b/modules/home/utils/fonts.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: + +{ + fonts.fontconfig.enable = true; + + home.packages = with pkgs; [ + noto-fonts + fira-code + font-awesome + (nerdfonts.override { fonts = [ "DejaVuSansMono" ]; }) + ]; +} diff --git a/modules/system/desktop/hyprland.nix b/modules/system/desktop/hyprland.nix new file mode 100644 index 0000000..3d29223 --- /dev/null +++ b/modules/system/desktop/hyprland.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + # Configure display manager + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --time --cmd Hyprland"; + user = "xeovalyte"; + }; + }; + }; + + # Configure networking + networking.networkmanager.enable = true; + networking.wireless.iwd.enable = true; +} diff --git a/modules/system/programs/syncthing.nix b/modules/system/programs/syncthing.nix new file mode 100644 index 0000000..d1639f4 --- /dev/null +++ b/modules/system/programs/syncthing.nix @@ -0,0 +1,34 @@ +{ ... }: + +{ + services.syncthing = { + enable = true; + user = "xeovalyte"; + dataDir = "/home/xeovalyte"; + overrideDevices = true; + overrideFolders = true; + openDefaultPorts = true; + settings = { + devices = { + "xv-server" = { + id = "DYBGKGM-I7JM6NG-EV7EGYY-NZL5WCG-CSDSJCJ-B4Q7AOP-5YVQYAZ-ETLQWA5"; + addresses = [ + "dynamic" + "tcp://ddns.xeovalyte.com:22000" + "quick://ddns.xeovalyte.com:22000" + ]; + }; + }; + folders = { + "xeovalyte-documents" = { # Name of folder in Syncthing, also the folder ID + path = "/home/xeovalyte/Documents"; # Which folder to add to Syncthing + devices = [ "xv-server" ]; # Which devices to share the folder with + }; + "xeovalyte-logseq" = { # Name of folder in Syncthing, also the folder ID + path = "/home/xeovalyte/Logseq"; # Which folder to add to Syncthing + devices = [ "xv-server" ]; # Which devices to share the folder with + }; + }; + }; + }; +} diff --git a/modules/system/programs/thunar.nix b/modules/system/programs/thunar.nix new file mode 100644 index 0000000..f8514d6 --- /dev/null +++ b/modules/system/programs/thunar.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-volman + ]; + }; + + services.gvfs.enable = true; + services.tumbler.enable = true; +} diff --git a/modules/system/utils/common.nix b/modules/system/utils/common.nix new file mode 100644 index 0000000..cf30949 --- /dev/null +++ b/modules/system/utils/common.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + usbutils + neofetch + btop + git + ]; +} diff --git a/modules/system/utils/fprint.nix b/modules/system/utils/fprint.nix new file mode 100644 index 0000000..3ac4f77 --- /dev/null +++ b/modules/system/utils/fprint.nix @@ -0,0 +1,33 @@ +{ lib, pkgs, ... }: + +{ + services.fprintd.enable = true; + + security.pam.services.hyprlock = { + text = '' + auth sufficient pam_unix.so try_first_pass likeauth nullok + auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so + auth include login + ''; + }; + + security.pam.services.greetd = { + text = '' + account required pam_unix.so # unix (order 10900) + + # Authentication management. + auth sufficient pam_unix.so likeauth nullok try_first_pass # unix (order 11600) + auth sufficient /nix/store/bz12s6mba297725i9y35p73lvsic8gd3-fprintd-1.94.2/lib/security/pam_fprintd.so # fprintd (order 11400) + auth required pam_deny.so # deny (order 12400) + + # Password management. + password sufficient pam_unix.so nullok yescrypt # unix (order 10200) + + # Session management. + session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100) + session required pam_unix.so # unix (order 10200) + session required pam_loginuid.so # loginuid (order 10300) + session optional /nix/store/dzp7d4k1d94s1x49p9171mvcsfyxr7bj-systemd-254.6/lib/security/pam_systemd.so # systemd (order 12000) login + ''; + }; +} diff --git a/modules/system/utils/garbage-collection.nix b/modules/system/utils/garbage-collection.nix new file mode 100644 index 0000000..dcf217e --- /dev/null +++ b/modules/system/utils/garbage-collection.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; + + nix.settings.auto-optimise-store = true; +} diff --git a/modules/system/utils/laptop.nix b/modules/system/utils/laptop.nix new file mode 100644 index 0000000..8e256b4 --- /dev/null +++ b/modules/system/utils/laptop.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + services.auto-cpufreq.enable = true; + services.auto-cpufreq.settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "performance"; + turbo = "auto"; + }; + }; + + powerManagement.powertop.enable = true; +} +