Skip to content

Commit 6098ed2

Browse files
committed
feat(deps): add support for Nix package manager
This serves as an alternative to Homebrew. It should be much more stable and cause less headaches over time for automated builds. There should be no change to the end user experience of using the build script, as it should still work with and use Homebrew by default. Additionally, Nix provides older Apple SDK's, so builds run against macOS 11.x SDKs via Nix. This should in theory allow the resulting Emacs.app builds should be compatible with older macOS versions. Exactly how well that holds up in practice remains to be seen. Nix does support customizing the Apple SDK version, but I have not yet figured out how to do so via a flake, and it's not a priority at the moment, as the default v11 SDK is sufficient.
1 parent 970cb68 commit 6098ed2

File tree

13 files changed

+600
-159
lines changed

13 files changed

+600
-159
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
11-
- uses: actions/setup-go@v4
11+
- uses: actions/setup-go@v5
1212
with:
13-
go-version: "1.20"
13+
go-version: "1.23"
1414
- name: golangci-lint
15-
uses: golangci/golangci-lint-action@v3
15+
uses: golangci/golangci-lint-action@v6
1616
with:
17-
version: v1.55
17+
version: v1.61
1818
env:
1919
VERBOSE: "true"
2020

@@ -23,9 +23,9 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4
26-
- uses: actions/setup-go@v4
26+
- uses: actions/setup-go@v5
2727
with:
28-
go-version: "1.20"
28+
go-version: "1.23"
2929
- name: Check if mods are tidy
3030
run: make check-tidy
3131

@@ -34,9 +34,9 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@v4
37-
- uses: actions/setup-go@v4
37+
- uses: actions/setup-go@v5
3838
with:
39-
go-version: "1.20"
39+
go-version: "1.23"
4040
- name: Run tests
4141
run: make test
4242
env:

.golangci.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ linters-settings:
77
gocyclo:
88
min-complexity: 20
99
govet:
10-
check-shadowing: true
1110
enable-all: true
1211
disable:
1312
- fieldalignment
@@ -23,9 +22,9 @@ linters:
2322
disable-all: true
2423
enable:
2524
- bodyclose
25+
- copyloopvar
2626
- dupl
2727
- errcheck
28-
- exportloopref
2928
- funlen
3029
- gochecknoinits
3130
- goconst
@@ -72,12 +71,12 @@ issues:
7271
- source: "`yaml:"
7372
linters:
7473
- lll
75-
76-
run:
77-
skip-dirs:
74+
exclude-dirs:
7875
- builds
7976
- sources
8077
- tarballs
78+
79+
run:
8180
timeout: 2m
8281
allow-parallel-runners: true
8382
modules-download-mode: readonly

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $(TOOLDIR)/$(1): Makefile
6969
endef
7070

7171
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
72-
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55))
72+
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61))
7373
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
7474

7575
.PHONY: tools

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ The build produced does have some limitations:
3737
## Requirements
3838

3939
- [Xcode](https://apps.apple.com/gb/app/xcode/id497799835?mt=12)
40+
41+
# Nix
42+
43+
The [Nix](https://nixos.org/) package manager is the preferred and most reliable
44+
way to install all dependencies required to build Emacs. Alternatively you can
45+
also use Homebrew.
46+
47+
### Homebrew
48+
49+
If you do not have Nix installed, then the alternative way to manage and install
50+
all dependencies is via Homebrew.
51+
4052
- [Homebrew](https://brew.sh/)
4153
- Ruby 2.3.0 or later is needed to execute the build script itself. macOS comes
4254
with Ruby, check your version with `ruby --version`. If it's too old, you can
@@ -71,17 +83,38 @@ Nightly builds are built with GitHub Actions on GitHub-hosted runners, using
7183

7284
## Usage
7385

86+
### Nix
87+
88+
Ensure [Flakes](https://nixos.wiki/wiki/Flakes) are enabled, and enter the flake
89+
development environment with `nix develop`. Within this environment, you can
90+
execute the `./build-emacs-for-macos --help` to get started.
91+
92+
Or you can run the build script via `nix develop`:
93+
94+
```
95+
nix develop --command ./build-emacs-for-macos --help
96+
```
97+
98+
### Homebrew
99+
100+
Run `make boostrap` to ensure all Ruby and Homebrew dependencies are installed.
101+
102+
### Build Script
103+
74104
```
75105
Usage: ./build-emacs-for-macos [options] <branch/tag/sha>
76106
77107
Branch, tag, and SHA are from the emacs-mirror/emacs/emacs Github repo,
78108
available here: https://github.com/emacs-mirror/emacs
79109
80110
Options:
111+
--info Print environment info and detected library paths, then exit
112+
--preview Print preview details about build and exit.
81113
-j, --parallel COUNT Compile using COUNT parallel processes (detected: 16)
82114
--git-sha SHA Override detected git SHA of specified branch allowing builds of old commits
115+
--[no-]use-nix Use Nix instead of Homebrew to find dependencies (default: enabled if EMACS_BUILD_USE_NIX is set to truthy value)
83116
--[no-]xwidgets Enable/disable XWidgets if supported (default: enabled)
84-
--[no-]tree-sitter Enable/disable tree-sitter if supported (default: enabled)
117+
--[no-]tree-sitter Enable/disable tree-sitter if supported(default: enabled)
85118
--[no-]native-comp Enable/disable native-comp (default: enabled if supported)
86119
--[no-]native-march Enable/disable -march=native CFLAG(default: disabled)
87120
--[no-]native-full-aot Enable/disable NATIVE_FULL_AOT / Ahead of Time compilation (default: disabled)

0 commit comments

Comments
 (0)