Merge branch 'main' into refactor

This commit is contained in:
sadan 2024-11-26 20:31:36 -05:00
commit 59a68ea7f6
No known key found for this signature in database
11 changed files with 455 additions and 29 deletions

View file

@ -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

263
common/pkgs.nix Normal file
View file

@ -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
];
}

View file

@ -0,0 +1,13 @@
(defsrc
caps
)
(defvar
tap-time 150
hold-time 200
)
(defalias
caps (tap-hold 150 150 esc lctrl)
)
(deflayer base
@caps
)

View file

@ -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" ];
};
}

View file

@ -30,7 +30,7 @@
fonts = {
emoji = {
package = pkgs.twemoji-color-font;
name = "Twemoji Color Emoji";
name = "Twitter Color Emoji";
};
sansSerif = {
package = pkgs.nerdfonts;

View file

@ -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;
})
}
)
];
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
imports = [
./overlays.nix
];
home.packages = with pkgs; [
vscode-insider
];
}

View file

@ -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";
};
}
)
);
})
];
}

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
home = {
packages = with pkgs; [
zed-editor
];
};
}

View file

@ -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 = {

View file

@ -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": {