diff --git a/boxes/desktop/configuration.nix b/boxes/desktop/configuration.nix index 3e0aeb7..62c4ac3 100644 --- a/boxes/desktop/configuration.nix +++ b/boxes/desktop/configuration.nix @@ -2,7 +2,6 @@ # 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 = [ @@ -32,18 +31,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; [ ddcutil clinfo diff --git a/common/pkgs.nix b/common/pkgs.nix new file mode 100644 index 0000000..75e25dc --- /dev/null +++ b/common/pkgs.nix @@ -0,0 +1,263 @@ +{ + pkgs, + config, + inputs, + cpkg, +}: +let + pinned = import ./pinned.nix { inherit pkgs config; }; +in +{ + dev = with pkgs; [ + bear + llvmPackages_19.clang-tools + meson + nixfmt-rfc-style + nil + deno + rustup + android-studio-tools + vscode-langservers-extracted + cmake + nodePackages_latest.typescript-language-server + lua + go + eslint_d + typescript + php + clang + gnumake + gradle + lazygit + linuxHeaders + eslint + nodePackages.nodemon + nodePackages.ts-node + nodePackages.pnpm + corepack_22 + prisma + prisma-engines + nodePackages.live-server + gh + glib + glibc + (python312.withPackages ( + ps: with ps; [ + pytesseract + pillow + pyzbar + pygobject3 + nanoid + loguru + evdev + setuptools + xlib + ] + )) + 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 + bottles + parsec-bin + jadx + android-studio + wireshark + # pinned.vscode + pinned.etcher + insomnia + teamviewer + davinci-resolve + warp-terminal + gnome-calculator + libsForQt5.kcolorchooser + python312Packages.openai-whisper + firefox-devedition + element-desktop + protonvpn-gui + xclicker + polychromatic + jellyfin-media-player + arrpc + filezilla + virt-manager + qemu_full + shotcut + pinta + gimp + inkscape + #OCR ENGINE + tesseract4 + (pkgs.discord.override { + withVencord = true; + }) + vesktop + xsel + spotify + pulseaudioFull + pavucontrol + # jetbrains.pycharm-community + jbeap.idea-ultimate + google-chrome + bitwarden + nerdfonts + # vscodium + kitty + rofi + thunderbird + vlc + jellyfin-web + obs-studio + ksshaskpass + libsForQt5.kinit + ]; + general = with pkgs; [ + imagemagick + onefetch + p7zip + dig + bat + usbutils + tree + ffmpeg + yt-dlp + neofetch + sops + hyfetch + fzf + zsh-powerlevel10k + zsh-syntax-highlighting + jq + unzip + btop + ]; + gaming = with pkgs; [ + (prismlauncher.override { + jdks = [ + jdk8 + jdk17 + jdk23 + ]; + }) + protontricks + lutris + ]; + scripts = [ + (pkgs.writeShellScriptBin "hashi18n" '' + xsel -ob | node ${cpkg.scripts}/hash.js | tr -d '\n' | xsel -ib + '') + (pkgs.writeShellScriptBin "paste" '' + command -v xsel > /dev/null + if [[ $? -eq 0 ]]; then + xsel -ob && exit 0 + fi + command -v wslclip > /dev/null + if [[ $? -eq 0 ]]; then + wslclip -g && exit 0 + fi + '') + (pkgs.writeShellScriptBin "http2ssh" '' + set -eo pipefail + + if [[ -z $1 ]]; then + echo "You need to provide a remote name"; + echo "Avilable remotes"; + git remote -v; + exit 1; + fi + URL=''$(git remote get-url $1); + URL=''${URL/https:\/\//git@}; + URL=''${URL/\//:}; + git remote set-url $1 $URL; + '') + (pkgs.writeShellScriptBin "copy" '' + command -v xsel > /dev/null + if [[ $? -eq 0 ]]; then + xsel -ib $@ && exit 0 + fi + command -v wslclip > /dev/null + if [[ $? -eq 0 ]]; then + wslclip $@ && exit 0 + fi + + '') + (pkgs.writeShellScriptBin "git_fetchAll" '' + git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "''${remote#origin/}" "$remote"; done + git fetch --all + git pull --all + '') + (pkgs.writeShellScriptBin "install_eslint" '' + set -x + cp /home/${config.home.username}/.config/.eslintrc.json . + pkgs=("@stylistic/eslint-plugin" "@typescript-eslint/eslint-plugin") + if [[ -z $1 ]]; then + echo please specify npm, pnpm, or yarn + exit 1 + fi + for i in "''${pkgs[@]}"; do + `$1 i -D $i` + done + '') + (pkgs.writeShellScriptBin "math" '' + set -e + python3 -c "print($*)" + '') + ]; + wsl = with pkgs; [ + wslu + ]; +} 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..e20a709 --- /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="root"; + }; + wantedBy = [ "multi-user.target" ]; + }; +} diff --git a/common/systemModules/stylix.nix b/common/systemModules/stylix.nix index 22ae607..9afc3cf 100644 --- a/common/systemModules/stylix.nix +++ b/common/systemModules/stylix.nix @@ -30,7 +30,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/homeModules/zed.nix b/common/users/homeModules/zed.nix new file mode 100644 index 0000000..f700d62 --- /dev/null +++ b/common/users/homeModules/zed.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + home = { + packages = with pkgs; [ + zed-editor + ]; + }; +} diff --git a/common/users/meyer/default.nix b/common/users/meyer/default.nix index f434b5b..d14d135 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/flake.lock b/flake.lock index 502a53a..e145b2e 100644 --- a/flake.lock +++ b/flake.lock @@ -219,7 +219,7 @@ "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -290,7 +290,7 @@ "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", "owner": "SenchoPens", "repo": "fromYaml", - "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "rev": "106af9e2f715e2d828df706c386a685698f3223b", "type": "github" }, "original": {