Skip to content

Commit 3724e97

Browse files
generate macos app bundles (#74)
* generate macos app bundles * remove unused nix files * update README * provide entitlements and disable library verification * scripts: add example of sign and notarize script Tested and its working but up to step with signing and repackaging .lgx files can be done when creating the bundle. * bump nix-bundle-macos-app, remove duplicate steps from notarization script --------- Co-authored-by: markoburcul <marko@status.im>
1 parent 0c688fd commit 3724e97

File tree

9 files changed

+319
-381
lines changed

9 files changed

+319
-381
lines changed
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: AppImage Build & Release
1+
name: Build & Release
22

33
on:
44
push:
@@ -40,9 +40,30 @@ jobs:
4040
name: appimage-${{ matrix.arch }}
4141
path: logos-app-*.AppImage
4242

43+
build-macos-app:
44+
runs-on: macos-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- uses: DeterminateSystems/nix-installer-action@main
50+
51+
- name: Build bin-macos-app
52+
run: nix build .#bin-macos-app
53+
54+
- name: Package app bundle as tarball
55+
run: |
56+
app=$(find result/ -name '*.app' -maxdepth 1 -print -quit)
57+
tar -czf logos-app-aarch64-unsigned.app.tar.gz -C result "$(basename "$app")"
58+
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: macos-app-aarch64-darwin
62+
path: logos-app-aarch64-unsigned.app.tar.gz
63+
4364
release:
4465
if: github.event_name == 'push'
45-
needs: build-appimage
66+
needs: [build-appimage, build-macos-app]
4667
runs-on: ubuntu-latest
4768
permissions:
4869
contents: write
@@ -58,6 +79,11 @@ jobs:
5879
name: appimage-aarch64-linux
5980
path: artifacts/
6081

82+
- uses: actions/download-artifact@v4
83+
with:
84+
name: macos-app-aarch64-darwin
85+
path: artifacts/
86+
6187
- name: Generate tag
6288
id: tag
6389
run: echo "tag=pre-release-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
@@ -67,4 +93,6 @@ jobs:
6793
tag_name: ${{ steps.tag.outputs.tag }}
6894
name: Pre-release ${{ steps.tag.outputs.tag }}
6995
prerelease: true
70-
files: artifacts/*.AppImage
96+
files: |
97+
artifacts/*.AppImage
98+
artifacts/*.app.tar.gz

README.md

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,90 +4,75 @@
44

55
### Using Nix (Recommended)
66

7-
#### Build Complete Application
7+
#### Local Build
88

9-
```bash
10-
# Build everything (default)
11-
nix build
9+
The local build produces a standard Nix derivation whose dependencies live in `/nix/store`. It is the fastest way to iterate during development but is **not portable** — it only runs on the machine that built it.
1210

13-
# Or explicitly
14-
nix build '.#default'
11+
```bash
12+
nix build '.#app'
13+
./result/bin/logos-app
1514
```
1615

17-
The result will include:
18-
- `/bin/logos-app` - The main Logos application executable
19-
- All required modules and dependencies
20-
21-
#### Build Individual Components
16+
Local builds require **local** `.lgx` packages, generated with:
2217

2318
```bash
24-
# Build only the main application
25-
nix build '.#app'
19+
nix bundle --bundler github:logos-co/nix-bundle-lgx github:your-user/your-module#lib
2620
```
2721

28-
#### Development Shell
22+
#### Portable Builds
2923

24+
Portable builds are fully self-contained — no `/nix/store` references at runtime. They work with **portable** `.lgx` packages. That is, releases from [logos-modules](https://github.com/logos-co/logos-modules), downloads from the Package Manager UI, or generated with:
3025
```bash
31-
# Enter development shell with all dependencies
32-
nix develop
26+
nix bundle --bundler github:logos-co/nix-bundle-lgx#portable github:your-user/your-module#lib
3327
```
3428

35-
**Note:** In zsh, you need to quote the target (e.g., `'.#default'`) to prevent glob expansion.
36-
37-
If you don't have flakes enabled globally, add experimental flags:
29+
| Output | Platform | Format |
30+
|---|---|---|
31+
| `bin-bundle-dir` | Linux, macOS | Flat directory with `bin/` and `lib/` |
32+
| `bin-appimage` | Linux | Single-file `.AppImage` executable |
33+
| `bin-macos-app` | macOS | `.app` bundle (ad-hoc signed, unsigned for distribution) |
3834

35+
##### Self-contained directory bundle (all platforms)
3936
```bash
40-
nix build --extra-experimental-features 'nix-command flakes'
37+
nix build '.#bin-bundle-dir'
38+
./result/bin/LogosApp
4139
```
4240

43-
The compiled artifacts can be found at `result/`
41+
##### Linux AppImage (Linux only)
42+
```bash
43+
nix build '.#bin-appimage'
44+
./result/logos-app.AppImage
45+
```
4446

45-
#### Running the Application
4647

47-
After building with `nix build`, you can run the application:
48+
##### MacOS App bundle (macOS only)
4849

4950
```bash
50-
# Run the main Logos application
51-
./result/bin/logos-app
51+
nix build '.#bin-macos-app'
52+
open result/LogosApp.app
5253
```
5354

54-
The application will automatically load all required modules and dependencies. All components are bundled in the Nix store layout.
5555

56-
#### macOS Distribution (Experimental)
57-
58-
Build a standalone `.app` bundle or DMG installer for macOS. This is experimental and intended for testing purposes.
56+
#### Development Shell
5957

6058
```bash
61-
# Build .app bundle
62-
nix build '.#app-bundle'
63-
64-
# Build DMG installer
65-
nix build '.#dmg'
59+
nix develop
6660
```
6761

68-
The outputs will be at:
69-
- `result/LogosApp.app/` - Application bundle
70-
- `result/LogosApp.dmg` - DMG installer
71-
72-
#### Linux AppImage (Experimental)
62+
**Note:** In zsh, quote the target (e.g., `'.#app'`) to prevent glob expansion.
7363

74-
Build a self-contained AppImage on Linux hosts:
64+
If you don't have flakes enabled globally:
7565

7666
```bash
77-
nix build '.#appimage'
67+
nix build --extra-experimental-features 'nix-command flakes'
7868
```
7969

80-
The output will be at `result/LogosApp-<version>.AppImage`.
81-
8270
#### Nix Organization
8371

8472
The nix build system is organized into modular files in the `/nix` directory:
8573
- `nix/default.nix` - Common configuration and main application build
8674
- `nix/app.nix` - Application-specific compilation settings
8775
- `nix/main-ui.nix` - UI components compilation
88-
- `nix/counter.nix` - Counter module compilation
89-
- `nix/macos-bundle.nix` - macOS .app bundle (darwin only)
90-
- `nix/macos-dmg.nix` - macOS DMG installer (darwin only)
9176

9277
## Modules
9378

app/macos/LogosApp.entitlements

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.disable-library-validation</key>
6+
<true/>
7+
</dict>
8+
</plist>

flake.lock

Lines changed: 33 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
1818
nix-bundle-dir.url = "github:logos-co/nix-bundle-dir";
1919
nix-bundle-appimage.url = "github:logos-co/nix-bundle-appimage";
20+
nix-bundle-macos-app = {
21+
url = "github:logos-co/nix-bundle-macos-app";
22+
inputs.nixpkgs.follows = "nixpkgs";
23+
inputs.nix-bundle-dir.follows = "nix-bundle-dir";
24+
};
2025
};
2126

22-
outputs = { self, nixpkgs, logos-cpp-sdk, logos-liblogos, logos-package-manager, logos-capability-module, logos-package, logos-package-manager-ui, logos-webview-app, logos-design-system, logos-counter-qml, logos-counter, nix-bundle-lgx, nix-bundle-dir, nix-bundle-appimage }:
27+
outputs = { self, nixpkgs, logos-cpp-sdk, logos-liblogos, logos-package-manager, logos-capability-module, logos-package, logos-package-manager-ui, logos-webview-app, logos-design-system, logos-counter-qml, logos-counter, nix-bundle-lgx, nix-bundle-dir, nix-bundle-appimage, nix-bundle-macos-app }:
2328
let
2429
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
2530
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f {
@@ -153,6 +158,15 @@
153158
desktopFile = ./assets/logos-app.desktop;
154159
icon = ./app/icons/logos.png;
155160
};
161+
} // pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
162+
bin-macos-app = nix-bundle-macos-app.lib.${system}.mkMacOSApp {
163+
drv = appDistributed;
164+
name = "LogosApp";
165+
bundle = dirBundler appDistributed;
166+
icon = ./app/macos/logos.icns;
167+
infoPlist = ./app/macos/Info.plist.in;
168+
entitlements = ./app/macos/LogosApp.entitlements;
169+
};
156170
} // (if pkgs.stdenv.isDarwin then {
157171
# macOS distribution outputs
158172
app-bundle = appBundle;

0 commit comments

Comments
 (0)