diff --git a/boxes/desktop/configuration.nix b/boxes/desktop/configuration.nix index 5283a06..8ae15c5 100644 --- a/boxes/desktop/configuration.nix +++ b/boxes/desktop/configuration.nix @@ -2,23 +2,27 @@ # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ config, pkgs, inputs, ... }: { - imports = - [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ../../common/systemModules/boot.nix - ../../common/systemModules/audio.nix - ../../common/systemModules/kde.nix - ../../common/systemModules/tailscale.nix - ../../common/systemModules/gaming.nix - ../../common/systemModules/crypt.nix - ../../common/systemModules/printing.nix - ../../common/systemModules/stylix.nix - # USERS - ../../common/users/meyer - ]; + config, + pkgs, + inputs, + ... +}: +{ + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ../../common/systemModules/boot.nix + ../../common/systemModules/audio.nix + ../../common/systemModules/kde.nix + ../../common/systemModules/tailscale.nix + ../../common/systemModules/gaming.nix + ../../common/systemModules/crypt.nix + ../../common/systemModules/printing.nix + ../../common/systemModules/stylix.nix + # USERS + ../../common/users/meyer + ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; hardware.i2c.enable = true; @@ -31,18 +35,18 @@ time.timeZone = "America/New_York"; nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; services = { teamviewer.enable = true; usbmuxd.enable = true; }; - programs.zsh.enable = true; - - environment.systemPackages = with pkgs; [ clinfo fuse diff --git a/common/pkgs.nix b/common/pkgs.nix index 72e7970..64909c3 100644 --- a/common/pkgs.nix +++ b/common/pkgs.nix @@ -55,6 +55,58 @@ in nodejs_22 ]; gui = with pkgs; [ + screenkey + pinned.vscode + # ( + # (pinned.vscode.override { + # isInsiders = true; + # }).overrideAttrs + # ( + # _: old: + # let + # sourceExecutableName = "code-insiders"; + # executableName = "code-insiders"; + # in + # { + # installPhase = '' + # runHook preInstall + # mkdir -p "$out/lib/vscode" "$out/bin" + # cp -r ./* "$out/lib/vscode" + # + # mv "$out/lib/vscode/bin/code" "$out/lib/vscode/bin/${sourceExecutableName}" # ME + # + # ln -s "$out/lib/vscode/bin/${sourceExecutableName}" "$out/bin/${executableName}" + # + # mkdir -p "$out/share/applications" + # ln -s "$desktopItem/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop" + # ln -s "$urlHandlerDesktopItem/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop" + # + # # These are named vscode.png, vscode-insiders.png, etc to match the name in upstream *.deb packages. + # mkdir -p "$out/share/pixmaps" + # cp "$out/lib/vscode/resources/app/resources/linux/code.png" "$out/share/pixmaps/vs${executableName}.png" + # + # # Override the previously determined VSCODE_PATH with the one we know to be correct + # sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" + # grep -q "VSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" # check if sed succeeded + # + # # Remove native encryption code, as it derives the key from the executable path which does not work for us. + # # The credentials should be stored in a secure keychain already, so the benefit of this is questionable + # # in the first place. + # rm -rf $out/lib/vscode/resources/app/node_modules/vscode-encrypt + # # HOOK + # runHook postInstall + # ''; + # + # postFixup = '' + # patchelf \ + # --add-needed ${pkgs.libglvnd}/lib/libGLESv2.so.2 \ + # --add-needed ${pkgs.libglvnd}/lib/libGL.so.1 \ + # --add-needed ${pkgs.libglvnd}/lib/libEGL.so.1 \ + # $out/lib/vscode/code + # ''; + # } + # ) + # ) cpkg.frog legcord obsidian @@ -63,7 +115,7 @@ in jadx android-studio wireshark - pinned.vscode + # pinned.vscode pinned.etcher insomnia teamviewer @@ -73,7 +125,6 @@ in libsForQt5.kcolorchooser python312Packages.openai-whisper firefox-devedition - cinny-desktop element-desktop protonvpn-gui xclicker @@ -109,7 +160,6 @@ in vlc jellyfin-web obs-studio - tokyo-night-gtk ksshaskpass libsForQt5.kinit ]; @@ -138,7 +188,7 @@ in jdks = [ jdk8 jdk17 - jdk22 + jdk23 ]; }) protontricks diff --git a/common/programs/config.kbd b/common/programs/config.kbd new file mode 100644 index 0000000..ccd7e11 --- /dev/null +++ b/common/programs/config.kbd @@ -0,0 +1,13 @@ +(defsrc +caps +) +(defvar +tap-time 150 +hold-time 200 +) +(defalias +caps (tap-hold 150 150 esc lctrl) +) +(deflayer base + @caps +) diff --git a/common/programs/kanata.nix b/common/programs/kanata.nix new file mode 100644 index 0000000..b413431 --- /dev/null +++ b/common/programs/kanata.nix @@ -0,0 +1,54 @@ +{ NAME }: +{ pkgs, ... }: +{ + # services = { + # kanata = { + # enable = true; + # keyboards = { + # razer = { + # # devices = [ + # # "/dev/input/by-id/usb-Razer_Razer_BlackWidow_V4-event-kbd" + # # ]; + # extraDefCfg = "process-unmapped-keys yes"; + # config = '' + # (defsrc + # caps + # ) + # (defvar + # tap-time 150 + # hold-time 200 + # ) + # (defalias + # caps (tap-hold 100 100 esc lctrl) + # ) + # (deflayer base + # @caps + # ) + # + # ''; + # }; + # }; + # }; + # }; + users = { + users = { + "${NAME}" = { + extraGroups = [ + "uinput" + ]; + }; + }; + }; + systemd.services.kanata-meyer = { + enable = true; + description = "services-kanata sucks ass"; + serviceConfig = { + ExecStart = '' + ${pkgs.kanata}/bin/kanata \ + --cfg ${./config.kbd} + ''; + User=NAME; + }; + wantedBy = [ "multi-user.target" ]; + }; +} diff --git a/common/systemModules/stylix.nix b/common/systemModules/stylix.nix index 64588e1..71a3b84 100644 --- a/common/systemModules/stylix.nix +++ b/common/systemModules/stylix.nix @@ -27,7 +27,7 @@ fonts = { emoji = { package = pkgs.twemoji-color-font; - name = "Twemoji Color Emoji"; + name = "Twitter Color Emoji"; }; sansSerif = { package = pkgs.nerdfonts; diff --git a/common/users/homeModules/jetbrains/overlays.nix b/common/users/homeModules/jetbrains/overlays.nix index bf172a9..32a1a89 100644 --- a/common/users/homeModules/jetbrains/overlays.nix +++ b/common/users/homeModules/jetbrains/overlays.nix @@ -1,9 +1,11 @@ -{ config, lib, ... }: { +{ config, lib, ... }: +{ nixpkgs.overlays = [ (pkgs: _: { ja-netfilter = pkgs.callPackage ./ja-netfilter { inherit lib; }; }) - (final: pkgs: + ( + final: pkgs: let inherit (pkgs) jetbrains; globalPlugins = [ @@ -12,7 +14,12 @@ ]; ja-netfilter = pkgs.ja-netfilter.override { programName = "jetbrains"; - enabledPlugins = [ "dns" "url" "hideme" "power" ]; + enabledPlugins = [ + "dns" + "url" + "hideme" + "power" + ]; pluginConfigs = { dns = '' [DNS] @@ -43,21 +50,30 @@ }; }; - srcOverrideFn = name: { version - , url - , sha256 - , plugins ? [ ] - , - }: + srcOverrideFn = + name: + { + version, + url, + sha256, + plugins ? [ ], + }: let - versionChangedPkg = jetbrains.${name}.overrideAttrs - (_: old: rec { + versionChangedPkg = jetbrains.${name}.overrideAttrs ( + _: old: rec { inherit version; src = pkgs.fetchurl { inherit url sha256; }; - buildInputs = old.buildInputs ++ (with pkgs; [ xorg.libX11 libGL fontconfig ]); - }); + buildInputs = + old.buildInputs + ++ (with pkgs; [ + xorg.libX11 + libGL + fontconfig + ]); + } + ); in versionChangedPkg; srcPatched = builtins.mapAttrs srcOverrideFn overrides; @@ -67,7 +83,8 @@ --add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED -javaagent:${javaAgentJar}=jetbrains ''; - forkingWrapper = package: wrapperName: + forkingWrapper = + package: wrapperName: let exe = lib.getExe package; wrapperExe = pkgs.writeShellScriptBin wrapperName '' @@ -76,21 +93,22 @@ in pkgs.symlinkJoin { name = package.name; - paths = [ package wrapperExe ]; + paths = [ + package + wrapperExe + ]; postBuild = '' ln -s ${exe} $out/bin/${wrapperName}-unwrapped ''; }; - wrapJetBrains = package: name: - forkingWrapper (package.override { inherit vmopts; }) name; - netOverrideFn = name: _: - wrapJetBrains srcPatched.${name} name; + wrapJetBrains = package: name: forkingWrapper (package.override { inherit vmopts; }) name; + netOverrideFn = name: _: wrapJetBrains srcPatched.${name} name; netPatched = builtins.mapAttrs netOverrideFn overrides; in { jbeap = netPatched; - }) - + } + ) ]; } diff --git a/common/users/homeModules/vscode/default.nix b/common/users/homeModules/vscode/default.nix new file mode 100644 index 0000000..7bc9b42 --- /dev/null +++ b/common/users/homeModules/vscode/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + imports = [ + ./overlays.nix + ]; + home.packages = with pkgs; [ + vscode-insider + ]; +} diff --git a/common/users/homeModules/vscode/overlays.nix b/common/users/homeModules/vscode/overlays.nix new file mode 100644 index 0000000..72d8a09 --- /dev/null +++ b/common/users/homeModules/vscode/overlays.nix @@ -0,0 +1,62 @@ +{ nixpkgs, pkgs, ... }: +{ + nixpkgs.overlays = [ + (final: prev: { + vscode-insider = ( + (prev.vscode.override { + isInsiders = true; + }).overrideAttrs + ( + _: old: + let + sourceExecutableName = "code-insiders"; + executableName = "code-insiders"; + in + { + pname = "code-insiders"; + installPhase = '' + runHook preInstall + mkdir -p "$out/lib/vscode" "$out/bin" + cp -r ./* "$out/lib/vscode" + + mv "$out/lib/vscode/bin/code" "$out/lib/vscode/bin/${sourceExecutableName}" # ME + mv "$out/lib/vscode/code" "$out/lib/vscode/${sourceExecutableName}" # ME + + ln -s "$out/lib/vscode/bin/${sourceExecutableName}" "$out/bin/${executableName}" + + mkdir -p "$out/share/applications" + ln -s "$desktopItem/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop" + ln -s "$urlHandlerDesktopItem/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop" + + # These are named vscode.png, vscode-insiders.png, etc to match the name in upstream *.deb packages. + mkdir -p "$out/share/pixmaps" + cp "$out/lib/vscode/resources/app/resources/linux/code.png" "$out/share/pixmaps/vs${executableName}.png" + + # Override the previously determined VSCODE_PATH with the one we know to be correct + sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" + grep -q "VSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" # check if sed succeeded + + # Remove native encryption code, as it derives the key from the executable path which does not work for us. + # The credentials should be stored in a secure keychain already, so the benefit of this is questionable + # in the first place. + rm -rf $out/lib/vscode/resources/app/node_modules/vscode-encrypt + # HOOK + runHook postInstall + ''; + + postFixup = '' + patchelf \ + --add-needed ${pkgs.libglvnd}/lib/libGLESv2.so.2 \ + --add-needed ${pkgs.libglvnd}/lib/libGL.so.1 \ + --add-needed ${pkgs.libglvnd}/lib/libEGL.so.1 \ + $out/lib/vscode/${sourceExecutableName} + ''; + meta = old.meta // { + mainProgram = "code-insiders"; + }; + } + ) + ); + }) + ]; +} diff --git a/common/users/meyer/default.nix b/common/users/meyer/default.nix index c71d2ac..7c29107 100644 --- a/common/users/meyer/default.nix +++ b/common/users/meyer/default.nix @@ -10,6 +10,7 @@ in (import ../../systemModules/razer.nix { inherit NAME; }) (import ../../systemModules/nixHelper.nix { inherit NAME; }) (import ../../programs/wireshark.nix { inherit NAME; }) + (import ../../programs/kanata.nix { inherit NAME; }) ]; users = { users = { diff --git a/common/users/meyer/home.nix b/common/users/meyer/home.nix index 0bf6a4d..419640c 100644 --- a/common/users/meyer/home.nix +++ b/common/users/meyer/home.nix @@ -30,6 +30,7 @@ in ../homeModules/java.nix ../homeModules/jetbrains ../homeModules/notion.nix + # ../homeModules/vscode ./sops.nix ./git.nix ]; diff --git a/flake.lock b/flake.lock index dd7ab12..019003f 100644 --- a/flake.lock +++ b/flake.lock @@ -177,11 +177,11 @@ ] }, "locked": { - "lastModified": 1730016908, - "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", + "lastModified": 1731968878, + "narHash": "sha256-+hTCwETOE9N8voTAaF+IzdUZz28Ws3LDpH90FWADrEE=", "owner": "nix-community", "repo": "home-manager", - "rev": "e83414058edd339148dc142a8437edb9450574c8", + "rev": "a42fa14b53ceab66274a21da480c9f8e06204173", "type": "github" }, "original": { @@ -211,65 +211,6 @@ "type": "github" } }, - "nekocord": { - "inputs": { - "nekocord-installer": "nekocord-installer", - "nekocord-latest": "nekocord-latest", - "nekocord-latest-dev": "nekocord-latest-dev", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1731460153, - "narHash": "sha256-IE/knV89tR9Kv6CBKwJOEDoVNtrk+rOTpvOatoPsB2I=", - "owner": "PoolloverNathan", - "repo": "nekocord", - "rev": "891ff720064a251d537dd89ce943aae669926cc0", - "type": "github" - }, - "original": { - "owner": "PoolloverNathan", - "repo": "nekocord", - "type": "github" - } - }, - "nekocord-installer": { - "flake": false, - "locked": { - "narHash": "sha256-/89LCtysKgmDN8jGR2lARC7eArnxrENAdiMCSuPZVo0=", - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord-installer/main/latest.json" - }, - "original": { - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord-installer/main/latest.json" - } - }, - "nekocord-latest": { - "flake": false, - "locked": { - "narHash": "sha256-DQw1QXxrsrbuNQZl0LyTRIZZbfrNjiZIEEIZWVhLgQg=", - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord/main/latest.json" - }, - "original": { - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord/main/latest.json" - } - }, - "nekocord-latest-dev": { - "flake": false, - "locked": { - "narHash": "sha256-Ns+1t7XjrS+TbXWjGEtSTwkqykbjSQ/t0weJh/qhdGI=", - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord/dev/latest.json" - }, - "original": { - "type": "file", - "url": "https://nekocord.dev/uploads/nekocord/dev/latest.json" - } - }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -277,11 +218,11 @@ ] }, "locked": { - "lastModified": 1729999765, - "narHash": "sha256-LYsavZXitFjjyETZoij8usXjTa7fa9AIF3Sk3MJSX+Y=", + "lastModified": 1731814505, + "narHash": "sha256-l9ryrx1Twh08a+gxrMGM9O/aZKEimZfa6sZVyPCImgI=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "0e3a8778c2ee218eff8de6aacf3d2fa6c33b2d4f", + "rev": "bdba246946fb079b87b4cada4df9b1cdf1c06132", "type": "github" }, "original": { @@ -297,11 +238,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1729717678, - "narHash": "sha256-XEfYT1D+4KT9c0mMwsmZdWS2JgKsboAZbnuJvrjBQKg=", + "lastModified": 1731682434, + "narHash": "sha256-HnZFPB7akVIy0KuPq/tEkiB+Brt1qi0DUIDzR8z25qI=", "owner": "nix-community", "repo": "nixos-wsl", - "rev": "5a965cb108fb1f30b29a26dbc29b473f49e80b41", + "rev": "a6b9cf0b7805e2c50829020a73e7bde683fd36dd", "type": "github" }, "original": { @@ -311,22 +252,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1729181673, - "narHash": "sha256-LDiPhQ3l+fBjRATNtnuDZsBS7hqoBtPkKBkhpoBHv3I=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4eb33fe664af7b41a4c446f87d20c9a0a6321fa3", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { "locked": { "lastModified": 1729973466, "narHash": "sha256-knnVBGfTCZlQgxY1SgH0vn2OyehH9ykfF8geZgS95bk=", @@ -337,18 +262,18 @@ }, "original": { "owner": "NixOS", - "ref": "release-24.05", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1729880355, - "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", + "lastModified": 1731676054, + "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", + "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add", "type": "github" }, "original": { @@ -376,11 +301,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1729951556, - "narHash": "sha256-bpb6r3GjzhNW8l+mWtRtLNg5PhJIae041sPyqcFNGb4=", + "lastModified": 1731763621, + "narHash": "sha256-ddcX4lQL0X05AYkrkV2LMFgGdRvgap7Ho8kgon3iWZk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4e0eec54db79d4d0909f45a88037210ff8eaffee", + "rev": "c69a9bffbecde46b4b939465422ddc59493d3e4d", "type": "github" }, "original": { @@ -393,7 +318,6 @@ "root": { "inputs": { "home-manager": "home-manager", - "nekocord": "nekocord", "nix-index-database": "nix-index-database", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", @@ -422,15 +346,14 @@ }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_4", - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1729999681, - "narHash": "sha256-qm0uCtM9bg97LeJTKQ8dqV/FvqRN+ompyW4GIJruLuw=", + "lastModified": 1731954233, + "narHash": "sha256-vvXx1m2Rsw7MkbKJdpcICzz4YPgZPApGKQGhNZfkhOI=", "owner": "Mic92", "repo": "sops-nix", - "rev": "1666d16426abe79af5c47b7c0efa82fd31bf4c56", + "rev": "e39947d0ee8e341fa7108bd02a33cdfa24a1360e", "type": "github" }, "original": {