mirror of
https://github.com/thegeneralist01/config.git
synced 2026-12-04 18:56:56 +01:00
Pin source-built AeroSpace fork with left Option bindings
This commit is contained in:
parent
a4ff267f07
commit
8ec7a6d539
7 changed files with 384 additions and 87 deletions
|
|
@ -117,6 +117,47 @@ Hosts are automatically categorized based on naming conventions:
|
||||||
- Names ending with `mbp` or containing `central-mbp` → Darwin
|
- Names ending with `mbp` or containing `central-mbp` → Darwin
|
||||||
- All others → NixOS
|
- All others → NixOS
|
||||||
|
|
||||||
|
### Pinned AeroSpace fork
|
||||||
|
|
||||||
|
`thegeneralist-mbp` builds [N1ark/AeroSpace at `d720311`](https://github.com/N1ark/AeroSpace/commit/d720311090f5922c10c5d9bfb62cbc7d8120e9fc)
|
||||||
|
from source for left/right modifier support. All Option-based bindings use `lalt`,
|
||||||
|
leaving right Option available for typing. Other modifiers and commands are unchanged.
|
||||||
|
Config version 2 explicitly lists persistent workspaces, preserving the workspace
|
||||||
|
set that version 1 inferred from the bindings.
|
||||||
|
|
||||||
|
The build is defined in `nixpkgs-overlay/aerospace/`:
|
||||||
|
|
||||||
|
- `aerospace-src` in `flake.nix` and `flake.lock` pins the complete source revision, including its prerequisite commits.
|
||||||
|
- `swift-toolchain.nix` pins the official Swift **6.4.0** installer and its hash, matching the source's `.swift-version`.
|
||||||
|
- The source's `Package.resolved` supplies Swift dependency versions/revisions; `dependency-hashes.nix` fixes their archive hashes.
|
||||||
|
- The existing nixpkgs lock pins Apple SDK **26.0**, the linker, native libraries, documentation/completion tools, and signer.
|
||||||
|
- Both executables are release builds from the fork. Only compiled icon assets are reused from nixpkgs' pinned official AeroSpace release.
|
||||||
|
- The app bundle is ad-hoc signed without a developer certificate or host keychain. No manually built artifact or installed Xcode is needed.
|
||||||
|
|
||||||
|
Build the package without activating it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix --extra-experimental-features pipe-operators build .#aerospace --no-link
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply it through the existing Darwin service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo darwin-rebuild switch --flake .#thegeneralist-mbp \
|
||||||
|
--option extra-experimental-features pipe-operators
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart AeroSpace after updating if the CLI reports a client/server protocol mismatch:
|
||||||
|
the fork's CLI must be used with its matching app. macOS Accessibility approval
|
||||||
|
remains an OS-level action; a changed ad-hoc signature may require re-granting it.
|
||||||
|
Sided shortcuts do not work while Secure Input is enabled, including in password fields.
|
||||||
|
`lalt` matches left Option alone, not both Option keys held together.
|
||||||
|
|
||||||
|
To update the fork, change the full commit in `inputs.aerospace-src.url`, then run
|
||||||
|
`nix flake update aerospace-src`. Review `Package.resolved` and `.swift-version` at
|
||||||
|
the new revision and update the dependency/toolchain hashes when they change.
|
||||||
|
The source stays pinned during ordinary `nix flake update` operations.
|
||||||
|
|
||||||
## Module System
|
## Module System
|
||||||
|
|
||||||
### Common Modules
|
### Common Modules
|
||||||
|
|
|
||||||
18
flake.lock
generated
18
flake.lock
generated
|
|
@ -1,5 +1,22 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"aerospace-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1791045489,
|
||||||
|
"narHash": "sha256-y7k81pR6/zsF32tHnhftAeALRHrOkfycB9U8vRO00wM=",
|
||||||
|
"owner": "N1ark",
|
||||||
|
"repo": "AeroSpace",
|
||||||
|
"rev": "d720311090f5922c10c5d9bfb62cbc7d8120e9fc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "N1ark",
|
||||||
|
"repo": "AeroSpace",
|
||||||
|
"rev": "d720311090f5922c10c5d9bfb62cbc7d8120e9fc",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"agenix": {
|
"agenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"darwin": [
|
"darwin": [
|
||||||
|
|
@ -507,6 +524,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"aerospace-src": "aerospace-src",
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
"ghostty": "ghostty",
|
"ghostty": "ghostty",
|
||||||
|
|
|
||||||
10
flake.nix
10
flake.nix
|
|
@ -14,6 +14,11 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
aerospace-src = {
|
||||||
|
url = "github:N1ark/AeroSpace/d720311090f5922c10c5d9bfb62cbc7d8120e9fc";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
||||||
homebrew-core = {
|
homebrew-core = {
|
||||||
url = "github:homebrew/homebrew-core";
|
url = "github:homebrew/homebrew-core";
|
||||||
|
|
@ -92,6 +97,11 @@
|
||||||
# Darwin configurations for macOS hosts
|
# Darwin configurations for macOS hosts
|
||||||
darwinConfigurations = hostConfigs.darwin or { };
|
darwinConfigurations = hostConfigs.darwin or { };
|
||||||
|
|
||||||
|
packages.aarch64-darwin.aerospace =
|
||||||
|
nixpkgs.legacyPackages.aarch64-darwin.callPackage ./nixpkgs-overlay/aerospace {
|
||||||
|
src = inputs.aerospace-src;
|
||||||
|
};
|
||||||
|
|
||||||
# Development shells
|
# Development shells
|
||||||
devShells = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (
|
devShells = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ] (
|
||||||
system:
|
system:
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
|
{ inputs, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
system.primaryUser = "thegeneralist";
|
system.primaryUser = "thegeneralist";
|
||||||
|
|
||||||
# TODO: explore this.
|
# Left Option drives AeroSpace; right Option remains available for typing.
|
||||||
# Stuff below is temporary because MacOS' default window management is terrible.
|
|
||||||
services.aerospace = {
|
services.aerospace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.aerospace;
|
||||||
settings = {
|
settings = {
|
||||||
|
config-version = 2;
|
||||||
|
# Keep the workspaces that version 1 inferred from the bindings.
|
||||||
|
persistent-workspaces = [
|
||||||
|
"1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
|
||||||
|
"A" "B" "C" "D" "E" "F" "G" "I" "M" "N" "O"
|
||||||
|
"P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"
|
||||||
|
];
|
||||||
|
|
||||||
# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
|
# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
|
||||||
enable-normalization-flatten-containers = true;
|
enable-normalization-flatten-containers = true;
|
||||||
enable-normalization-opposite-orientation-for-nested-containers = true;
|
enable-normalization-opposite-orientation-for-nested-containers = true;
|
||||||
|
|
@ -80,14 +90,14 @@
|
||||||
# keypadMinus, keypadMultiply, keypadPlus
|
# keypadMinus, keypadMultiply, keypadPlus
|
||||||
# - Arrows. left, down, up, right
|
# - Arrows. left, down, up, right
|
||||||
|
|
||||||
# All possible modifiers: cmd, alt, ctrl, shift
|
# Modifiers: cmd, alt, ctrl, shift; prefix l/r to restrict a side.
|
||||||
|
|
||||||
# All possible commands: https://nikitabobko.github.io/AeroSpace/commands
|
# All possible commands: https://nikitabobko.github.io/AeroSpace/commands
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget
|
# See: https://nikitabobko.github.io/AeroSpace/commands#exec-and-forget
|
||||||
# You can uncomment the following lines to open up terminal with alt + enter shortcut
|
# You can uncomment the following lines to open a terminal with left Option + Enter
|
||||||
# (like in i3)
|
# (like in i3)
|
||||||
# alt-enter = '''exec-and-forget osascript -e '
|
# lalt-enter = '''exec-and-forget osascript -e '
|
||||||
# tell application "Terminal"
|
# tell application "Terminal"
|
||||||
# do script
|
# do script
|
||||||
# activate
|
# activate
|
||||||
|
|
@ -95,99 +105,99 @@
|
||||||
# '''
|
# '''
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#layout
|
# See: https://nikitabobko.github.io/AeroSpace/commands#layout
|
||||||
alt-slash = "layout tiles horizontal vertical";
|
lalt-slash = "layout tiles horizontal vertical";
|
||||||
alt-comma = "layout accordion horizontal vertical";
|
lalt-comma = "layout accordion horizontal vertical";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#focus
|
# See: https://nikitabobko.github.io/AeroSpace/commands#focus
|
||||||
alt-h = "focus left";
|
lalt-h = "focus left";
|
||||||
alt-j = "focus down";
|
lalt-j = "focus down";
|
||||||
alt-k = "focus up";
|
lalt-k = "focus up";
|
||||||
alt-l = "focus right";
|
lalt-l = "focus right";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#move
|
# See: https://nikitabobko.github.io/AeroSpace/commands#move
|
||||||
alt-shift-h = "move left";
|
lalt-shift-h = "move left";
|
||||||
alt-shift-j = "move down";
|
lalt-shift-j = "move down";
|
||||||
alt-shift-k = "move up";
|
lalt-shift-k = "move up";
|
||||||
alt-shift-l = "move right";
|
lalt-shift-l = "move right";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
|
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
|
||||||
alt-minus = "resize smart -50";
|
lalt-minus = "resize smart -50";
|
||||||
alt-equal = "resize smart +50";
|
lalt-equal = "resize smart +50";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
|
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
|
||||||
alt-0 = "workspace 10";
|
lalt-0 = "workspace 10";
|
||||||
alt-1 = "workspace 1";
|
lalt-1 = "workspace 1";
|
||||||
alt-2 = "workspace 2";
|
lalt-2 = "workspace 2";
|
||||||
alt-3 = "workspace 3";
|
lalt-3 = "workspace 3";
|
||||||
alt-4 = "workspace 4";
|
lalt-4 = "workspace 4";
|
||||||
alt-5 = "workspace 5";
|
lalt-5 = "workspace 5";
|
||||||
alt-6 = "workspace 6";
|
lalt-6 = "workspace 6";
|
||||||
alt-7 = "workspace 7";
|
lalt-7 = "workspace 7";
|
||||||
alt-8 = "workspace 8";
|
lalt-8 = "workspace 8";
|
||||||
alt-9 = "workspace 9";
|
lalt-9 = "workspace 9";
|
||||||
alt-a = "workspace A"; # In your config, you can drop workspace bindings that you don't need
|
lalt-a = "workspace A"; # In your config, you can drop workspace bindings that you don't need
|
||||||
alt-b = "workspace B";
|
lalt-b = "workspace B";
|
||||||
alt-c = "workspace C";
|
lalt-c = "workspace C";
|
||||||
alt-d = "workspace D";
|
lalt-d = "workspace D";
|
||||||
alt-e = "workspace E";
|
lalt-e = "workspace E";
|
||||||
alt-f = "workspace F";
|
lalt-f = "workspace F";
|
||||||
alt-g = "workspace G";
|
lalt-g = "workspace G";
|
||||||
alt-i = "workspace I";
|
lalt-i = "workspace I";
|
||||||
alt-m = "workspace M";
|
lalt-m = "workspace M";
|
||||||
alt-n = "workspace N";
|
lalt-n = "workspace N";
|
||||||
alt-o = "workspace O";
|
lalt-o = "workspace O";
|
||||||
alt-p = "workspace P";
|
lalt-p = "workspace P";
|
||||||
alt-q = "workspace Q";
|
lalt-q = "workspace Q";
|
||||||
alt-r = "workspace R";
|
lalt-r = "workspace R";
|
||||||
alt-s = "workspace S";
|
lalt-s = "workspace S";
|
||||||
alt-t = "workspace T";
|
lalt-t = "workspace T";
|
||||||
alt-u = "workspace U";
|
lalt-u = "workspace U";
|
||||||
alt-v = "workspace V";
|
lalt-v = "workspace V";
|
||||||
alt-w = "workspace W";
|
lalt-w = "workspace W";
|
||||||
alt-x = "workspace X";
|
lalt-x = "workspace X";
|
||||||
alt-y = "workspace Y";
|
lalt-y = "workspace Y";
|
||||||
alt-z = "workspace Z";
|
lalt-z = "workspace Z";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
|
# See: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace
|
||||||
alt-shift-1 = "move-node-to-workspace 1";
|
lalt-shift-1 = "move-node-to-workspace 1";
|
||||||
alt-shift-2 = "move-node-to-workspace 2";
|
lalt-shift-2 = "move-node-to-workspace 2";
|
||||||
alt-shift-3 = "move-node-to-workspace 3";
|
lalt-shift-3 = "move-node-to-workspace 3";
|
||||||
alt-shift-4 = "move-node-to-workspace 4";
|
lalt-shift-4 = "move-node-to-workspace 4";
|
||||||
alt-shift-5 = "move-node-to-workspace 5";
|
lalt-shift-5 = "move-node-to-workspace 5";
|
||||||
alt-shift-6 = "move-node-to-workspace 6";
|
lalt-shift-6 = "move-node-to-workspace 6";
|
||||||
alt-shift-7 = "move-node-to-workspace 7";
|
lalt-shift-7 = "move-node-to-workspace 7";
|
||||||
alt-shift-8 = "move-node-to-workspace 8";
|
lalt-shift-8 = "move-node-to-workspace 8";
|
||||||
alt-shift-9 = "move-node-to-workspace 9";
|
lalt-shift-9 = "move-node-to-workspace 9";
|
||||||
alt-shift-a = "move-node-to-workspace A";
|
lalt-shift-a = "move-node-to-workspace A";
|
||||||
alt-shift-b = "move-node-to-workspace B";
|
lalt-shift-b = "move-node-to-workspace B";
|
||||||
alt-shift-c = "move-node-to-workspace C";
|
lalt-shift-c = "move-node-to-workspace C";
|
||||||
alt-shift-d = "move-node-to-workspace D";
|
lalt-shift-d = "move-node-to-workspace D";
|
||||||
alt-shift-e = "move-node-to-workspace E";
|
lalt-shift-e = "move-node-to-workspace E";
|
||||||
alt-shift-f = "move-node-to-workspace F";
|
lalt-shift-f = "move-node-to-workspace F";
|
||||||
alt-shift-g = "move-node-to-workspace G";
|
lalt-shift-g = "move-node-to-workspace G";
|
||||||
alt-shift-i = "move-node-to-workspace I";
|
lalt-shift-i = "move-node-to-workspace I";
|
||||||
alt-shift-m = "move-node-to-workspace M";
|
lalt-shift-m = "move-node-to-workspace M";
|
||||||
alt-shift-n = "move-node-to-workspace N";
|
lalt-shift-n = "move-node-to-workspace N";
|
||||||
alt-shift-o = "move-node-to-workspace O";
|
lalt-shift-o = "move-node-to-workspace O";
|
||||||
alt-shift-p = "move-node-to-workspace P";
|
lalt-shift-p = "move-node-to-workspace P";
|
||||||
alt-shift-q = "move-node-to-workspace Q";
|
lalt-shift-q = "move-node-to-workspace Q";
|
||||||
alt-shift-r = "move-node-to-workspace R";
|
lalt-shift-r = "move-node-to-workspace R";
|
||||||
alt-shift-s = "move-node-to-workspace S";
|
lalt-shift-s = "move-node-to-workspace S";
|
||||||
alt-shift-t = "move-node-to-workspace T";
|
lalt-shift-t = "move-node-to-workspace T";
|
||||||
alt-shift-u = "move-node-to-workspace U";
|
lalt-shift-u = "move-node-to-workspace U";
|
||||||
alt-shift-v = "move-node-to-workspace V";
|
lalt-shift-v = "move-node-to-workspace V";
|
||||||
alt-shift-w = "move-node-to-workspace W";
|
lalt-shift-w = "move-node-to-workspace W";
|
||||||
alt-shift-x = "move-node-to-workspace X";
|
lalt-shift-x = "move-node-to-workspace X";
|
||||||
alt-shift-y = "move-node-to-workspace Y";
|
lalt-shift-y = "move-node-to-workspace Y";
|
||||||
alt-shift-z = "move-node-to-workspace Z";
|
lalt-shift-z = "move-node-to-workspace Z";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
|
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace-back-and-forth
|
||||||
alt-tab = "workspace-back-and-forth";
|
lalt-tab = "workspace-back-and-forth";
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
|
# See: https://nikitabobko.github.io/AeroSpace/commands#move-workspace-to-monitor
|
||||||
alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
|
lalt-shift-tab = "move-workspace-to-monitor --wrap-around next";
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#mode
|
# See: https://nikitabobko.github.io/AeroSpace/commands#mode
|
||||||
alt-shift-semicolon = "mode service";
|
lalt-shift-semicolon = "mode service";
|
||||||
};
|
};
|
||||||
|
|
||||||
# 'service' binding mode declaration.
|
# 'service' binding mode declaration.
|
||||||
|
|
@ -201,10 +211,10 @@
|
||||||
# sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
|
# sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
|
||||||
#s = ['layout sticky tiling', 'mode main']
|
#s = ['layout sticky tiling', 'mode main']
|
||||||
|
|
||||||
alt-shift-h = [ "join-with left" "mode main" ];
|
lalt-shift-h = [ "join-with left" "mode main" ];
|
||||||
alt-shift-j = [ "join-with down" "mode main" ];
|
lalt-shift-j = [ "join-with down" "mode main" ];
|
||||||
alt-shift-k = [ "join-with up" "mode main" ];
|
lalt-shift-k = [ "join-with up" "mode main" ];
|
||||||
alt-shift-l = [ "join-with right" "mode main" ];
|
lalt-shift-l = [ "join-with right" "mode main" ];
|
||||||
|
|
||||||
down = "volume down";
|
down = "volume down";
|
||||||
up = "volume up";
|
up = "volume up";
|
||||||
|
|
|
||||||
166
nixpkgs-overlay/aerospace/default.nix
Normal file
166
nixpkgs-overlay/aerospace/default.nix
Normal file
|
|
@ -0,0 +1,166 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
callPackage,
|
||||||
|
fetchFromGitHub,
|
||||||
|
apple-sdk_26,
|
||||||
|
aerospace,
|
||||||
|
asciidoctor,
|
||||||
|
complgen,
|
||||||
|
installShellFiles,
|
||||||
|
darwin,
|
||||||
|
rcodesign,
|
||||||
|
libcxx,
|
||||||
|
cups,
|
||||||
|
src,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
swift = callPackage ./swift-toolchain.nix { };
|
||||||
|
pins = (builtins.fromJSON (builtins.readFile "${src}/Package.resolved")).pins;
|
||||||
|
hashes = import ./dependency-hashes.nix;
|
||||||
|
dependencies = map (pin: {
|
||||||
|
inherit (pin) identity;
|
||||||
|
source = fetchFromGitHub {
|
||||||
|
owner = builtins.elemAt (lib.splitString "/" pin.location) 3;
|
||||||
|
repo = lib.removeSuffix ".git" (lib.last (lib.splitString "/" pin.location));
|
||||||
|
rev = pin.state.revision;
|
||||||
|
hash = hashes.${pin.identity};
|
||||||
|
name = pin.identity;
|
||||||
|
};
|
||||||
|
}) pins;
|
||||||
|
version = "0-unstable-${builtins.substring 0 8 src.lastModifiedDate}-${builtins.substring 0 7 src.rev}";
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "aerospace";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ swift asciidoctor complgen installShellFiles rcodesign ];
|
||||||
|
# nixpkgs removes these system-library stubs from its Apple SDK.
|
||||||
|
buildInputs = [ apple-sdk_26 libcxx (lib.getLib cups) ];
|
||||||
|
strictDeps = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
# Use the exact Package.resolved revisions, without SwiftPM network access.
|
||||||
|
mkdir -p .deps
|
||||||
|
${lib.concatMapStringsSep "\n" (dep: ''
|
||||||
|
cp -R ${dep.source} .deps/${dep.identity}
|
||||||
|
chmod -R u+w .deps/${dep.identity}
|
||||||
|
'') dependencies}
|
||||||
|
substituteInPlace Package.swift \
|
||||||
|
--replace-fail '.package(url: "https://github.com/InerziaSoft/ISSoundAdditions.git", exact: "2.0.1")' '.package(path: ".deps/issoundadditions")' \
|
||||||
|
--replace-fail '.package(url: "https://github.com/dduan/TOMLDecoder", exact: "0.4.4")' '.package(path: ".deps/tomldecoder")' \
|
||||||
|
--replace-fail '.package(url: "https://github.com/apple/swift-collections.git", exact: "1.3.0")' '.package(path: ".deps/swift-collections")' \
|
||||||
|
--replace-fail '.package(url: "https://github.com/soffes/HotKey.git", exact: "0.2.1")' '.package(path: ".deps/hotkey")'
|
||||||
|
|
||||||
|
# Upstream's generators use BSD sed and bootstrap tools from the network.
|
||||||
|
# Keep the generators, but use Nix's tools and skip their bootstrap setup.
|
||||||
|
substituteInPlace generate.sh --replace-fail ${lib.escapeShellArg "sed -i ''"} "sed -i"
|
||||||
|
substituteInPlace generate.sh script/generate-cmd-help.sh \
|
||||||
|
--replace-fail 'source ./script/setup.sh' 'set -euo pipefail'
|
||||||
|
patchShebangs generate.sh script/generate-cmd-help.sh
|
||||||
|
bash ./generate.sh --ignore-xcodeproj --build-version ${lib.escapeShellArg version}
|
||||||
|
cat > Sources/Common/gitHashGenerated.swift <<'EOF'
|
||||||
|
public let gitHash = "${src.rev}"
|
||||||
|
public let gitShortHash = "${builtins.substring 0 7 src.rev}"
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
export HOME="$TMPDIR/home"
|
||||||
|
mkdir -p "$HOME"
|
||||||
|
export CFFIXED_USER_HOME="$HOME"
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=13.0
|
||||||
|
export SDKROOT=${apple-sdk_26.sdkroot}
|
||||||
|
export SWIFT_EXEC=${swift}/usr/bin/swiftc
|
||||||
|
export LIBTOOL=${darwin.cctools}/bin/libtool
|
||||||
|
export CLANG_MODULE_CACHE_PATH="$TMPDIR/clang-module-cache"
|
||||||
|
export SWIFTPM_MODULECACHE_OVERRIDE="$TMPDIR/swift-module-cache"
|
||||||
|
# SwiftPM otherwise probes /usr/bin/xcrun for the manifest library's minos.
|
||||||
|
# The pinned libPackageDescription.dylib targets macOS 14; the app targets 13.
|
||||||
|
swiftFlags=(
|
||||||
|
--configuration release --disable-sandbox
|
||||||
|
--sdk "$SDKROOT" --jobs "$NIX_BUILD_CORES"
|
||||||
|
-Xbuild-tools-swiftc -target -Xbuild-tools-swiftc arm64-apple-macosx14.0
|
||||||
|
-Xlinker -L${lib.getLib libcxx}/lib
|
||||||
|
-Xlinker -L${lib.getLib cups}/lib
|
||||||
|
)
|
||||||
|
swift build "''${swiftFlags[@]}" --product aerospace
|
||||||
|
swift build "''${swiftFlags[@]}" --product AeroSpaceApp
|
||||||
|
binPath="$(swift build "''${swiftFlags[@]}" --show-bin-path)"
|
||||||
|
|
||||||
|
asciidoctor -b manpage -D .man docs/aerospace*.adoc
|
||||||
|
mkdir -p .shell-completion
|
||||||
|
complgen --zsh .shell-completion/_aerospace grammar/commands-bnf-grammar.txt
|
||||||
|
complgen --fish .shell-completion/aerospace.fish grammar/commands-bnf-grammar.txt
|
||||||
|
complgen --bash .shell-completion/aerospace.bash grammar/commands-bnf-grammar.txt
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
app="$out/Applications/AeroSpace.app"
|
||||||
|
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$out/bin"
|
||||||
|
install -m755 "$binPath/AeroSpaceApp" "$app/Contents/MacOS/AeroSpace"
|
||||||
|
install -m755 "$binPath/aerospace" "$out/bin/aerospace"
|
||||||
|
|
||||||
|
# Only the precompiled artwork comes from nixpkgs' pinned official release.
|
||||||
|
# Both executables and the default config are built from the fork above.
|
||||||
|
cp ${aerospace}/Applications/AeroSpace.app/Contents/Resources/{AppIcon.icns,Assets.car} "$app/Contents/Resources/"
|
||||||
|
cp docs/config-examples/default-config.toml "$app/Contents/Resources/"
|
||||||
|
cat > "$app/Contents/Info.plist" <<'EOF'
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0"><dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key><string>en</string>
|
||||||
|
<key>CFBundleExecutable</key><string>AeroSpace</string>
|
||||||
|
<key>CFBundleIdentifier</key><string>bobko.aerospace</string>
|
||||||
|
<key>CFBundleName</key><string>AeroSpace</string>
|
||||||
|
<key>CFBundlePackageType</key><string>APPL</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
||||||
|
<key>CFBundleShortVersionString</key><string>${version}</string>
|
||||||
|
<key>CFBundleIconFile</key><string>AppIcon</string>
|
||||||
|
<key>CFBundleIconName</key><string>AppIcon</string>
|
||||||
|
<key>LSMinimumSystemVersion</key><string>13.0</string>
|
||||||
|
<key>LSUIElement</key><true/>
|
||||||
|
</dict></plist>
|
||||||
|
EOF
|
||||||
|
printf APPL'????' > "$app/Contents/PkgInfo"
|
||||||
|
installManPage .man/*.1
|
||||||
|
installShellCompletion --cmd aerospace \
|
||||||
|
--bash .shell-completion/aerospace.bash \
|
||||||
|
--fish .shell-completion/aerospace.fish \
|
||||||
|
--zsh .shell-completion/_aerospace
|
||||||
|
mkdir -p "$out/share/doc/aerospace"
|
||||||
|
cp LICENSE.txt "$out/share/doc/aerospace/"
|
||||||
|
cp -R legal "$out/share/doc/aerospace/"
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Sign after fixups; no developer certificate or host keychain is needed.
|
||||||
|
postFixup = ''
|
||||||
|
# SwiftBuild embeds build-only compatibility paths. Runtime libraries use
|
||||||
|
# macOS or Nix install names; don't retain the compiler and SDK at runtime.
|
||||||
|
for binary in "$out/bin/aerospace" "$out/Applications/AeroSpace.app/Contents/MacOS/AeroSpace"; do
|
||||||
|
${darwin.cctools}/bin/install_name_tool \
|
||||||
|
-delete_rpath ${swift}/usr/lib/swift-6.2/macosx \
|
||||||
|
-delete_rpath ${apple-sdk_26}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-6.2/macosx \
|
||||||
|
"$binary"
|
||||||
|
done
|
||||||
|
rcodesign sign --config-file /dev/null --timestamp-url none \
|
||||||
|
--binary-identifier aerospace "$out/bin/aerospace"
|
||||||
|
rcodesign sign --config-file /dev/null --timestamp-url none \
|
||||||
|
--entitlements-xml-file ${src}/resources/AeroSpace.entitlements \
|
||||||
|
"$out/Applications/AeroSpace.app"
|
||||||
|
'';
|
||||||
|
|
||||||
|
disallowedReferences = [ swift apple-sdk_26 ];
|
||||||
|
|
||||||
|
meta = aerospace.meta // {
|
||||||
|
homepage = "https://github.com/N1ark/AeroSpace";
|
||||||
|
description = "AeroSpace with left/right modifier bindings";
|
||||||
|
platforms = [ "aarch64-darwin" ];
|
||||||
|
sourceProvenance = with lib.sourceTypes; [ fromSource binaryNativeCode ];
|
||||||
|
};
|
||||||
|
}
|
||||||
7
nixpkgs-overlay/aerospace/dependency-hashes.nix
Normal file
7
nixpkgs-overlay/aerospace/dependency-hashes.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Revisions and versions come from the pinned AeroSpace source's Package.resolved.
|
||||||
|
{
|
||||||
|
hotkey = "sha256-t6HExQe+yXa951inZHfOILNsDrcFxNxPmrBhKtmL6eA=";
|
||||||
|
issoundadditions = "sha256-tCv5XtyMOq0ZOeNPaWXryTg57KsZCpyisc3NQziIQs0=";
|
||||||
|
swift-collections = "sha256-Bhfmf02JbmEdM1TFdM8UGxlouR8kr61WlU1uI2v67v8=";
|
||||||
|
tomldecoder = "sha256-YOR8nAp89zJOk2ZkmISfdzYJm6euuNrTJmOHcfpptco=";
|
||||||
|
}
|
||||||
45
nixpkgs-overlay/aerospace/swift-toolchain.nix
Normal file
45
nixpkgs-overlay/aerospace/swift-toolchain.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenvNoCC,
|
||||||
|
fetchurl,
|
||||||
|
xar,
|
||||||
|
cpio,
|
||||||
|
bintools,
|
||||||
|
}:
|
||||||
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
|
pname = "aerospace-swift-toolchain";
|
||||||
|
# Matches .swift-version in the pinned AeroSpace source.
|
||||||
|
version = "6.4.0";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://download.swift.org/swift-${finalAttrs.version}-release/xcode/swift-${finalAttrs.version}-RELEASE/swift-${finalAttrs.version}-RELEASE-osx.pkg";
|
||||||
|
hash = "sha256-j9AxhbmP4n9UpUYxwkSd7PddW0Zs6ONKu9QUFBBjxqo=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ xar cpio ];
|
||||||
|
dontUnpack = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
# Preserve the toolchain's layout, relative dylib paths, and existing signatures.
|
||||||
|
dontFixup = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
xar -xf "$src" swift-${finalAttrs.version}-RELEASE-osx-package.pkg/Payload
|
||||||
|
mkdir -p "$out"
|
||||||
|
cd "$out"
|
||||||
|
gzip -dc "$NIX_BUILD_TOP/swift-${finalAttrs.version}-RELEASE-osx-package.pkg/Payload" | cpio -idm --quiet
|
||||||
|
# Use the pinned linker without Nix's C-driver default SDK flags.
|
||||||
|
ln -s ${bintools.bintools}/bin/ld usr/bin/ld
|
||||||
|
ln -s usr/bin bin
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Pinned Swift toolchain for building the AeroSpace fork";
|
||||||
|
homepage = "https://www.swift.org/download/";
|
||||||
|
license = lib.licenses.asl20;
|
||||||
|
platforms = [ "aarch64-darwin" ];
|
||||||
|
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||||
|
};
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue