2023-07-26 19:14:00 +00:00
|
|
|
{
|
2026-04-12 14:13:56 -07:00
|
|
|
inputs,
|
|
|
|
|
specialArgs,
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
pkgs,
|
|
|
|
|
realUsers,
|
|
|
|
|
...
|
|
|
|
|
}: {
|
2023-08-19 22:54:14 -06:00
|
|
|
imports = [
|
2025-02-19 20:09:20 -07:00
|
|
|
inputs.home-manager.nixosModules.home-manager
|
2023-08-19 22:54:14 -06:00
|
|
|
];
|
2023-08-22 06:57:30 +00:00
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
imalison.nixOverlay.enable = lib.mkOption {
|
2023-12-15 20:23:19 -07:00
|
|
|
default = false;
|
2023-08-22 06:57:30 +00:00
|
|
|
type = lib.types.bool;
|
2023-08-19 22:54:14 -06:00
|
|
|
};
|
|
|
|
|
};
|
2023-08-22 06:57:30 +00:00
|
|
|
config = {
|
2026-02-03 20:30:39 -08:00
|
|
|
home-manager.users = lib.genAttrs realUsers (_: {});
|
2023-08-22 06:57:30 +00:00
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
|
nixos = {
|
|
|
|
|
inherit specialArgs config;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
|
home-manager.useUserPackages = true;
|
2026-04-12 14:13:56 -07:00
|
|
|
home-manager.backupCommand = pkgs.writeShellScript "home-manager-backup-command" ''
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
target_path="$1"
|
|
|
|
|
backup_ext="''${HOME_MANAGER_BACKUP_EXT:-hm-backup}"
|
|
|
|
|
backup_path="''${target_path}.''${backup_ext}"
|
|
|
|
|
|
|
|
|
|
if [[ ! -e "$backup_path" ]]; then
|
|
|
|
|
mv -- "$target_path" "$backup_path"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
timestamp="$(date +%Y%m%d-%H%M%S)"
|
|
|
|
|
candidate="''${backup_path}.''${timestamp}"
|
|
|
|
|
counter=0
|
|
|
|
|
|
|
|
|
|
while [[ -e "$candidate" ]]; do
|
|
|
|
|
counter=$((counter + 1))
|
|
|
|
|
candidate="''${backup_path}.''${timestamp}-''${counter}"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
mv -- "$target_path" "$candidate"
|
|
|
|
|
'';
|
2026-02-05 12:00:55 -08:00
|
|
|
home-manager.backupFileExtension = "hm-backup";
|
2026-04-12 14:13:56 -07:00
|
|
|
home-manager.sharedModules = [./home-manager.nix];
|
2023-08-19 22:54:14 -06:00
|
|
|
|
2023-09-02 20:10:07 -06:00
|
|
|
nix = rec {
|
2023-08-22 06:57:30 +00:00
|
|
|
extraOptions = ''
|
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
|
'';
|
|
|
|
|
registry.nixpkgs.flake = inputs.nixpkgs;
|
|
|
|
|
settings = {
|
2026-02-13 03:25:30 -08:00
|
|
|
# Allow per-repo flake `nixConfig` (substituters, keys, etc).
|
|
|
|
|
accept-flake-config = true;
|
2023-08-22 06:57:30 +00:00
|
|
|
keep-outputs = true;
|
|
|
|
|
keep-derivations = true;
|
2023-11-21 20:27:11 -07:00
|
|
|
substituters = [
|
|
|
|
|
"https://cache.nixos.org"
|
2024-06-03 03:57:57 +00:00
|
|
|
"https://cuda-maintainers.cachix.org"
|
2025-05-07 09:32:11 -06:00
|
|
|
"https://ai.cachix.org"
|
2026-04-26 18:51:15 -07:00
|
|
|
"https://cache.nixos-cuda.org"
|
|
|
|
|
"https://nix-community.cachix.org"
|
|
|
|
|
"https://numtide.cachix.org"
|
|
|
|
|
"https://colonelpanic8-dotfiles.cachix.org"
|
|
|
|
|
"https://codex-cli.cachix.org"
|
|
|
|
|
"https://claude-code.cachix.org"
|
|
|
|
|
];
|
|
|
|
|
trusted-substituters = [
|
|
|
|
|
"https://cache.nixos.org"
|
|
|
|
|
"https://cuda-maintainers.cachix.org"
|
|
|
|
|
"https://ai.cachix.org"
|
|
|
|
|
"https://cache.nixos-cuda.org"
|
|
|
|
|
"https://nix-community.cachix.org"
|
|
|
|
|
"https://numtide.cachix.org"
|
2026-02-18 01:16:57 -08:00
|
|
|
"https://colonelpanic8-dotfiles.cachix.org"
|
2026-01-31 21:45:25 -08:00
|
|
|
"https://codex-cli.cachix.org"
|
|
|
|
|
"https://claude-code.cachix.org"
|
2023-11-21 20:27:11 -07:00
|
|
|
];
|
|
|
|
|
trusted-public-keys = [
|
2024-06-03 03:57:57 +00:00
|
|
|
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
2025-05-07 09:32:11 -06:00
|
|
|
"ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="
|
2026-04-26 18:51:15 -07:00
|
|
|
"cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
|
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
|
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
|
2026-02-18 01:16:57 -08:00
|
|
|
"colonelpanic8-dotfiles.cachix.org-1:O6GF3nptpeMFapX29okzO92eSWXR36zqW6ZF2C8P0eQ="
|
2026-01-31 21:45:25 -08:00
|
|
|
"codex-cli.cachix.org-1:1Br3H1hHoRYG22n//cGKJOk3cQXgYobUel6O8DgSing="
|
|
|
|
|
"claude-code.cachix.org-1:YeXf2aNu7UTX8Vwrze0za1WEDS+4DuI2kVeWEE4fsRk="
|
2023-11-21 20:27:11 -07:00
|
|
|
];
|
|
|
|
|
nix-path = nixPath;
|
2023-08-22 06:57:30 +00:00
|
|
|
};
|
|
|
|
|
channel.enable = false;
|
|
|
|
|
nixPath = [
|
|
|
|
|
"nixpkgs=${inputs.nixpkgs.outPath}"
|
|
|
|
|
];
|
2023-07-27 21:37:11 -06:00
|
|
|
};
|
2023-07-26 19:14:00 +00:00
|
|
|
|
2026-04-12 14:13:56 -07:00
|
|
|
nixpkgs.overlays =
|
|
|
|
|
[
|
|
|
|
|
# (import ./nvidia-container-toolkit-overlay.nix)
|
|
|
|
|
(import ./runc-overlay.nix)
|
|
|
|
|
(import ./emacs-overlay.nix)
|
2026-04-25 16:42:22 -07:00
|
|
|
(import ../nix-shared/overlays)
|
2026-04-12 14:13:56 -07:00
|
|
|
# Use codex and claude-code from dedicated flakes with cachix
|
2026-04-28 12:17:47 -07:00
|
|
|
(final: prev: let
|
|
|
|
|
system = prev.stdenv.hostPlatform.system;
|
|
|
|
|
codexDmg = final.fetchurl {
|
|
|
|
|
url = "https://persistent.oaistatic.com/codex-app-prod/Codex.dmg";
|
|
|
|
|
hash = "sha256-hxuafsEAmx1OQvjh8riI7Y4QxvZXemBrjpRHT8Bh034=";
|
|
|
|
|
};
|
|
|
|
|
codexDesktopLibPath = final.lib.makeLibraryPath (with final; [
|
|
|
|
|
alsa-lib
|
|
|
|
|
atk
|
|
|
|
|
at-spi2-atk
|
|
|
|
|
at-spi2-core
|
|
|
|
|
cairo
|
|
|
|
|
cups
|
|
|
|
|
dbus
|
|
|
|
|
expat
|
|
|
|
|
gdk-pixbuf
|
|
|
|
|
glib
|
|
|
|
|
gtk3
|
|
|
|
|
libdrm
|
|
|
|
|
libgbm
|
|
|
|
|
libglvnd
|
|
|
|
|
libX11
|
|
|
|
|
libxcb
|
|
|
|
|
libXcomposite
|
|
|
|
|
libxcursor
|
|
|
|
|
libXdamage
|
|
|
|
|
libXext
|
|
|
|
|
libXfixes
|
|
|
|
|
libxi
|
|
|
|
|
libxkbcommon
|
|
|
|
|
libXrandr
|
|
|
|
|
libxscrnsaver
|
|
|
|
|
libxtst
|
|
|
|
|
mesa
|
|
|
|
|
nspr
|
|
|
|
|
nss
|
|
|
|
|
pango
|
|
|
|
|
systemd
|
|
|
|
|
wayland
|
|
|
|
|
]);
|
|
|
|
|
codexDesktopInstaller = final.writeShellApplication {
|
|
|
|
|
name = "codex-desktop-installer";
|
|
|
|
|
runtimeInputs = with final; [
|
|
|
|
|
bash
|
|
|
|
|
curl
|
|
|
|
|
gcc
|
|
|
|
|
gnumake
|
|
|
|
|
nodejs
|
|
|
|
|
p7zip
|
|
|
|
|
patchelf
|
|
|
|
|
python3
|
|
|
|
|
unzip
|
|
|
|
|
];
|
|
|
|
|
text = ''
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
root_dir="$(pwd)"
|
|
|
|
|
workdir="$(mktemp -d)"
|
|
|
|
|
source_dir="$workdir/source"
|
|
|
|
|
cleanup() {
|
|
|
|
|
rm -rf "$workdir"
|
|
|
|
|
}
|
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
|
|
mkdir -p "$source_dir"
|
|
|
|
|
cp -R ${inputs.codex-desktop-linux.outPath}/. "$source_dir"
|
|
|
|
|
chmod -R u+w "$source_dir"
|
|
|
|
|
cp ${codexDmg} "$source_dir/Codex.dmg"
|
|
|
|
|
chmod +x "$source_dir/install.sh"
|
|
|
|
|
|
|
|
|
|
cd "$source_dir"
|
|
|
|
|
export CODEX_INSTALL_DIR="''${CODEX_INSTALL_DIR:-$root_dir/codex-app}"
|
|
|
|
|
bash "$source_dir/install.sh" "$source_dir/Codex.dmg" "$@"
|
|
|
|
|
|
|
|
|
|
install_dir="''${CODEX_INSTALL_DIR:-$root_dir/codex-app}"
|
|
|
|
|
if [ -f "$install_dir/electron" ]; then
|
|
|
|
|
patchelf --set-interpreter "$(cat ${final.stdenv.cc}/nix-support/dynamic-linker)" \
|
|
|
|
|
--set-rpath "$install_dir:${codexDesktopLibPath}" \
|
|
|
|
|
"$install_dir/electron"
|
|
|
|
|
|
|
|
|
|
if [ -f "$install_dir/chrome_crashpad_handler" ]; then
|
|
|
|
|
patchelf --set-interpreter "$(cat ${final.stdenv.cc}/nix-support/dynamic-linker)" \
|
|
|
|
|
"$install_dir/chrome_crashpad_handler" || true
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -f "$install_dir/chrome-sandbox" ]; then
|
|
|
|
|
patchelf --set-interpreter "$(cat ${final.stdenv.cc}/nix-support/dynamic-linker)" \
|
|
|
|
|
"$install_dir/chrome-sandbox" || true
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
find "$install_dir" -maxdepth 1 -name "*.so*" -type f | while read -r so; do
|
|
|
|
|
patchelf --set-rpath "${codexDesktopLibPath}" "$so" 2>/dev/null || true
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
in {
|
|
|
|
|
codex = inputs.codex-cli-nix.packages.${system}.default;
|
|
|
|
|
codex-desktop-installer = codexDesktopInstaller;
|
2026-04-27 11:41:18 -07:00
|
|
|
codex-desktop = final.writeShellApplication {
|
|
|
|
|
name = "codex-desktop";
|
|
|
|
|
runtimeInputs = [
|
|
|
|
|
final.codex
|
|
|
|
|
final.codex-desktop-installer
|
|
|
|
|
final.coreutils
|
|
|
|
|
final.python3
|
|
|
|
|
];
|
|
|
|
|
text = ''
|
|
|
|
|
install_root="''${CODEX_DESKTOP_HOME:-''${XDG_DATA_HOME:-$HOME/.local/share}/codex-desktop-linux}"
|
|
|
|
|
install_dir="''${CODEX_INSTALL_DIR:-$install_root/codex-app}"
|
|
|
|
|
|
|
|
|
|
if [ ! -x "$install_dir/start.sh" ]; then
|
|
|
|
|
mkdir -p "$install_root"
|
|
|
|
|
CODEX_INSTALL_DIR="$install_dir" codex-desktop-installer
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
export CODEX_CLI_PATH="''${CODEX_CLI_PATH:-$(command -v codex)}"
|
|
|
|
|
exec "$install_dir/start.sh" "$@"
|
|
|
|
|
'';
|
|
|
|
|
};
|
2026-04-12 14:13:56 -07:00
|
|
|
claude-code = inputs.claude-code-nix.packages.${prev.stdenv.hostPlatform.system}.default;
|
2026-04-25 17:34:58 -07:00
|
|
|
git-sync-rs = inputs.git-sync-rs.packages.${prev.stdenv.hostPlatform.system}.default;
|
2026-04-12 14:13:56 -07:00
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
++ (
|
|
|
|
|
if config.imalison.nixOverlay.enable
|
|
|
|
|
then [inputs.nix.overlays.default]
|
|
|
|
|
else []
|
|
|
|
|
);
|
2023-07-26 19:14:00 +00:00
|
|
|
|
2023-08-22 06:57:30 +00:00
|
|
|
# Allow all the things
|
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
};
|
2023-07-26 19:14:00 +00:00
|
|
|
}
|