diff --git a/.kiro/steering/build-deployment.md b/.kiro/steering/build-deployment.md index beac0b90..e494dae8 100644 --- a/.kiro/steering/build-deployment.md +++ b/.kiro/steering/build-deployment.md @@ -76,7 +76,7 @@ nix build .#xcecore_debug # default package: debug + ASAN nix build .#xcecli # CLI only ``` -**AppImage**: `nix build .#xcecore`/`.#xcecore_debug` do not produce an AppImage — they only install `xce` (a copy of `tools/appimage/entry.sh`, see `src/meson.build`) as a plain shell entry-point binary. The `xce` flake package (`appImageEntryPackage` in `src/flake.nix`) wraps that entry script with bundled daemons, haproxy, glow, and less; the actual `.AppImage` file is produced separately with `nix bundle --bundler github:ralismark/nix-appimage --option sandbox false .#xce` (see README.md, "3.5 build AppImage package"). +**AppImage**: `nix build .#xcecore`/`.#xcecore_debug` do not produce an AppImage — they only install `xce` (a copy of `tools/appimage/entry.sh`, see `src/meson.build`) as a plain shell entry-point binary. The `xce` flake package (`appImageEntryPackage` in `src/flake.nix`) wraps that entry script with bundled daemons, haproxy, glow, and less; the actual `.AppImage` file is produced by the `xce.appImage` flake output (`nix build .#xce.appImage`, via the `nix-appimage` flake input's `mkAppImage` — no external `nix bundle --bundler` invocation, see README.md 3.5). ## Local HA Cluster Deployment @@ -159,5 +159,5 @@ Go modules are independent — `apiserver` and `xcecli` have separate `go.mod` f | REST API server | same | `xce_apiserver` binary | | CLI tool | `nix build .#xcecli` | `xcecli` binary | | Admin config CLI (installable) | `/xce-build xceadmin` | `xceadmin--py3-none-any.whl` at `/xceadmin/dist/` — `pip install` it directly | -| AppImage | `nix bundle --bundler github:ralismark/nix-appimage --option sandbox false .#xce` | `.AppImage` bundle (see README.md 3.5) | +| AppImage | `nix build .#xce.appImage` | `xce.AppImage` bundle at `./result` (see README.md 3.5) | | Debug build | `nix build .#xcecore_debug` | full debug + ASAN binaries | diff --git a/README.md b/README.md index a5569aa7..f87c1f27 100644 --- a/README.md +++ b/README.md @@ -164,10 +164,10 @@ meson compile -C xce.build ```sh cd xce/src -nix bundle --bundler github:ralismark/nix-appimage .#xce +nix build .#xce.appImage ``` -This will create all in one AppImage file which contains everything for package delivery. +This will create an all-in-one `xce.AppImage` (available at `./result`) which contains everything for package delivery. # 4. misc ## 4.1. Windows remap ctrl and alt key diff --git a/src/flake.lock b/src/flake.lock index bf631ef3..65e369a6 100644 --- a/src/flake.lock +++ b/src/flake.lock @@ -20,6 +20,22 @@ "url": "ssh://forgejo@gitea.shenrs.eu/nexa/extralibs" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -110,6 +126,24 @@ "type": "github" } }, + "flake-utils_6": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "librtti": { "inputs": { "flake-utils": "flake-utils_3", @@ -131,6 +165,26 @@ "url": "ssh://forgejo@gitea.shenrs.eu/rshen/librtti" } }, + "nix-appimage": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1757920913, + "narHash": "sha256-jd0QwCVz4O1sHHkeaZILD/7D6oyalceEJ4EFnWCgm0k=", + "owner": "ralismark", + "repo": "nix-appimage", + "rev": "7946addbc0d97e358a6d7aefe5e82310f0fe6b18", + "type": "github" + }, + "original": { + "owner": "ralismark", + "repo": "nix-appimage", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1764517877, @@ -180,6 +234,22 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1745997950, + "narHash": "sha256-FklMkU+bPPx0L3i6pdrw65js05VO9He3DTeKguX9GQY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "cf3ffa5d140899101f1deb3f4d16b1a1aa2de849", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1769461804, "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=", @@ -195,7 +265,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1777954456, "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", @@ -325,7 +395,8 @@ "extralib": "extralib", "flake-utils": "flake-utils_2", "librtti": "librtti", - "nixpkgs": "nixpkgs_4", + "nix-appimage": "nix-appimage", + "nixpkgs": "nixpkgs_5", "xbuild": "xbuild_2" } }, @@ -404,6 +475,21 @@ "type": "github" } }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "uv2nix": { "inputs": { "nixpkgs": [ @@ -475,8 +561,8 @@ }, "xbuild_2": { "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_5", + "flake-utils": "flake-utils_6", + "nixpkgs": "nixpkgs_6", "npm-lockfile-fix": "npm-lockfile-fix", "pyproject-build-systems": "pyproject-build-systems", "pyproject-nix": "pyproject-nix_2", diff --git a/src/flake.nix b/src/flake.nix index 1845934d..663c82ec 100644 --- a/src/flake.nix +++ b/src/flake.nix @@ -7,9 +7,10 @@ extralib.url = "git+ssh://forgejo@gitea.shenrs.eu/nexa/extralibs?ref=main"; librtti.url = "git+ssh://forgejo@gitea.shenrs.eu/rshen/librtti?ref=master"; flake-utils.url = "github:numtide/flake-utils"; + nix-appimage.url = "github:ralismark/nix-appimage"; }; - outputs = { self, nixpkgs, xbuild, extralib, librtti, flake-utils }: + outputs = { self, nixpkgs, xbuild, extralib, librtti, flake-utils, nix-appimage }: let supportedSystems = [ "x86_64-linux" ]; myCommitId = @@ -68,7 +69,15 @@ inherit pkgs myCommitId myDirtyFingerprint; }; appImageScriptContent = builtins.readFile ./tools/appimage/entry.sh; - appImageEntryPackage = pkgs.writeShellApplication { + # The AppImage bundle, exposed as a passthru attribute on the `xce` + # package so it can be built directly with `nix build .#xce.appImage` + # -- no external `nix bundle --bundler github:ralismark/nix-appimage` + # invocation required. + appImage = nix-appimage.lib.${system}.mkAppImage { + program = "${appImageEntryPackage}/bin/xce"; + name = "xce.AppImage"; + }; + appImageEntryPackage = (pkgs.writeShellApplication { name = "xce"; runtimeInputs = with pkgs; [ xpkgs.xcecore @@ -92,7 +101,9 @@ meta = { mainProgram = "xce"; }; - }; + }).overrideAttrs (old: { + passthru = (old.passthru or {}) // { inherit appImage; }; + }); in rec { packages = pkgs // xpkgs // { xce = appImageEntryPackage; }; defaultPackage = xpkgs.xcecore_debug;