Skip to content

Commit 1241049

Browse files
Marc Jakobimrcjkb
authored andcommitted
build(nix): fix darwin builds
1 parent cb16196 commit 1241049

2 files changed

Lines changed: 21 additions & 22 deletions

File tree

.github/workflows/nix-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,3 @@ jobs:
6868
- name: Build lux-luajit
6969
run: nix build ".#packages.${{matrix.job.target}}.lux-luajit" -Lv --accept-flake-config --log-lines 500 --fallback
7070
shell: bash
71-
# FIXME: This fails with permission denied on darwin
72-
if: ${{ matrix.job.target == 'x86_64-linux' }}

nix/overlay.nix

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@
8989
pname = "lux-lua";
9090
inherit (luxCargo) version;
9191

92-
# FIXME: This fails with permission denied on darwin
92+
preBuild = ''
93+
export HOME=$NIX_BUILD_TOP/home
94+
'';
95+
9396
cargoBuildCommand = "xtask-lua dist";
97+
9498
nativeBuildInputs =
9599
individualCrateArgs.nativeBuildInputs
96100
++ [
@@ -144,25 +148,22 @@
144148
buildInputs =
145149
individualCrateArgs.buildInputs;
146150

147-
cargoBuildCommand = "cargo build --profile ${buildType}";
148-
cargoExtraArgs = "-p lux-cli --locked";
149-
150-
postBuild =
151-
if final.stdenv.isDarwin
152-
# For some reason, xtask errors with "permission denied" on darwin
153-
then ""
154-
else ''
155-
xtask dist-man
156-
xtask dist-completions
157-
'';
158-
159-
postInstall =
160-
if final.stdenv.isDarwin
161-
then ""
162-
else ''
163-
installManPage target/dist/lx.1
164-
installShellCompletion target/dist/lx.{bash,fish} --zsh target/dist/_lx
165-
'';
151+
cargoBuildCommand = "cargo build --locked --profile ${buildType}";
152+
cargoExtraArgs = "-p lux-cli";
153+
154+
preBuild = ''
155+
export HOME=$NIX_BUILD_TOP/home
156+
'';
157+
158+
postBuild = ''
159+
xtask dist-man
160+
xtask dist-completions
161+
'';
162+
163+
postInstall = ''
164+
installManPage target/dist/lx.1
165+
installShellCompletion target/dist/lx.{bash,fish} --zsh target/dist/_lx
166+
'';
166167

167168
meta.mainProgram = "lx";
168169
});

0 commit comments

Comments
 (0)