Reduce jay-lenovo switch source builds

This commit is contained in:
2026-07-06 16:25:44 -07:00
parent 74d5615f8c
commit 5c7007912c
5 changed files with 326 additions and 295 deletions

View File

@@ -2,20 +2,32 @@
pkgs, pkgs,
lib, lib,
inputs, inputs,
config ? {},
... ...
}: let }: let
system = pkgs.stdenv.hostPlatform.system; system = pkgs.stdenv.hostPlatform.system;
isJayLenovo = (config.networking.hostName or null) == "jay-lenovo";
inputPackageOrNull = inputName: packageName: let inputPackageOrNull = inputName: packageName: let
input = inputs.${inputName} or null; input = inputs.${inputName} or null;
packages = if input == null then null else input.packages or null; packages =
systemPackages = if packages == null then null else packages.${system} or null; if input == null
then null
else input.packages or null;
systemPackages =
if packages == null
then null
else packages.${system} or null;
in in
if systemPackages == null then null else systemPackages.${packageName} or null; if systemPackages == null
then null
else systemPackages.${packageName} or null;
git-blame-rank = inputs.git-blame-rank.packages.${system}.default.overrideAttrs (old: { git-blame-rank = inputs.git-blame-rank.packages.${system}.default.overrideAttrs (old: {
env = (old.env or {}) // { env =
CARGO_BUILD_JOBS = "1"; (old.env or {})
}; // {
CARGO_BUILD_JOBS = "1";
};
}); });
coquiTtsStreamer = inputPackageOrNull "coqui-tts-streamer" "default"; coquiTtsStreamer = inputPackageOrNull "coqui-tts-streamer" "default";
keepbook = inputs.keepbook.packages.${system}.keepbook.overrideAttrs (_: { keepbook = inputs.keepbook.packages.${system}.keepbook.overrideAttrs (_: {
@@ -24,56 +36,56 @@
}); });
commonPkgs = lib.filter (pkg: lib.meta.availableOn pkgs.stdenv.hostPlatform pkg) ((with pkgs; [ commonPkgs = lib.filter (pkg: lib.meta.availableOn pkgs.stdenv.hostPlatform pkg) ((with pkgs; [
automake automake
bazel bento4
bento4 bind
bind binutils
binutils cachix
cachix bubblewrap
bubblewrap cmake
cmake dex
dex direnv
direnv fd
fd ffmpeg
ffmpeg file
file gawk
gawk gcc
gcc gh
gh git-fame
git-fame git-blame-rank
git-blame-rank git-lfs
git-lfs git-sync
git-sync git
git gnumake
gnumake home-manager
home-manager htop
htop ispell
ispell jq
jq just
just keepbook
keepbook lsof
lsof magic-wormhole-rs
magic-wormhole-rs ncdu
ncdu fastfetch
fastfetch neovim
neovim nix-index
nix-index nix-search-cli
nix-search-cli pass
pass patchelf
patchelf pstree
pstree rclone
rclone ripgrep
ripgrep skim
skim tmux
tmux zellij
zellij unzip
unzip wget
wget xkcdpass
xkcdpass yubikey-manager
yubikey-manager ])
]) ++ lib.optionals (!isJayLenovo) [pkgs.bazel]
++ lib.optionals (coquiTtsStreamer != null) [coquiTtsStreamer] ++ lib.optionals (coquiTtsStreamer != null) [coquiTtsStreamer]
++ lib.optionals (builtins.hasAttr "git-sync-rs" pkgs) [pkgs.git-sync-rs]); ++ lib.optionals (builtins.hasAttr "git-sync-rs" pkgs) [pkgs.git-sync-rs]);
linuxOnly = with pkgs; [ linuxOnly = with pkgs; [
dex dex

View File

@@ -5,184 +5,184 @@
lib, lib,
makeEnable, makeEnable,
... ...
}: }: let
let
codexDesktopLinuxSource = pkgs.applyPatches { codexDesktopLinuxSource = pkgs.applyPatches {
name = "codex-desktop-linux-patched"; name = "codex-desktop-linux-patched";
src = inputs.codex-desktop-linux; src = inputs.codex-desktop-linux;
patches = [ ./patches/codex-desktop-linux-gsettings-schemas.patch ]; patches = [./patches/codex-desktop-linux-gsettings-schemas.patch];
}; };
claudeDesktopSource = inputs.claude-desktop; claudeDesktopSource = inputs.claude-desktop;
claudeDesktop = pkgs.callPackage "${claudeDesktopSource}/nix/claude-desktop.nix" {}; claudeDesktop = pkgs.callPackage "${claudeDesktopSource}/nix/claude-desktop.nix" {};
claudeDesktopFhs = pkgs.callPackage "${claudeDesktopSource}/nix/fhs.nix" { claudeDesktopFhs = pkgs.callPackage "${claudeDesktopSource}/nix/fhs.nix" {
claude-desktop = claudeDesktop; claude-desktop = claudeDesktop;
}; };
codexDesktopLinux = codexDesktopLinux = let
let flake = import "${codexDesktopLinuxSource}/flake.nix";
flake = import "${codexDesktopLinuxSource}/flake.nix"; self' =
self' = (flake.outputs {
(flake.outputs { self = self';
self = self'; nixpkgs = inputs.nixpkgs;
nixpkgs = inputs.nixpkgs; flake-utils = inputs.flake-utils;
flake-utils = inputs.flake-utils; })
}) // {
// { outPath = "${codexDesktopLinuxSource}";
outPath = "${codexDesktopLinuxSource}"; rev = inputs.codex-desktop-linux.rev or "";
rev = inputs.codex-desktop-linux.rev or ""; lastModified = inputs.codex-desktop-linux.lastModified or 1;
lastModified = inputs.codex-desktop-linux.lastModified or 1; };
}; in
in self';
self';
in in
makeEnable config "myModules.code" true { makeEnable config "myModules.code" true {
programs.direnv = { programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
hardware.uinput.enable = lib.mkIf config.myModules.desktop.enable true;
programs.ydotool = lib.mkIf config.myModules.desktop.enable {
enable = true;
group = "input";
};
home-manager.sharedModules = lib.mkIf config.myModules.desktop.enable [
codexDesktopLinux.homeManagerModules.default
{
home.sessionVariables.YDOTOOL_SOCKET = "/run/ydotoold/socket";
systemd.user.sessionVariables.YDOTOOL_SOCKET = "/run/ydotoold/socket";
xdg.configFile."codex-desktop/settings.json".text =
(builtins.toJSON {
"codex-linux-computer-use-ui-enabled" = true;
})
+ "\n";
}
];
home-manager.users.imalison = lib.mkIf config.myModules.desktop.enable {
programs.codex = {
enable = true; enable = true;
package = pkgs.codex; nix-direnv.enable = true;
}; };
programs.codexDesktopLinux = { hardware.uinput.enable = lib.mkIf config.myModules.desktop.enable true;
programs.ydotool = lib.mkIf config.myModules.desktop.enable {
enable = true; enable = true;
# Bake CODEX_CLI_PATH into the launcher so Codex Desktop always finds this group = "input";
# CLI, regardless of how it is started (GUI autostart, app launcher, };
# terminal, or warm-start handoff) and without needing a re-login.
cliPackage = pkgs.codex; home-manager.sharedModules = lib.mkIf config.myModules.desktop.enable [
computerUseUi.enable = true; codexDesktopLinux.homeManagerModules.default
remoteMobileControl.enable = true; {
remoteControl = { home.sessionVariables.YDOTOOL_SOCKET = "/run/ydotoold/socket";
systemd.user.sessionVariables.YDOTOOL_SOCKET = "/run/ydotoold/socket";
xdg.configFile."codex-desktop/settings.json".text =
(builtins.toJSON {
"codex-linux-computer-use-ui-enabled" = true;
})
+ "\n";
}
];
home-manager.users.imalison = lib.mkIf config.myModules.desktop.enable {
programs.codex = {
enable = true; enable = true;
package = pkgs.codex; package = pkgs.codex;
extraPackages = with pkgs; [ };
bash
coreutils programs.codexDesktopLinux = {
findutils enable = true;
git # Bake CODEX_CLI_PATH into the launcher so Codex Desktop always finds this
gnugrep # CLI, regardless of how it is started (GUI autostart, app launcher,
gnused # terminal, or warm-start handoff) and without needing a re-login.
nix cliPackage = pkgs.codex;
nodejs computerUseUi.enable = true;
openssh remoteMobileControl.enable = true;
ripgrep remoteControl = {
zsh enable = true;
]; package = pkgs.codex;
listen = "unix://"; extraPackages = with pkgs; [
bash
coreutils
findutils
git
gnugrep
gnused
nix
nodejs
openssh
ripgrep
zsh
];
listen = "unix://";
};
}; };
}; };
};
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
# LLM Tools # LLM Tools
# antigravity # antigravity
claude-code claude-code
claudeDesktopFhs codex
codex gemini-cli
gemini-cli opencode
opencode t3code
t3code
# MCP # MCP
github-mcp-server github-mcp-server
gitea-mcp-server gitea-mcp-server
gws gws
playwright-mcp playwright-mcp
playwright-cli playwright-cli
# C # C
clang clang
# Haskell # Haskell
cabal-install cabal-install
cabal2nix ghc
ghc haskellPackages.hpack
haskellPackages.hpack haskellPackages.hasktags
haskellPackages.hasktags haskellPackages.hoogle
haskellPackages.hoogle
# Scala # Scala
sbt sbt
scala scala
# Node # Node
nodejs nodejs
yarn yarn
prettier prettier
# Typescript # Typescript
typescript typescript
typescript-language-server typescript-language-server
# golang # golang
go go
# Rust # Rust
rustup rustup
cargo-sweep cargo-sweep
# Clojure # Clojure
boot boot
leiningen leiningen
# Ruby # Ruby
ruby ruby
# python # python
black black
poetry poetry
uv uv
# kotlin # kotlin
kotlin kotlin
kotlin-language-server kotlin-language-server
# dhall # dhall
haskellPackages.dhall haskellPackages.dhall
haskellPackages.dhall-json haskellPackages.dhall-json
# misc # misc
perf-tools perf-tools
protobuf protobuf
# nix # nix
nixd nixd
nil nil
alejandra alejandra
] ]
++ ( ++ lib.optionals (config.networking.hostName != "jay-lenovo") [
if pkgs.stdenv.hostPlatform.system == "x86_64-linux" claudeDesktopFhs
then cabal2nix
with pkgs; [ ]
# purescript ++ (
purescript if pkgs.stdenv.hostPlatform.system == "x86_64-linux"
# Broken then
# spago with pkgs; [
] # purescript
else [] purescript
); # Broken
} # spago
]
else []
);
}

View File

@@ -1,5 +1,6 @@
{ {
config, config,
inputs,
lib, lib,
pkgs, pkgs,
... ...
@@ -11,6 +12,15 @@
myModules.wyoming.enable = false; myModules.wyoming.enable = false;
features.full.enable = true; features.full.enable = true;
nixpkgs.overlays = [
(_final: prev: let
stablePkgs = inputs.nixpkgs-stable.legacyPackages.${prev.stdenv.hostPlatform.system};
in {
shellcheck = stablePkgs.shellcheck;
shellcheck-minimal = stablePkgs.shellcheck-minimal or stablePkgs.shellcheck;
})
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
android-studio android-studio
perf perf

View File

@@ -5,83 +5,88 @@
lib, lib,
makeEnable, makeEnable,
... ...
}: }: let
makeEnable config "myModules.notifications-tray-icon" true { system = pkgs.stdenv.hostPlatform.system;
nixpkgs.overlays = [ notificationsTrayIconPkgs = import pkgs.path {
inputs.notifications-tray-icon.overlays.default inherit system;
(final: prev: { config = pkgs.config or {};
haskellPackages = prev.haskellPackages.override (old: { overlays = [
overrides = inputs.notifications-tray-icon.overlays.default
final.lib.composeExtensions (old.overrides or (_: _: {})) (final: prev: {
(hself: hsuper: { haskellPackages = prev.haskellPackages.override (old: {
notifications-tray-icon = overrides =
final.haskell.lib.overrideCabal final.lib.composeExtensions (old.overrides or (_: _: {}))
hsuper.notifications-tray-icon (hself: hsuper: {
(oldAttrs: { notifications-tray-icon =
patches = final.haskell.lib.overrideCabal
(oldAttrs.patches or []) hsuper.notifications-tray-icon
++ [ (oldAttrs: {
./patches/notifications-tray-icon-gmail-oauth-detached-browser.patch patches =
./patches/notifications-tray-icon-github-menu-item-id.patch (oldAttrs.patches or [])
./patches/notifications-tray-icon-open-url-systemd-run.patch ++ [
]; ./patches/notifications-tray-icon-gmail-oauth-detached-browser.patch
}); ./patches/notifications-tray-icon-github-menu-item-id.patch
}); ./patches/notifications-tray-icon-open-url-systemd-run.patch
}); ];
}) });
]; });
});
home-manager.users.imalison = {config, ...}: let })
notificationsTrayIcon = pkgs.haskellPackages.notifications-tray-icon; ];
gmailExecStart = pkgs.writeShellScript "notifications-tray-icon-gmail" ''
creds_file="${config.xdg.configHome}/gws/client_secret.json"
client_id=$(${pkgs.jq}/bin/jq -r '.installed.client_id // .web.client_id // empty' "$creds_file")
client_secret=$(${pkgs.jq}/bin/jq -r '.installed.client_secret // .web.client_secret // empty' "$creds_file")
if [ -z "$client_id" ] || [ -z "$client_secret" ]; then
echo "Failed to read Gmail OAuth client credentials from $creds_file" >&2
exit 1
fi
exec ${notificationsTrayIcon}/bin/notifications-tray-icon gmail \
--client-id "$client_id" \
--client-secret "$client_secret"
'';
mkService = description: execStart: {
Unit = {
Description = description;
After = ["graphical-session.target" "tray.target"];
PartOf = ["graphical-session.target"];
Requires = ["tray.target"];
};
Service = {
ExecStart = execStart;
# URL handlers can outlive the tray process. Keep restarts from killing
# unrelated GUI apps if a handler ever leaks into this service cgroup.
KillMode = "process";
Restart = "always";
RestartSec = 3;
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
in {
systemd.user.services = {
notifications-tray-icon-github =
mkService
"GitHub notifications tray icon"
"${notificationsTrayIcon}/bin/notifications-tray-icon github --token-pass github-token";
notifications-tray-icon-gitea =
mkService
"Gitea notifications tray icon"
"${notificationsTrayIcon}/bin/notifications-tray-icon gitea --url https://dev.railbird.ai --token-pass gitea-omni-token";
notifications-tray-icon-gmail =
mkService
"Gmail notifications tray icon"
"${gmailExecStart}";
};
}; };
} in
makeEnable config "myModules.notifications-tray-icon" true {
home-manager.users.imalison = {config, ...}: let
notificationsTrayIcon = notificationsTrayIconPkgs.haskellPackages.notifications-tray-icon;
gmailExecStart = pkgs.writeShellScript "notifications-tray-icon-gmail" ''
creds_file="${config.xdg.configHome}/gws/client_secret.json"
client_id=$(${pkgs.jq}/bin/jq -r '.installed.client_id // .web.client_id // empty' "$creds_file")
client_secret=$(${pkgs.jq}/bin/jq -r '.installed.client_secret // .web.client_secret // empty' "$creds_file")
if [ -z "$client_id" ] || [ -z "$client_secret" ]; then
echo "Failed to read Gmail OAuth client credentials from $creds_file" >&2
exit 1
fi
exec ${notificationsTrayIcon}/bin/notifications-tray-icon gmail \
--client-id "$client_id" \
--client-secret "$client_secret"
'';
mkService = description: execStart: {
Unit = {
Description = description;
After = ["graphical-session.target" "tray.target"];
PartOf = ["graphical-session.target"];
Requires = ["tray.target"];
};
Service = {
ExecStart = execStart;
# URL handlers can outlive the tray process. Keep restarts from killing
# unrelated GUI apps if a handler ever leaks into this service cgroup.
KillMode = "process";
Restart = "always";
RestartSec = 3;
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
in {
systemd.user.services = {
notifications-tray-icon-github =
mkService
"GitHub notifications tray icon"
"${notificationsTrayIcon}/bin/notifications-tray-icon github --token-pass github-token";
notifications-tray-icon-gitea =
mkService
"Gitea notifications tray icon"
"${notificationsTrayIcon}/bin/notifications-tray-icon gitea --url https://dev.railbird.ai --token-pass gitea-omni-token";
notifications-tray-icon-gmail =
mkService
"Gmail notifications tray icon"
"${gmailExecStart}";
};
};
}

View File

@@ -7,13 +7,13 @@
... ...
}: let }: let
session = import ./session-variables.nix; session = import ./session-variables.nix;
in system = pkgs.stdenv.hostPlatform.system;
makeEnable config "myModules.xmonad" true { xmonadPkgs = import pkgs.path {
myModules.taffybar.enable = lib.mkDefault (config.myModules.desktop.shellUi == "taffybar"); inherit system;
config = pkgs.config or {};
nixpkgs.overlays = with inputs; [ overlays = [
xmonad.overlay inputs.xmonad.overlay
xmonad-contrib.overlay inputs.xmonad-contrib.overlay
(final: prev: { (final: prev: {
haskellPackages = prev.haskellPackages.override (old: { haskellPackages = prev.haskellPackages.override (old: {
overrides = overrides =
@@ -31,6 +31,10 @@ in
}) })
(import ../dotfiles/config/xmonad/overlay.nix) (import ../dotfiles/config/xmonad/overlay.nix)
]; ];
};
in
makeEnable config "myModules.xmonad" true {
myModules.taffybar.enable = lib.mkDefault (config.myModules.desktop.shellUi == "taffybar");
services.rumno.enable = true; services.rumno.enable = true;
@@ -48,13 +52,13 @@ in
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = [
# Haskell Desktop # Haskell Desktop
haskellPackages.xmonad xmonadPkgs.haskellPackages.xmonad
haskellPackages.imalison-xmonad xmonadPkgs.haskellPackages.imalison-xmonad
# haskellPackages.notifications-tray-icon # xmonadPkgs.haskellPackages.notifications-tray-icon
# haskellPackages.gtk-sni-tray # xmonadPkgs.haskellPackages.gtk-sni-tray
haskellPackages.dbus-hslogger xmonadPkgs.haskellPackages.dbus-hslogger
]; ];
home-manager.sharedModules = [ home-manager.sharedModules = [