diff --git a/flake.lock b/flake.lock index 0faf643..31981ce 100644 --- a/flake.lock +++ b/flake.lock @@ -75,6 +75,52 @@ "type": "github" } }, + "caelestia-cli": { + "inputs": { + "caelestia-shell": [ + "caelestia-shell" + ], + "nixpkgs": [ + "caelestia-shell", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754708376, + "narHash": "sha256-RtOqlQ8i4EFCtPJYT6hX39EEO7sjGzSbO3tKIto/Yw4=", + "owner": "caelestia-dots", + "repo": "cli", + "rev": "9489f0d4f629bfd8751ff55784a9587d54eb40f1", + "type": "github" + }, + "original": { + "owner": "caelestia-dots", + "repo": "cli", + "type": "github" + } + }, + "caelestia-shell": { + "inputs": { + "caelestia-cli": "caelestia-cli", + "nixpkgs": [ + "nixpkgs" + ], + "quickshell": "quickshell" + }, + "locked": { + "lastModified": 1755178159, + "narHash": "sha256-ZmsQ3ZRa6U/5Axw+foMJwZpmsVdjHhat8wnY85UKQ+g=", + "owner": "caelestia-dots", + "repo": "shell", + "rev": "fa39593ca497c27ca8631091a75d883e4e3c46f2", + "type": "github" + }, + "original": { + "owner": "caelestia-dots", + "repo": "shell", + "type": "github" + } + }, "chaotic": { "inputs": { "flake-schemas": "flake-schemas", @@ -173,11 +219,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -449,12 +495,34 @@ "type": "github" } }, + "flake-utils_6": { + "inputs": { + "systems": "systems_10" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghostty": { "inputs": { "flake-compat": "flake-compat_2", "flake-utils": "flake-utils_3", - "nixpkgs-stable": "nixpkgs-stable", - "nixpkgs-unstable": "nixpkgs-unstable", + "nixpkgs-stable": [ + "nixpkgs" + ], + "nixpkgs-unstable": [ + "nixpkgs" + ], "zig": "zig", "zon2nix": "zon2nix" }, @@ -1167,6 +1235,28 @@ "type": "github" } }, + "microvm": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nixpkgs" + ], + "spectrum": "spectrum" + }, + "locked": { + "lastModified": 1755102374, + "narHash": "sha256-v6xhTSgnGQoF1a51BB6OQWN8HXiYbZtVL+54TRuk9zk=", + "owner": "microvm-nix", + "repo": "microvm.nix", + "rev": "0a5cda80e48191959cf5a9c0552532599ef2cee4", + "type": "github" + }, + "original": { + "owner": "microvm-nix", + "repo": "microvm.nix", + "type": "github" + } + }, "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_5", @@ -1253,7 +1343,7 @@ "nix-minecraft": { "inputs": { "flake-compat": "flake-compat_7", - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": "nixpkgs_4" }, "locked": { @@ -1320,22 +1410,6 @@ } }, "nixpkgs-stable": { - "locked": { - "lastModified": 1741992157, - "narHash": "sha256-nlIfTsTrMSksEJc1f7YexXiPVuzD1gOfeN1ggwZyUoc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "da4b122f63095ca1199bd4d526f9e26426697689", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "release-24.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable_2": { "locked": { "lastModified": 1730741070, "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", @@ -1351,22 +1425,6 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1741865919, - "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_10": { "locked": { "lastModified": 1727348695, @@ -1545,7 +1603,7 @@ "lanzaboote", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable_2" + "nixpkgs-stable": "nixpkgs-stable" }, "locked": { "lastModified": 1731363552, @@ -1561,10 +1619,32 @@ "type": "github" } }, + "quickshell": { + "inputs": { + "nixpkgs": [ + "caelestia-shell", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1753595452, + "narHash": "sha256-vqkSDvh7hWhPvNjMjEDV4KbSCv2jyl2Arh73ZXe274k=", + "ref": "refs/heads/master", + "rev": "a5431dd02dc23d9ef1680e67777fed00fe5f7cda", + "revCount": 665, + "type": "git", + "url": "https://git.outfoxxed.me/outfoxxed/quickshell" + }, + "original": { + "type": "git", + "url": "https://git.outfoxxed.me/outfoxxed/quickshell" + } + }, "root": { "inputs": { "Hyprspace": "Hyprspace", "actual-budget-api": "actual-budget-api", + "caelestia-shell": "caelestia-shell", "chaotic": "chaotic", "disko": "disko", "firefox": "firefox", @@ -1576,6 +1656,7 @@ "hyprlock": "hyprlock", "hyprtasking": "hyprtasking", "lanzaboote": "lanzaboote", + "microvm": "microvm", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-index-database": "nix-index-database", "nix-minecraft": "nix-minecraft", @@ -1689,6 +1770,22 @@ "type": "github" } }, + "spectrum": { + "flake": false, + "locked": { + "lastModified": 1754675037, + "narHash": "sha256-afS08F7lfMUBR4qrBxinN1kuxu+DoHQ5TPNVp9VS/OA=", + "ref": "refs/heads/main", + "rev": "586577f3015397afacd83bc185454f4cc3c8028f", + "revCount": 955, + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + }, + "original": { + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + } + }, "swww": { "inputs": { "flake-compat": "flake-compat_8", @@ -1724,6 +1821,21 @@ "type": "github" } }, + "systems_10": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "systems_2": { "locked": { "lastModified": 1681028828, @@ -1908,16 +2020,16 @@ }, "yazi": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_6", "nixpkgs": "nixpkgs_9", "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1755142006, - "narHash": "sha256-3PXLb+3tWkFh+eOe2wrgkxUXA+Ip4EOxoSdBQZGou/o=", + "lastModified": 1755419104, + "narHash": "sha256-X/MltojjlzWUPXk1OT8qDotuV9s8jL+Dp4wx56NUzT4=", "owner": "sxyazi", "repo": "yazi", - "rev": "2ec3a6c645324295331c0f2ef6d4d946cf11c06b", + "rev": "9810196565513aca32bac41471ff4979a2a381ef", "type": "github" }, "original": { @@ -1931,11 +2043,11 @@ "nixpkgs": "nixpkgs_10" }, "locked": { - "lastModified": 1755134816, - "narHash": "sha256-B1MThr/2Hbis2J4gKAvbDedXStxmmWzzOY7upEDG8/4=", + "lastModified": 1755169841, + "narHash": "sha256-wOIetFs4h1p0fcZcHpQndB3Fhm0sa1L+ymGfas8l7hE=", "owner": "dachxy", "repo": "zen-browser-flake", - "rev": "751cad657e9a03e4a1de95b79ca751b8480bb049", + "rev": "24e7380b13aa098484474868763b97f737a51df9", "type": "github" }, "original": { @@ -1959,11 +2071,11 @@ ] }, "locked": { - "lastModified": 1741825901, - "narHash": "sha256-aeopo+aXg5I2IksOPFN79usw7AeimH1+tjfuMzJHFdk=", + "lastModified": 1748261582, + "narHash": "sha256-3i0IL3s18hdDlbsf0/E+5kyPRkZwGPbSFngq5eToiAA=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "0b14285e283f5a747f372fb2931835dd937c4383", + "rev": "aafb1b093fb838f7a02613b719e85ec912914221", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0dd7e9e..f809aff 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,8 @@ ghostty = { url = "github:ghostty-org/ghostty?rev=7f9bb3c0e54f585e11259bc0c9064813d061929c"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + inputs.nixpkgs-unstable.follows = "nixpkgs"; }; yazi = { @@ -96,10 +98,21 @@ url = "github:DACHXY/actual-budget-api"; inputs.nixpkgs.follows = "nixpkgs"; }; + + caelestia-shell = { + url = "github:caelestia-dots/shell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + microvm = { + url = "github:microvm-nix/microvm.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { + self, nixpkgs, nix-index-database, lanzaboote, @@ -110,6 +123,12 @@ system = "x86_64-linux"; nix-version = "25.05"; + pkgs = import nixpkgs { + inherit system; + }; + + inherit (pkgs) lib; + # Declare COMMON modules here common-settings = { modules = [ @@ -124,6 +143,7 @@ inputs system nix-version + self ; }; }; @@ -138,6 +158,58 @@ extra-modules = [ lanzaboote.nixosModules.lanzaboote ./system/dev/dn-pre7780 + + # VM + inputs.microvm.nixosModules.host + { + networking.useNetworkd = true; + systemd.network.enable = true; + systemd.network.networks."10-lan" = { + matchConfig.Name = [ + "enp0s31f6" + "vm-*" + ]; + networkConfig = { + Bridge = "br0"; + }; + }; + + systemd.network.netdevs."br0" = { + netdevConfig = { + Name = "br0"; + Kind = "bridge"; + }; + }; + + systemd.network.networks."10-lan-bridge" = { + matchConfig.Name = "br0"; + networkConfig = { + Address = [ "192.168.0.5/24" ]; + Gateway = "192.168.0.1"; + DNS = [ "192.168.0.1" ]; + }; + + linkConfig.RequiredForOnline = "routable"; + }; + + # microvm.autostart = [ + # "vm-1" + # "vm-2" + # ]; + + microvm.vms = { + vm-1 = { + flake = self; + updateFlake = "git+file:///etc/nixos"; + autostart = false; + }; + vm-2 = { + flake = self; + updateFlake = "git+file:///etc/nixos"; + autostart = false; + }; + }; + } ]; overlays = [ ]; }; @@ -176,60 +248,234 @@ }; in { - nixosConfigurations = builtins.mapAttrs ( - dev: conf: - let - domain = if conf.domain != null then conf.domain else "local"; - inherit (conf) username hostname; - in - nixpkgs.lib.nixosSystem { - modules = [ - { - system.stateVersion = nix-version; - home-manager = { - backupFileExtension = "backup-hm"; - useUserPackages = true; - useGlobalPkgs = true; - extraSpecialArgs = { - inherit - inputs - system - nix-version - devices - username - ; + nixosConfigurations = + (builtins.mapAttrs ( + dev: conf: + let + domain = if conf.domain != null then conf.domain else "local"; + inherit (conf) username hostname; + in + nixpkgs.lib.nixosSystem { + modules = [ + { + system.stateVersion = nix-version; + home-manager = { + backupFileExtension = "backup-hm"; + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { + inherit + inputs + system + nix-version + devices + username + ; + }; + users."${username}" = lib.mkIf (!((conf ? isVM) && (conf.isVM))) { + imports = [ + inputs.hyprland.homeManagerModules.default + inputs.caelestia-shell.homeManagerModules.default + inputs.zen-browser.homeManagerModules.${system}.default + { + home = { + homeDirectory = "/home/${username}"; + stateVersion = nix-version; + }; + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + } + ]; + }; }; - users."${username}" = { - imports = [ - inputs.hyprland.homeManagerModules.default - inputs.zen-browser.homeManagerModules.${system}.default - { - home = { - homeDirectory = "/home/${username}"; - stateVersion = nix-version; + networking = { + inherit domain; + hostName = hostname; + }; + nixpkgs.hostPlatform = system; + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = ((import ./pkgs/overlays) ++ conf.overlays); + } + ] + ++ common-settings.modules + ++ conf.extra-modules; + specialArgs = { + inherit username; + } + // common-settings.args; + } + ) devices) + // + # VM For k8s + ( + let + vmList = + let + kubeMasterIP = "192.168.0.6"; + kubeMasterHostname = "api.kube"; + kubeMasterAPIServerPort = 6443; + kubeApi = "https://${kubeMasterHostname}:${toString kubeMasterAPIServerPort}"; + in + { + # master + vm-1 = { + ip = "192.168.0.6"; + mac = "02:00:00:00:00:01"; + extraConfig = { + networking.extraHosts = "${kubeMasterIP} ${kubeMasterHostname}"; + environment.systemPackages = with pkgs; [ + kompose + kubectl + kubernetes + ]; + + services.kubernetes = { + roles = [ + "master" + "node" + ]; + + masterAddress = kubeMasterHostname; + apiserverAddress = kubeApi; + easyCerts = true; + apiserver = { + securePort = kubeMasterAPIServerPort; + advertiseAddress = kubeMasterIP; + }; + + addons.dns.enable = true; }; - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; + + systemd.services.link-kube-config = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.writeShellScript "link-kube-config.sh" '' + target="/etc/kubernetes/cluster-admin.kubeconfig" + if [ -e "$target" ]; then + [ ! -d "/root/.kube" ] && mkdir -p "/root/.kube" + ln -sf $target /root/.kube/config + fi + ''}"; + }; + }; + }; + }; + # Node + vm-2 = { + ip = "192.168.0.7"; + mac = "02:00:00:00:00:02"; + extraConfig = { + networking.extraHosts = "${kubeMasterIP} ${kubeMasterHostname}"; + + environment.systemPackages = with pkgs; [ + kompose + kubectl + kubernetes + ]; + + services.kubernetes = { + roles = [ "node" ]; + masterAddress = kubeMasterHostname; + easyCerts = true; + + kubelet.kubeconfig.server = kubeApi; + apiserverAddress = kubeApi; + addons.dns.enable = true; + }; + }; + }; + }; + + mkMicrovm = name: value: { + hypervisor = "qemu"; + vcpu = 4; + mem = 8192; + interfaces = [ + { + type = "tap"; + id = "${name}"; + mac = value.mac; + } + ]; + shares = [ + { + tag = "ro-store"; + source = "/nix/store"; + mountPoint = "/nix/.ro-store"; + } + ]; + }; + in + lib.mapAttrs' ( + name: value: + lib.nameValuePair name ( + nixpkgs.lib.nixosSystem ({ + inherit system; + modules = [ + inputs.microvm.nixosModules.microvm + value.extraConfig + { + microvm = mkMicrovm name value; + system.stateVersion = lib.trivial.release; + networking.hostName = name; + networking.domain = "kube"; + networking.firewall.enable = false; + users.users.root.password = ""; + services.getty.autologinUser = "root"; + + programs.fish.enable = true; + programs.bash = { + shellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + + systemd.network.enable = true; + systemd.network.networks."20-lan" = { + matchConfig.Type = "ether"; + networkConfig = { + Address = [ "${value.ip}/24" ]; + Gateway = "192.168.0.1"; + DNS = [ "192.168.0.1" ]; + DHCP = "no"; + }; + }; + + systemd.services.br-netfilter = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "/run/current-system/sw/bin/modprobe br_netfilter"; + }; + }; + + environment.systemPackages = with pkgs; [ + dig.dnsutils + openssl + + fishPlugins.done + fishPlugins.fzf-fish + fishPlugins.forgit + fishPlugins.hydro + fzf + fishPlugins.grc + grc + git + ]; } ]; - }; - }; - networking = { - inherit domain; - hostName = hostname; - }; - nixpkgs.hostPlatform = system; - nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = ((import ./pkgs/overlays) ++ conf.overlays); - } - ] - ++ common-settings.modules - ++ conf.extra-modules; - specialArgs = { - inherit username; - } - // common-settings.args; - } - ) devices; + }) + ) + ) vmList + ); + + packages."${system}" = { + vm-1 = self.nixosConfigurations.vm-1.config.microvm.declaredRunner; + vm-2 = self.nixosConfigurations.vm-2.config.microvm.declaredRunner; + }; }; } diff --git a/home/config/ghostty/config b/home/config/ghostty/config deleted file mode 100644 index ef49530..0000000 --- a/home/config/ghostty/config +++ /dev/null @@ -1,22 +0,0 @@ -font-family = "CaskaydiaCove Nerd Font Mono" -font-size = 15 -theme = Espresso -unfocused-split-opacity = 0.85 -desktop-notifications = false - -wait-after-command = false -shell-integration = detect -window-theme = dark - -confirm-close-surface = false -window-decoration = false - -mouse-hide-while-typing = true - -keybind = ctrl+shift+zero=toggle_tab_overview - -clipboard-read = allow -clipboard-write = allow - -# custom-shader = ./shader/mnoise.glsl -# custom-shader-animation = always diff --git a/home/config/nvim/lua/config/options.lua b/home/config/nvim/lua/config/options.lua index 15eac7c..847759a 100644 --- a/home/config/nvim/lua/config/options.lua +++ b/home/config/nvim/lua/config/options.lua @@ -55,3 +55,5 @@ vim.g.clipboard = { -- To ALWAYS use the clipboard for ALL operations -- (instead of interacting with the "+" and/or "*" registers explicitly): vim.opt.clipboard = "unnamedplus" + +vim.g.gruvbox_material_transparent_background = 2 diff --git a/home/presets/basic.nix b/home/presets/basic.nix index 232ae46..fc2c21a 100644 --- a/home/presets/basic.nix +++ b/home/presets/basic.nix @@ -10,7 +10,8 @@ # ../user/music-production.nix ../user/nvim.nix ../user/packages.nix - ../user/firefox.nix + # ../user/firefox.nix + ../user/zen-browser.nix ../user/shell.nix ../user/tmux.nix ../user/virtualization.nix diff --git a/home/user/caelestia-shell.nix b/home/user/caelestia-shell.nix new file mode 100644 index 0000000..c4b678f --- /dev/null +++ b/home/user/caelestia-shell.nix @@ -0,0 +1,213 @@ +{ + config, + pkgs, + lib, + ... +}: +let + patchPapirus = pkgs.stdenv.mkDerivation { + name = "${pkgs.papirus-icon-theme.name}-patch"; + src = pkgs.papirus-icon-theme; + installPhase = '' + mkdir -p $out/share/icons + ln $src/share/icons/Papirus $out/share/icons/hicolor + ''; + }; + + caelestiaDot = pkgs.fetchFromGitHub { + owner = "caelestia-dots"; + repo = "caelestia"; + rev = "main"; + sha256 = "sha256-pRLcbh81iBp9fH3Zq7HrNtAfDD46ErGZ3wID8Q65Wlg="; + }; +in +{ + home.packages = with pkgs; [ + cliphist + inotify-tools + app2unit + wireplumber + trash-cli + foot + fastfetch + jq + socat + imagemagick + papirus-icon-theme + nerd-fonts.jetbrains-mono + fuzzel + ]; + + xdg.configFile = { + "hypr/hyprland".source = "${caelestiaDot}/hypr/hyprland"; + "hypr/scheme" = { + source = "${caelestiaDot}/hypr/scheme"; + recursive = true; + }; + "hypr/scripts" = { + source = "${caelestiaDot}/hypr/scripts"; + executable = true; + }; + "hypr/variables.conf".source = "${caelestiaDot}/hypr/variables.conf"; + }; + + wayland.windowManager.hyprland = { + settings = { + "$hypr" = "~/.config/hypr"; + "$hl" = "$hypr/hyprland"; + "$cConf" = "~/.config/caelestia"; + # ### Hyprland ### + # Apps + "$terminal" = "ghostty"; + "$browser" = "nvidia-offload zen"; + "$editor" = "nvim"; + "$fileExplorer" = "yazi"; + + # Touchpad + "$touchpadDisableTyping" = "true"; + "$touchpadScrollFactor" = "0.3"; + "$workSpaceSwipeFingers" = "4"; + + # Blur + "$blurEnabled" = "true"; + "$blurSpecialWs" = "false"; + "$blurPopups" = "true"; + "$blurInputMethods" = "true"; + "$blurSize" = "8"; + "$blurPasses" = "2"; + "$blurXray" = "false"; + + # Shadow + "$shadowEnabled" = "true"; + "$shadowRange" = "20"; + "$shadowRenderPower" = "3"; + "$shadowColour" = "rgba($surfaced4)"; + + # Gaps + "$workspaceGaps" = "20"; + "$windowGapsIn" = "10"; + "$windowGapsOut" = "10"; + "$singleWindowGapsOut" = "10"; + + # Window styling + "$windowOpacity" = "0.95"; + "$windowRounding" = "10"; + + "$windowBorderSize" = "3"; + "$activeWindowBorderColour" = "rgba($primarye6)"; + "$inactiveWindowBorderColour" = "rgba($onSurfaceVariant11)"; + + # Misc + "$volumeStep" = "5 # In percent"; + + "$kbGoToWs" = "SUPER"; + "$wsaction" = "~/.config/hypr/scripts/wsaction.fish"; + + source = [ + "$hypr/scheme/current.conf" + "$hl/env.conf" + "$hl/input.conf" + "$hl/misc.conf" + "$hl/animations.conf" + "$hl/decoration.conf" + "$hl/group.conf" + "$hl/rules.conf" + "${pkgs.writeText "keybinds.conf" '' + exec = hyprctl dispatch submap global + submap = global + + # ## Shell keybinds + # Launcher + bind = Super+CTRL, K, global, caelestia:showall + bindi = Super, Super_L, global, caelestia:launcher + bindin = Super, catchall, global, caelestia:launcherInterrupt + bindin = Super, mouse:272, global, caelestia:launcherInterrupt + bindin = Super, mouse:273, global, caelestia:launcherInterrupt + bindin = Super, mouse:274, global, caelestia:launcherInterrupt + bindin = Super, mouse:275, global, caelestia:launcherInterrupt + bindin = Super, mouse:276, global, caelestia:launcherInterrupt + bindin = Super, mouse:277, global, caelestia:launcherInterrupt + bindin = Super, mouse_up, global, caelestia:launcherInterrupt + bindin = Super, mouse_down, global, caelestia:launcherInterrupt + bind = Super, DELETE, global, caelestia:lock + bind = Super, Q, killactive, + bind = Super , RETURN, exec, app2unit -- $terminal + bind = Super, F, exec, app2unit -- $browser + bind = Super, V, togglefloating, + bind = Super, P, pseudo + bind = Super, S, togglesplit + bindl = , XF86AudioPlay, global, caelestia:mediaToggle + bindl = , XF86AudioPause, global, caelestia:mediaToggle + bindl = , XF86AudioNext, global, caelestia:mediaNext + bindl = , XF86AudioPrev, global, caelestia:mediaPrev + bindl = , XF86AudioStop, global, caelestia:mediaStop + + bind = Super+SHIFT, s, global, caelestia:screenshot + bind = CTRL SHIFT, s, exec, hyprshot -m window + bind = CTRL SHIFT Super, s, exec, hyprshot -m output + bind = CTRL ALT, s, exec, hyprshot -m active -m window + + bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + bindle = , XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ $volumeStep%+ + bindle = , XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ $volumeStep%- + + bind = Super, Period, exec, pkill fuzzel || caelestia emoji -p + bind = Super+Shift, V, exec, pkill fuzzel || caelestia clipboard + ''}" + ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + ''SUPER, mouse:272, movewindow'' + ''SUPER, mouse:273, resizewindow'' + ]; + + exec = [ + "cp -L --no-preserve=mode --update=none $hypr/scheme/default.conf $hypr/scheme/current.conf" + ]; + + misc = { + vrr = 0; + vfr = true; + }; + }; + }; + + home.activation.writeConfigFile = + lib.hm.dag.entryAfter [ "writeBoundary" ] + # bash + '' + configList=("btop" "fastfetch" "thunar") + + for config in "''\${configList[@]}"; do + if [ ! -d "$XDG_CONFIG_HOME/$config" ]; then + install -Dm666 "${caelestiaDot}/$config" "$XDG_CONFIG_HOME/$config" + fi + done + ''; + + fonts.fontconfig.enable = true; + + programs.caelestia = { + enable = true; + settings = { }; + cli = { + enable = true; + settings = { }; + }; + }; + + systemd.user.services.caelestia = { + Service = { + ExecStart = lib.mkForce "${pkgs.writeShellScript "caelestia-wrapper" '' + export QT_QPA_PLATFORMTHEME=gtk3 + + ${config.programs.caelestia.package}/bin/caelestia-shell + ''}"; + }; + }; + + services.swww.enable = lib.mkForce false; + programs.waybar.enable = lib.mkForce false; + services.swaync.enable = lib.mkForce false; +} diff --git a/home/user/config.nix b/home/user/config.nix index fc10109..171b2d1 100644 --- a/home/user/config.nix +++ b/home/user/config.nix @@ -1,3 +1,4 @@ +{ ... }: let configDir = ../config; browser = "zen.desktop"; @@ -37,6 +38,8 @@ in "application/pdf" = [ browser ]; "image/jpeg" = [ browser ]; "image/png" = [ browser ]; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; }; }; } diff --git a/home/user/gtk.nix b/home/user/gtk.nix index 1afac68..38ceb6e 100644 --- a/home/user/gtk.nix +++ b/home/user/gtk.nix @@ -26,7 +26,7 @@ in iconTheme = { name = "Papirus-Dark"; - package = pkgs.papirus-folders; + package = pkgs.papirus-icon-theme; }; gtk3 = { @@ -43,29 +43,14 @@ in }; home.packages = with pkgs; [ - libsForQt5.qtstyleplugin-kvantum - libsForQt5.lightly libsForQt5.qt5ct - adwaita-icon-theme gsettings-desktop-schemas glib - (catppuccin-kvantum.override { - accent = "lavender"; - variant = "macchiato"; - }) ]; qt = { enable = true; - style.name = "qt5ct-style"; - style.package = pkgs.catppuccin-kvantum; - platformTheme.name = "qtct"; - }; - - xdg.configFile = { - "Kvantum/catppuccin-macchiato-Lavender/catppuccin-macchiato-lavender/catppuccin-macchiato-lavender.kvconfig".source = - "${pkgs.catppuccin-kvantum}/share/Kvantum/catppuccin-macchiato-lavender/cattpuccin-macchiato-lavender.kvconfig"; - "Kvantum/catppuccin-macchiato-Lavender/catppuccin-macchiato-lavender/catppuccin-macchiato-lavender.svg".source = - "${pkgs.catppuccin-kvantum}/share/Kvantum/catppuccin-macchiato-lavender/cattpuccin-macchiato-lavender.svg"; + style.name = "adwaita-dark"; + platformTheme.name = "gtk3"; }; } diff --git a/home/user/hypr/input.nix b/home/user/hypr/input.nix index 0444f7a..ded6a42 100644 --- a/home/user/hypr/input.nix +++ b/home/user/hypr/input.nix @@ -6,6 +6,9 @@ kb_model = ""; kb_rules = ""; + repeat_delay = 250; + repeat_rate = 35; + follow_mouse = 1; accel_profile = "flat"; @@ -17,6 +20,9 @@ sensitivity = -0.1; # -1.0 - 1.0, 0 means no modification. }; + binds = { + scroll_event_delay = 0; + }; cursor = { no_hardware_cursors = true; diff --git a/home/user/hypr/window.nix b/home/user/hypr/window.nix index 655bef9..a661a93 100644 --- a/home/user/hypr/window.nix +++ b/home/user/hypr/window.nix @@ -10,7 +10,6 @@ "col.active_border" = "rgb(EBDBB2) rgb(24273A) rgb(24273A) rgb(EBDBB2) 45deg"; "col.inactive_border" = "rgb(24273A) rgb(24273A) rgb(24273A) rgb(24273A) 45deg"; layout = "dwindle"; - allow_tearing = false; }; decoration = { diff --git a/home/user/hypr/windowrule.nix b/home/user/hypr/windowrule.nix index 1db4c2a..03b9c00 100644 --- a/home/user/hypr/windowrule.nix +++ b/home/user/hypr/windowrule.nix @@ -34,6 +34,8 @@ in "float, class:^(xdg-desktop-portal-gtk)$" "float, title:^(Steam Settings)$" + "fullscreen, initialClass:^(cs2)$" + "opacity 0.9999 override, initialClass:^(zen)(.*)" # Picture in picture windows diff --git a/home/user/hyprland.nix b/home/user/hyprland.nix index 35f0a4e..c9a70f4 100644 --- a/home/user/hyprland.nix +++ b/home/user/hyprland.nix @@ -4,8 +4,8 @@ { pkgs, lib, - inputs, config, + inputs, system, osConfig, ... @@ -63,16 +63,18 @@ in disable_logs = true; }; - bind = import ./hypr/bind.nix { - inherit - mainMod - pkgs - monitors - config - lib - ; - nvidia-offload-enabled = osConfig.hardware.nvidia.prime.offload.enableOffloadCmd; - }; + bind = ( + import ./hypr/bind.nix { + inherit + mainMod + pkgs + monitors + config + lib + ; + nvidia-offload-enabled = osConfig.hardware.nvidia.prime.offload.enableOffloadCmd; + } + ); bindm = [ # Move/resize windows with mainMod + LMB/RMB and dragging @@ -84,7 +86,7 @@ in let resizeStep = builtins.toString 20; brightnessStep = builtins.toString 10; - volumeStep = builtins.toString 2; + volumeStep = builtins.toString 4; in [ '',XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%+'' @@ -126,6 +128,10 @@ in ]; workspace = (import ./hypr/workspace.nix { inherit monitors; }); + misc = { + disable_hyprland_logo = true; + force_default_wallpaper = 0; + }; } // (import ./hypr/window.nix) // (import ./hypr/windowrule.nix) @@ -145,17 +151,6 @@ in package = inputs.swww.packages.${system}.swww; }; - # === hyprpaper (Disabled) === # - services.hyprpaper = { - enable = false; - settings = { - # preload = wallpapers; - wallpaper = [ ", ~/.config/wallpapers/wall.png" ]; - splash = false; - ipc = "on"; - }; - }; - # === hyprlock === # programs.hyprlock = { enable = true; @@ -329,8 +324,8 @@ in }; }; - # === hyprsunset === # - systemd.user.services.hyprsunset = { + # === sunsetr === # + systemd.user.services.sunsetr = { Install = { WantedBy = [ "graphical-session.target" ]; }; @@ -339,10 +334,9 @@ in Description = "Blue light filter"; }; Service = { - ExecStart = "${pkgs.hyprsunset}/bin/hyprsunset -t 3000k"; + ExecStart = "${pkgs.sunsetr}/bin/sunsetr"; Restart = "always"; RestartSec = 2; - KillSignal = "SIGKILL"; # Hyprsunset seems not handle the SIGTERM signal properly }; }; diff --git a/home/user/quickshell.nix b/home/user/quickshell.nix new file mode 100644 index 0000000..fab454a --- /dev/null +++ b/home/user/quickshell.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + quickshell + ]; + + systemd.user.services.quickshell = { + Unit = { + Description = "Quickshell"; + After = [ "graphical-session.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + type = "exec"; + ExecStart = "${pkgs.quickshell}/bin/quickshell"; + Restart = "on-failure"; + RestartSec = "5s"; + TimeoutStopSec = "5s"; + Environment = [ + "QT_QPA_PLATFORM=wayland" + ]; + + Slice = "session.slice"; + }; + + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; +} diff --git a/home/user/shellAlias.nix b/home/user/shellAlias.nix index a1ce546..e7bf03b 100644 --- a/home/user/shellAlias.nix +++ b/home/user/shellAlias.nix @@ -12,7 +12,6 @@ # Hyprland hyprlog = "grep -v \"arranged\" $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | cat"; - saveEye = "pkill -f hyprsunset && hyprctl dispatch exec 'hyprsunset -t 3300'"; # Systemd Boot setWin = "sudo bootctl set-oneshot auto-windows"; diff --git a/home/user/waybar.nix b/home/user/waybar.nix index 626b9da..982e884 100644 --- a/home/user/waybar.nix +++ b/home/user/waybar.nix @@ -5,6 +5,7 @@ osConfig, config, username, + lib, pkgs, ... }: @@ -44,7 +45,7 @@ in ]; # === waybar === # - systemd.user.services.waybar = { + systemd.user.services.waybar = lib.mkIf config.programs.waybar.enable { Unit = { PartOf = [ "graphical-session.target" ]; After = [ "graphical-session.target" ]; @@ -252,6 +253,8 @@ in "code" ".virt-manager-wrapped" "virt-manager" + "steam_app_*" + "obsidian" ]; }; "custom/cava" = { diff --git a/home/user/yazi.nix b/home/user/yazi.nix index 749ef1b..e26664f 100644 --- a/home/user/yazi.nix +++ b/home/user/yazi.nix @@ -1,17 +1,15 @@ { inputs, - config, system, pkgs, - lib, ... }: let yaziPlugins = pkgs.fetchFromGitHub { owner = "yazi-rs"; repo = "plugins"; - rev = "86d28e4fb4f25f36cc501b8cb0badb37a6b14263"; - hash = "sha256-m/gJTDm0cVkIdcQ1ZJliPqBhNKoCW1FciLkuq7D1mxo="; + rev = "main"; + hash = "sha256-TUS+yXxBOt6tL/zz10k4ezot8IgVg0/2BbS8wPs9KcE="; }; in { @@ -20,10 +18,14 @@ in enable = true; package = inputs.yazi.packages.${system}.default; shellWrapperName = "y"; - enableFishIntegration = false; + enableFishIntegration = true; plugins = { - toggle-panel = ''${yaziPlugins}/toggle-panel.yazi''; + toggle-pane = ''${yaziPlugins}/toggle-pane.yazi''; + mount = ''${yaziPlugins}/mount.yazi''; + zoom = ''${yaziPlugins}/zoom''; + vcs-files = ''${yaziPlugins}/vcs-files''; + git = ''${yaziPlugins}/git''; }; flavors = { @@ -42,9 +44,81 @@ in }; }; + settings = { + plugin.prepend_fetchers = [ + { + id = "git"; + name = "*"; + run = "git"; + } + { + id = "git"; + name = "*/"; + run = "git"; + } + ]; + + input = { + cursor_blink = true; + }; + + opener = { + edit = [ + { + run = ''''\${EDITOR:=nvim} "$@"''; + desc = "$EDITOR"; + block = true; + } + { + run = ''code "$@"''; + orphan = true; + } + ]; + + player = [ + { run = ''mpv --force-window "$@"''; } + ]; + }; + }; + keymap = { mgr = { prepend_keymap = [ + # Git Changes + { + on = [ + "g" + "c" + ]; + run = "plugin vcs-files"; + desc = "Show Git file changes"; + } + # Image zoom + { + on = "+"; + run = "plugin zoom 1"; + desc = "Zoom in hovered file"; + } + { + on = "-"; + run = "plugin zoom -1"; + desc = "Zoom out hovered file"; + } + # Mount Manager + { + on = "M"; + run = "plugin mount"; + desc = "Launch mount manager"; + # Usage + # Key binding Alternate key Action + # q - Quit the plugin + # k ↑ Move up + # j ↓ Move down + # l → Enter the mount point + # m - Mount the partition + # u - Unmount the partition + # e - Eject the disk + } # Toggle Maximize Preview { on = "T"; @@ -66,6 +140,7 @@ in "r" ]; run = ''shell -- ya emit cd "$(git rev-parse --show-toplevel)"''; + desc = "Go to git root"; } # Drag and Drop { @@ -92,16 +167,6 @@ in initLua = # lua '' - -- Show symlink in status bar - Status:children_add(function(self) - local h = self._current.hovered - if h and h.link_to then - return " -> " .. toString(h.link_to) - else - return "" - end - end, 3300, Status.LEFT) - -- Show user/group of files in status bar Status:children_add(function() local h = cx.active.current.hovered @@ -116,14 +181,6 @@ in " ", } end, 500, Status.RIGHT) - - -- Show username and hostname in header - Header:children_add(function() - if ya.target_family() ~= "unix" then - return "" - end - return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue") - end, 500, Header.LEFT) ''; }; }; @@ -131,36 +188,4 @@ in home.packages = with pkgs; [ ueberzugpp ]; - - # xdg.portal = { - # enable = lib.mkForce true; - # extraPortals = [ pkgs.xdg-desktop-portal-termfilechooser ]; - # config = { - # common.default = [ - # "hyprland" - # "gtk" - # ]; - # common = { - # "org.freedesktop.impl.portal.FileChooser" = "termfilechooser"; - # }; - # hyprland.default = [ - # "hyprland" - # "gtk" - # ]; - # hyprland."org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ]; - # }; - # }; - - # xdg.configFile."xdg-desktop-portal-termfilechooser/config" = { - # force = true; - # text = '' - # [filechooser] - # cmd=TERMCMD='${config.programs.ghostty.package}/bin/ghostty --title=file_chooser -e "bash -c ${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh"' - # default_dir=$HOME - # open_mode = suggested - # save_mode = last - # ''; - # }; - - # home.sessionVariables.TERMCMD = "${config.programs.ghostty.package}/bin/ghostty --title=file_chooser"; } diff --git a/home/user/zen-browser.nix b/home/user/zen-browser.nix index a902495..a0b5751 100644 --- a/home/user/zen-browser.nix +++ b/home/user/zen-browser.nix @@ -1,6 +1,15 @@ { + pkgs, ... }: +let + zenNebula = pkgs.fetchFromGitHub { + owner = "justadumbprsn"; + repo = "zen-nebula"; + rev = "main"; + sha256 = "sha256-f4J5ob/apKhxERUSvXE8QHMMsKJCQFRoMSo/Pw4LgTg="; + }; +in { programs.zen-browser = { enable = true; @@ -12,6 +21,8 @@ "zen.view.compact.should-enable-at-startup" = true; "zen.widget.linux.transparency" = true; "zen.view.compact.show-sidebar-and-toolbar-on-hover" = false; + "zen.tabs.vertical.right-side" = true; + "zen.urlbar.behavior" = "float"; "app.update.auto" = false; "app.normandy.first_run" = false; @@ -20,7 +31,7 @@ "browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true; "browser.tabs.allow_transparent_browser" = true; "browser.urlbar.placeholderName" = "Google"; - "browser.urlbar.placeholderName.private" = "private"; + "browser.urlbar.placeholderName.private" = "DuckDuckGo"; "middlemouse.paste" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "font.language.group" = "zh-TW"; @@ -35,7 +46,9 @@ ensureCACertifications = [ ../../system/extra/ca.crt ]; + chrome = zenNebula; }; }; }; + } diff --git a/system/dev/dn-pre7780/default.nix b/system/dev/dn-pre7780/default.nix index 1638980..bbd15dd 100644 --- a/system/dev/dn-pre7780/default.nix +++ b/system/dev/dn-pre7780/default.nix @@ -20,7 +20,8 @@ in } ]; - hardware.nvidia.package = lib.mkForce config.boot.kernelPackages.nvidiaPackages.stable; + hardware.nvidia.package = lib.mkForce config.boot.kernelPackages.nvidiaPackages.latest; + hardware.nvidia.open = lib.mkForce true; imports = [ ./hardware-configuration.nix @@ -58,7 +59,6 @@ in users."${username}" = { imports = [ ../../../home/presets/basic.nix - ../../../home/user/zen-browser.nix # Bitwarden client (import ../../../home/user/bitwarden.nix { @@ -84,61 +84,65 @@ in # waybar (import ../../../home/user/waybar.nix { - settings = [ - # monitor 1 - { - output = "DP-5"; - modules-left = [ - "custom/os" - "hyprland/workspaces" - "clock" - "custom/cava" - "mpris" - ]; - modules-right = ( - [ + settings = + let + id = 5; + in + [ + # monitor 1 + { + output = "DP-${toString id}"; + modules-left = [ + "custom/os" + "hyprland/workspaces" + "clock" + "custom/cava" + "mpris" + ]; + modules-right = ( + [ + "wlr/taskbar" + ] + ++ ( + if config.programs.gamemode.enable then + [ + "custom/gamemode" + ] + else + [ ] + ) + ++ [ + "custom/bitwarden" + "custom/airplay" + "custom/wallRand" + "custom/wireguard" + "custom/recording" + "idle_inhibitor" + "network" + "cpu" + "memory" + "pulseaudio" + "custom/swaync" + ] + ); + } + # monitor 2 + { + output = "DP-${toString (id + 1)}"; + height = 54; + modules-left = [ + "clock" + "mpris" + ]; + modules-right = [ "wlr/taskbar" - ] - ++ ( - if config.programs.gamemode.enable then - [ - "custom/gamemode" - ] - else - [ ] - ) - ++ [ - "custom/bitwarden" - "custom/airplay" - "custom/wallRand" - "custom/wireguard" - "custom/recording" - "idle_inhibitor" - "network" + "temperature" "cpu" "memory" "pulseaudio" - "custom/swaync" - ] - ); - } - # monitor 2 - { - output = "DP-6"; - height = 54; - modules-left = [ - "clock" - "mpris" - ]; - modules-right = [ - "wlr/taskbar" - "temperature" - "cpu" - "memory" - "pulseaudio" - ]; - } - ]; + ]; + } + ]; }) # Hyprland @@ -150,6 +154,10 @@ in ''desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271, 2560x1440@165, 0x0, 1'' ''desc:Acer Technologies XV272U V3 1322131231233, 2560x1440@180, -1440x-600, 1, transform, 1'' ]; + + misc = { + vrr = 0; + }; }; }; } @@ -159,10 +167,34 @@ in inherit username; email = "danny10132024@gmail.com"; }) + + # Cs go + { + home.file.".steam/steam/steamapps/common/Counter-Strike Global Offensive/game/csgo/cfg/autoexec.cfg".text = + '' + fps_max "250" + + # Wheel Jump + bind "mwheeldown" "+jump" + bind "mwheelup" "+jump" + bind "space" "+jump" + + echo "AUTOEXEC LOADED SUCCESSFULLY!" + host_writeconfig + ''; + } ]; }; }; + # Power Management + services.tlp = { + enable = true; + settings = { + INTEL_GPU_MIN_FREQ_ON_AC = 500; + }; + }; + environment.systemPackages = with pkgs; [ rustdesk blender diff --git a/system/modules/airplay.nix b/system/modules/airplay.nix index ede4755..fab2220 100644 --- a/system/modules/airplay.nix +++ b/system/modules/airplay.nix @@ -26,8 +26,8 @@ in systemd.user.services.uxplay = { wantedBy = [ "multi-user.target" ]; - after = [ "networking-online.target" ]; serviceConfig = { + Type = "oneshot"; ExecStart = "${pkgs.uxplay}/bin/uxplay ${ optionalString (hostname != null) "-n ${hostname} -fs -fps 60 -nh" } -p"; diff --git a/system/modules/nvidia.nix b/system/modules/nvidia.nix index 89bf57b..d8b3feb 100644 --- a/system/modules/nvidia.nix +++ b/system/modules/nvidia.nix @@ -101,9 +101,5 @@ lib.checkListOfEnum "Nvidia Prime Mode" validModes [ nvidia-mode ] { GBM_BACKEND = "nvidia-drm"; MOZ_DISABLE_RDD_SANDBOX = 1; OGL_DEDICATED_HW_STATE_PER_CONTEXT = "ENABLE_ROBUST"; - - # If multiple monitors are connected to dGPU & iGPU, - # make sure to put the iGPU first - # AQ_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0"; }; }