Files
gemini-nexus/flake.nix
vinandYoussef fce38ec6f0 Continue PR #142: security + Nix docs follow-up (#148)
* feat: add Nix Flake release and update documentation for Nix integration

- Added flake.nix with native library patching for Linux
- Included SHA256 hashes for v0.10.0 DEB releases (x86_64 and arm64)
- Updated README.md with instructions for nix run, NixOS, Home Manager, and devShells
- Generated flake.lock for reproducibility

* refactor: improve Nix Flake patterns for better consumer control

- Extracted derivation logic into a reusable `mkPackage` function
- Exposed `overlays.default` to allow consumers to use their own nixpkgs instance
- Updated `pkgs.system` to `pkgs.stdenv.hostPlatform.system` to follow modern Nix patterns
- Ensured default `packages` definition correctly handles unfree configuration for testing with `nix build` or `nix run`

* docs: update README with advanced Nix integration patterns

- Added Option 1 (Direct Integration) and Option 2 (Overlay) documentation
- Explained how to use the overlay for full nixpkgs control
- Fixed Markdown styling and lint issues in the Nix integration section

* docs: simplify Nix documentation to favor Overlay integration

- Removed "Option 1" (direct integration) as per user feedback
- Promoted the Overlay method as the standard way to consume the package
- Updated devShell examples to rely on the overlayed package set for consistency

* fix(security): prevent master key overwriting on decryption failure and improve account loading resilience

- Modify readSafeStorageKey and generatePrimaryMasterKey to stop if decryption fails for an existing file, preventing permanent data loss when keyring is temporarily locked.
- Update CloudAccountRepo.getAccounts and getAccount to gracefully skip corrupted account records instead of throwing errors.
- Added detailed logging for security failures to aid in diagnostics.

* docs(readme): sync Nix/NixOS integration docs in README.zh-CN

---------

Co-authored-by: Youssef <[email protected]>
2026-04-06 21:34:32 +08:00

122 lines
3.4 KiB
Nix

{
description = "Antigravity Manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
version = "0.10.0";
sources = {
"x86_64-linux" = {
url = "https://github.com/Draculabo/AntigravityManager/releases/download/v${version}/Antigravity.Manager_${version}_amd64.deb";
sha256 = "5fc08b4a9308c71fc00e44b95d4fb3178182aea8821708fa51fdf2bf5dbbb856";
};
"aarch64-linux" = {
url = "https://github.com/Draculabo/AntigravityManager/releases/download/v${version}/Antigravity.Manager_${version}_arm64.deb";
sha256 = "666c9659efa66bb6be6a8e7fb0c384ceb799a17245eab374bf9b3d7901c5c4cb";
};
};
mkPackage = pkgs: let
system = pkgs.stdenv.hostPlatform.system;
source = sources.${system} or (throw "Unsupported system: ${system}");
in
pkgs.stdenv.mkDerivation {
pname = "antigravity-manager";
inherit version;
src = pkgs.fetchurl {
inherit (source) url sha256;
};
nativeBuildInputs = with pkgs; [
autoPatchelfHook
makeWrapper
zstd
];
buildInputs = with pkgs; [
alsa-lib
at-spi2-atk
atk
cups
dbus
expat
glib
gtk3
libsecret
libdrm
libxkbcommon
mesa
nspr
nss
pango
systemd
libx11
libxcomposite
libxdamage
libxext
libxfixes
libxrandr
libxcb
];
unpackPhase = ''
ar x $src
tar xf data.tar.* --no-same-permissions
'';
installPhase = ''
mkdir -p $out/bin $out/lib $out/share
cp -r usr/lib/antigravity-manager $out/lib/
cp -r usr/share/* $out/share/
ln -s $out/lib/antigravity-manager/antigravity-manager $out/bin/antigravity-manager
'';
postFixup = ''
# Wrap the executable so it finds Wayland/X11 and libsecret
wrapProgram $out/bin/antigravity-manager \
--add-flags "--enable-features=WaylandWindowDecorations" \
--add-flags "--ozone-platform-hint=auto" \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath [pkgs.libsecret]}
if [ -e $out/share/applications/antigravity-manager.desktop ]; then
substituteInPlace $out/share/applications/antigravity-manager.desktop \
--replace "/usr/lib/antigravity-manager/antigravity-manager" "antigravity-manager"
fi
'';
meta = with pkgs.lib; {
description = "Professional multi-account manager for Google Gemini & Claude AI";
homepage = "https://github.com/Draculabo/AntigravityManager";
license = licenses.cc-by-nc-sa-40;
maintainers = [];
platforms = ["x86_64-linux" "aarch64-linux"];
mainProgram = "antigravity-manager";
};
};
in {
overlays.default = final: prev: {
antigravity-manager = mkPackage final;
};
packages = forAllSystems (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
default = mkPackage pkgs;
});
};
}