From 7dca9569ea4bab8a008ccf9ca0c40512cbd4b58f Mon Sep 17 00:00:00 2001 From: Alex Maldonado Date: Wed, 20 May 2026 09:36:06 -0400 Subject: [PATCH] feat: plasma and vscode declarations --- flake.lock | 70 +++++++++++++- flake.nix | 14 +++ home/alex/default.nix | 2 + home/modules/plasma.nix | 191 +++++++++++++++++++++++++++++++++++++++ home/modules/vscode.nix | 37 ++++++++ justfile | 2 +- modules/core.nix | 4 +- scripts/register-host.py | 1 + 8 files changed, 315 insertions(+), 6 deletions(-) create mode 100644 home/modules/plasma.nix create mode 100644 home/modules/vscode.nix diff --git a/flake.lock b/flake.lock index 8c9f843..f2309d3 100644 --- a/flake.lock +++ b/flake.lock @@ -102,6 +102,27 @@ "type": "github" } }, + "nix4vscode": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1779250527, + "narHash": "sha256-A54o522sMexXgcN1QhcuUIjFi3gLJLMYI0kYbBiK0O8=", + "owner": "nix-community", + "repo": "nix4vscode", + "rev": "a221ff1a127c168e1e5ff4e78478bc8127c1bc72", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix4vscode", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1752077645, @@ -152,11 +173,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1778737229, - "narHash": "sha256-6xWoytx8jFW4PF1GjRm/i/53trbpKGfz6zjzQGBr4cI=", + "lastModified": 1779102034, + "narHash": "sha256-vZJZjLo513IeI8hjzHFc6TDezUd4uCE2Eq4SNO3DNNg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d7a713c0b7e47c908258e71cba7a2d77cc8d71d5", + "rev": "687f05a9184cad4eaf905c48b63649e3a86f5433", "type": "github" }, "original": { @@ -166,11 +187,36 @@ "type": "github" } }, + "plasma-manager": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775856943, + "narHash": "sha256-b7Mp7P+q2Md5AGt4rjHfMcBykzMumFTen10ST++AuTU=", + "owner": "nix-community", + "repo": "plasma-manager", + "rev": "a524a6160e6df89f7673ba293cf7d78b559eb1a5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "plasma-manager", + "type": "github" + } + }, "root": { "inputs": { "globalprotect-openconnect": "globalprotect-openconnect", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_4" + "nix4vscode": "nix4vscode", + "nixpkgs": "nixpkgs_4", + "plasma-manager": "plasma-manager" } }, "rust-analyzer-src": { @@ -222,6 +268,22 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "flake": false, + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 33237b7..a5d6957 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,19 @@ url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect"; + + plasma-manager = { + url = "github:nix-community/plasma-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + + nix4vscode = { + url = "github:nix-community/nix4vscode"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, home-manager, globalprotect-openconnect, ... }@inputs: @@ -30,6 +42,7 @@ useUserPackages = true; users.alex = import ./home/alex; extraSpecialArgs = { inherit inputs; }; + sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ]; }; } ]; @@ -47,6 +60,7 @@ useUserPackages = true; users.alex = import ./home/alex; extraSpecialArgs = { inherit inputs; }; + sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ]; }; } ]; diff --git a/home/alex/default.nix b/home/alex/default.nix index 1f2deee..ab4c4a9 100644 --- a/home/alex/default.nix +++ b/home/alex/default.nix @@ -11,8 +11,10 @@ ../modules/globalprotect.nix ../modules/helix.nix ../modules/pixi.nix + ../modules/plasma.nix ../modules/ssh.nix ../modules/starship.nix + ../modules/vscode.nix ../modules/zsh.nix ./git.nix ./gh.nix diff --git a/home/modules/plasma.nix b/home/modules/plasma.nix new file mode 100644 index 0000000..763689a --- /dev/null +++ b/home/modules/plasma.nix @@ -0,0 +1,191 @@ +{ ... }: { + programs.plasma = { + enable = true; + + # See all options here + # https://nix-community.github.io/plasma-manager/options.xhtml + + kwin.virtualDesktops = { + number = 3; + rows = 1; + }; + + kwin.tiling.padding = 4; + + kscreenlocker = { + timeout = 15; + passwordRequiredDelay = 0; + }; + + session.sessionRestore.restoreOpenApplicationsOnLogin = "startWithEmptySession"; + + input.touchpads = [ + { + name = "VEN_04F3:00 04F3:32AA Touchpad"; + vendorId = "04f3"; + productId = "32aa"; + naturalScroll = true; + pointerSpeed = 0.0; + scrollSpeed = 0.3; + } + ]; + + # At the moment, these are mostly defaults. + shortcuts = { + "KDE Keyboard Layout Switcher"."Switch to Last-Used Keyboard Layout" = "Meta+Alt+L"; + "KDE Keyboard Layout Switcher"."Switch to Next Keyboard Layout" = "Meta+Alt+K"; + kaccess."Toggle Screen Reader On and Off" = "Meta+Alt+S"; + kmix.decrease_microphone_volume = "Microphone Volume Down"; + kmix.decrease_volume = "Volume Down"; + kmix.decrease_volume_small = "Shift+Volume Down"; + kmix.increase_microphone_volume = "Microphone Volume Up"; + kmix.increase_volume = "Volume Up"; + kmix.increase_volume_small = "Shift+Volume Up"; + kmix.mic_mute = ["Microphone Mute" "Meta+Volume Mute"]; + kmix.mute = "Volume Mute"; + ksmserver."Lock Session" = ["Meta+L" "Screensaver"]; + ksmserver."Log Out" = "Ctrl+Alt+Del"; + kwin."Activate Window Demanding Attention" = "Meta+Ctrl+A"; + kwin."Edit Tiles" = "Meta+T"; + kwin.Expose = "Ctrl+F9"; + kwin.ExposeAll = ["Ctrl+F10" "Launch (C)"]; + kwin.ExposeClass = "Ctrl+F7"; + kwin."Grid View" = "Meta+G"; + kwin."Kill Window" = "Meta+Ctrl+Esc"; + kwin.MoveMouseToCenter = "Meta+F6"; + kwin.MoveMouseToFocus = "Meta+F5"; + kwin.Overview = "Meta+W"; + kwin."Show Desktop" = "Meta+D"; + kwin."Switch One Desktop Down" = "Meta+Ctrl+Down"; + kwin."Switch One Desktop Up" = "Meta+Ctrl+Up"; + kwin."Switch One Desktop to the Left" = "Meta+Ctrl+Left"; + kwin."Switch One Desktop to the Right" = "Meta+Ctrl+Right"; + kwin."Switch Window Down" = "Meta+Alt+Down"; + kwin."Switch Window Left" = "Meta+Alt+Left"; + kwin."Switch Window Right" = "Meta+Alt+Right"; + kwin."Switch Window Up" = "Meta+Alt+Up"; + kwin."Switch to Desktop 1" = "Ctrl+F1"; + kwin."Switch to Desktop 2" = "Ctrl+F2"; + kwin."Switch to Desktop 3" = "Ctrl+F3"; + kwin."Switch to Desktop 4" = "Ctrl+F4"; + kwin."Walk Through Windows" = ["Meta+Tab" "Alt+Tab"]; + kwin."Walk Through Windows (Reverse)" = ["Meta+Shift+Tab" "Alt+Shift+Tab"]; + kwin."Walk Through Windows of Current Application" = ["Meta+`" "Alt+`"]; + kwin."Walk Through Windows of Current Application (Reverse)" = ["Meta+~" "Alt+~"]; + kwin."Window Close" = "Alt+F4"; + kwin."Window Maximize" = "Meta+PgUp"; + kwin."Window Minimize" = "Meta+PgDown"; + kwin."Window One Desktop Down" = "Meta+Ctrl+Shift+Down"; + kwin."Window One Desktop Up" = "Meta+Ctrl+Shift+Up"; + kwin."Window One Desktop to the Left" = "Meta+Ctrl+Shift+Left"; + kwin."Window One Desktop to the Right" = "Meta+Ctrl+Shift+Right"; + kwin."Window Operations Menu" = "Alt+F3"; + kwin."Window Quick Tile Bottom" = "Meta+Down"; + kwin."Window Quick Tile Left" = "Meta+Left"; + kwin."Window Quick Tile Right" = "Meta+Right"; + kwin."Window Quick Tile Top" = "Meta+Up"; + kwin."Window to Next Screen" = "Meta+Shift+Right"; + kwin."Window to Previous Screen" = "Meta+Shift+Left"; + kwin.disableInputCapture = "Meta+Shift+Esc"; + kwin.view_actual_size = "Meta+0"; + kwin.view_zoom_in = ["Meta++" "Meta+="]; + kwin.view_zoom_out = "Meta+-"; + mediacontrol.nextmedia = "Media Next"; + mediacontrol.pausemedia = "Media Pause"; + mediacontrol.playpausemedia = "Media Play"; + mediacontrol.previousmedia = "Media Previous"; + mediacontrol.stopmedia = "Media Stop"; + org_kde_powerdevil."Decrease Keyboard Brightness" = "Keyboard Brightness Down"; + org_kde_powerdevil."Decrease Screen Brightness" = "Monitor Brightness Down"; + org_kde_powerdevil."Decrease Screen Brightness Small" = "Shift+Monitor Brightness Down"; + org_kde_powerdevil.Hibernate = "Hibernate"; + org_kde_powerdevil."Increase Keyboard Brightness" = "Keyboard Brightness Up"; + org_kde_powerdevil."Increase Screen Brightness" = "Monitor Brightness Up"; + org_kde_powerdevil."Increase Screen Brightness Small" = "Shift+Monitor Brightness Up"; + org_kde_powerdevil.PowerDown = "Power Down"; + org_kde_powerdevil.PowerOff = "Power Off"; + org_kde_powerdevil.Sleep = "Sleep"; + org_kde_powerdevil."Toggle Keyboard Backlight" = "Keyboard Light On/Off"; + org_kde_powerdevil.powerProfile = ["Battery" "Meta+B"]; + plasmashell."activate application launcher" = ["Meta" "Alt+F1"]; + plasmashell."activate task manager entry 1" = "Meta+1"; + plasmashell."activate task manager entry 2" = "Meta+2"; + plasmashell."activate task manager entry 3" = "Meta+3"; + plasmashell."activate task manager entry 4" = "Meta+4"; + plasmashell."activate task manager entry 5" = "Meta+5"; + plasmashell."activate task manager entry 6" = "Meta+6"; + plasmashell."activate task manager entry 7" = "Meta+7"; + plasmashell."activate task manager entry 8" = "Meta+8"; + plasmashell."activate task manager entry 9" = "Meta+9"; + plasmashell.clipboard_action = "Meta+Ctrl+X"; + plasmashell.cycle-panels = "Meta+Alt+P"; + plasmashell."manage activities" = "Meta+Q"; + plasmashell."next activity" = "Meta+A"; + plasmashell."previous activity" = "Meta+Shift+A"; + plasmashell."show dashboard" = "Ctrl+F12"; + plasmashell.show-on-mouse-pos = "Meta+V"; + }; + + # At the moment, these are mostly defaults. + configFile = { + baloofilerc.General."exclude filters" = "*~,*.part,*.o,*.la,*.lo,*.loT,*.moc,moc_*.cpp,qrc_*.cpp,ui_*.h,cmake_install.cmake,CMakeCache.txt,CTestTestfile.cmake,libtool,config.status,confdefs.h,autom4te,conftest,confstat,Makefile.am,*.gcode,.ninja_deps,.ninja_log,build.ninja,*.csproj,*.m4,*.rej,*.gmo,*.pc,*.omf,*.aux,*.tmp,*.po,*.vm*,*.nvram,*.rcore,*.swp,*.swap,lzo,litmain.sh,*.orig,.histfile.*,.xsession-errors*,*.map,*.so,*.a,*.db,*.qrc,*.ini,*.init,*.img,*.vdi,*.vbox*,vbox.log,*.qcow2,*.vmdk,*.vhd,*.vhdx,*.sql,*.sql.gz,*.ytdl,*.tfstate*,*.class,*.pyc,*.pyo,*.elc,*.qmlc,*.jsc,*.fastq,*.fq,*.gb,*.fasta,*.fna,*.gbff,*.faa,po,CVS,.svn,.git,_darcs,.bzr,.hg,CMakeFiles,CMakeTmp,CMakeTmpQmake,.moc,.obj,.pch,.uic,.npm,.yarn,.yarn-cache,__pycache__,node_modules,node_packages,nbproject,.terraform,.venv,venv,core-dumps,lost+found"; + dolphinrc.DetailsMode.PreviewSize = 22; + dolphinrc.General.DoubleClickViewAction = "open_terminal"; + dolphinrc."KFileDialog Settings"."Places Icons Auto-resize" = false; + dolphinrc."KFileDialog Settings"."Places Icons Static Size" = 22; + dolphinrc.PreviewSettings.Plugins = "appimagethumbnail,audiothumbnail,blenderthumbnail,comicbookthumbnail,cursorthumbnail,djvuthumbnail,ebookthumbnail,exrthumbnail,directorythumbnail,fontthumbnail,imagethumbnail,jpegthumbnail,kraorathumbnail,windowsexethumbnail,windowsimagethumbnail,mobithumbnail,opendocumentthumbnail,gsthumbnail,rawthumbnail,svgthumbnail,ffmpegthumbs"; + katerc.General."Days Meta Infos" = 30; + katerc.General."Save Meta Infos" = true; + katerc.General."Show Full Path in Title" = false; + katerc.General."Show Menu Bar" = true; + katerc.General."Show Status Bar" = true; + katerc.General."Show Tab Bar" = true; + katerc.General."Show Url Nav Bar" = true; + katerc.filetree.editShade = "30,78,103"; + katerc.filetree.listMode = false; + katerc.filetree.middleClickToClose = false; + katerc.filetree.shadingEnabled = true; + katerc.filetree.showCloseButton = false; + katerc.filetree.showFullPathOnRoots = false; + katerc.filetree.showToolbar = true; + katerc.filetree.sortRole = 0; + katerc.filetree.viewShade = "77,46,91"; + kded5rc.Module-browserintegrationreminder.autoload = false; + kded5rc.Module-device_automounter.autoload = false; + kdeglobals.General.XtermApplication = "codium"; + kdeglobals.General.TerminalApplication = "ghostty --gtk-single-instance=true"; + kdeglobals.General.TerminalService = "com.mitchellh.ghostty.desktop"; + kdeglobals.KDE.DndBehavior = "MoveIfSameDevice"; + kdeglobals."KFileDialog Settings"."Allow Expansion" = false; + kdeglobals."KFileDialog Settings"."Automatically select filename extension" = true; + kdeglobals."KFileDialog Settings"."Breadcrumb Navigation" = true; + kdeglobals."KFileDialog Settings"."Decoration position" = 2; + kdeglobals."KFileDialog Settings"."Show Full Path" = false; + kdeglobals."KFileDialog Settings"."Show Inline Previews" = true; + kdeglobals."KFileDialog Settings"."Show Preview" = false; + kdeglobals."KFileDialog Settings"."Show Speedbar" = true; + kdeglobals."KFileDialog Settings"."Show hidden files" = false; + kdeglobals."KFileDialog Settings"."Sort by" = "Name"; + kdeglobals."KFileDialog Settings"."Sort directories first" = true; + kdeglobals."KFileDialog Settings"."Sort hidden files last" = false; + kdeglobals."KFileDialog Settings"."Sort reversed" = false; + kdeglobals."KFileDialog Settings"."Speedbar Width" = 140; + kdeglobals."KFileDialog Settings"."View Style" = "DetailTree"; + kdeglobals.PreviewSettings.EnableRemoteFolderThumbnail = false; + kdeglobals.PreviewSettings.MaximumRemoteSize = 0; + kdeglobals.WM.activeBackground = "39,44,49"; + kdeglobals.WM.activeBlend = "252,252,252"; + kdeglobals.WM.activeForeground = "252,252,252"; + kdeglobals.WM.inactiveBackground = "32,36,40"; + kdeglobals.WM.inactiveBlend = "161,169,177"; + kdeglobals.WM.inactiveForeground = "161,169,177"; + kiorc.Confirmations.ConfirmDelete = true; + kiorc.Confirmations.ConfirmEmptyTrash = true; + kiorc.Confirmations.ConfirmTrash = false; + kiorc."Executable scripts".behaviourOnLaunch = "alwaysAsk"; + kwalletrc.Wallet."First Use" = false; + kwinrc.Effect-overview.BorderActivate = 9; + kwinrc.Input.TabletMode = "off"; + }; + }; +} diff --git a/home/modules/vscode.nix b/home/modules/vscode.nix new file mode 100644 index 0000000..9519b80 --- /dev/null +++ b/home/modules/vscode.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: { + programs.vscode = { + enable = true; + package = pkgs.vscodium; + + profiles.default = { + extensions = (with pkgs.vscode-extensions; [ + charliermarsh.ruff + eamodio.gitlens + editorconfig.editorconfig + gruntfuggly.todo-tree + hediet.vscode-drawio + jnoortheen.nix-ide + mechatroner.rainbow-csv + ms-toolsai.jupyter + ms-python.python + ms-vscode-remote.remote-ssh + myriad-dreamin.tinymist + rust-lang.rust-analyzer + timonwong.shellcheck + unifiedjs.vscode-mdx + yzane.markdown-pdf + ]) ++ pkgs.nix4vscode.forOpenVsx [ + "akamud.vscode-theme-onedark" + "astral-sh.ty" + "modular-mojotools.vscode-mojo" + ]; + + userSettings = { + "editor.fontFamily" = "'JetBrains Mono', monospace"; + "editor.fontSize" = 14; + "editor.formatOnSave" = true; + "workbench.colorTheme" = "One Dark Pro"; + }; + }; + }; +} diff --git a/justfile b/justfile index 9388b8d..7cdc033 100644 --- a/justfile +++ b/justfile @@ -15,7 +15,7 @@ update: nix flake update # Clean up old generations and optimize store, then bake the result for next boot -gc: +clean: sudo nix-collect-garbage --delete-older-than 14d sudo nix-store --optimise sudo nixos-rebuild boot --flake .#{{host}} diff --git a/modules/core.nix b/modules/core.nix index 963ad4f..080f7b0 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ inputs, pkgs, ... }: { nix.settings.experimental-features = [ "nix-command" "flakes" ]; nixpkgs.config.allowUnfree = true; @@ -17,4 +17,6 @@ exfatprogs parted ]; + + nixpkgs.overlays = [ inputs.nix4vscode.overlays.default ]; } diff --git a/scripts/register-host.py b/scripts/register-host.py index 8637220..acc27bc 100755 --- a/scripts/register-host.py +++ b/scripts/register-host.py @@ -231,6 +231,7 @@ def add_to_flake(flake_path: Path, name: str, *, template_host: str | None = Non f"{indent} useUserPackages = true;\n" f"{indent} users.alex = import ./home/alex;\n" f"{indent} extraSpecialArgs = {{ inherit inputs; }};\n" + f"{indent} sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ];\n" f"{indent} }};\n" f"{indent} }}\n" f"{indent} ];\n"