Skip to content

Commit 94ca473

Browse files
authored
Switch to nixpkgs unstable; fix reduce-algebra darwin compilation (#10)
* save * minor * missing * fix * save * save * save * save * minor * fix version string
1 parent 5a89268 commit 94ca473

File tree

9 files changed

+105
-95
lines changed

9 files changed

+105
-95
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
cachixName:
2020
- mistzzt
2121
nixPath:
22-
- nixpkgs=channel:nixos-24.05
22+
- nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz
23+
- nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz
2324
runs-on: ubuntu-latest
2425
env:
2526
NIXPKGS_ALLOW_UNFREE: '1'

ci.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
with builtins; let
1313
isReserved = n: n == "lib" || n == "overlays" || n == "modules";
1414
isDerivation = p: isAttrs p && p ? type && p.type == "derivation";
15-
isBuildable = p: !(p.meta.broken or false) && p.meta.license.free or true;
15+
isBuildable = p: let
16+
licenseFromMeta = p.meta.license or [];
17+
licenseList =
18+
if builtins.isList licenseFromMeta
19+
then licenseFromMeta
20+
else [licenseFromMeta];
21+
in
22+
!(p.meta.broken or false) && builtins.all (license: license.free or true) licenseList;
1623
isCacheable = p: !(p.preferLocalBuild or false);
1724
shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false;
1825

default.nix

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
{pkgs ? import <nixpkgs> {}}: let
2-
darwinStdenv = let
3-
inherit (pkgs) stdenv overrideSDK;
4-
in
5-
if stdenv.isDarwin
6-
then overrideSDK stdenv "11.0"
7-
else stdenv;
8-
in {
1+
{pkgs ? import <nixpkgs> {}}: {
92
lib = import ./lib {inherit pkgs;};
103
modules = import ./modules;
114
overlays = import ./overlays;
125

13-
sketch = pkgs.callPackage ./pkgs/sketch {stdenv = darwinStdenv;};
14-
reduce-algebra = pkgs.callPackage ./pkgs/reduce-algebra {stdenv = darwinStdenv;};
6+
sketch = pkgs.callPackage ./pkgs/sketch {};
7+
reduce-algebra = pkgs.callPackage ./pkgs/reduce-algebra {};
158
AutoLifter = pkgs.callPackage ./pkgs/AutoLifter {};
169
parsynt = pkgs.callPackage ./pkgs/parsynt {};
1710
Synduce = pkgs.callPackage ./pkgs/Synduce {};

flake.lock

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

flake.nix

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
{
22
description = "NUR repository of program synthesis tools";
3-
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
3+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
44
outputs = {
55
self,
66
nixpkgs,
77
}: let
8-
systems = [
9-
"x86_64-linux"
10-
"aarch64-linux"
11-
"x86_64-darwin"
12-
"aarch64-darwin"
13-
];
14-
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
8+
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
159
in {
1610
legacyPackages = forAllSystems (system:
1711
import ./default.nix {
18-
pkgs = import nixpkgs {inherit system; config.allowUnfree = true;};
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
config.allowUnfree = true;
15+
};
1916
});
2017
packages = forAllSystems (system: nixpkgs.lib.filterAttrs (_: v: nixpkgs.lib.isDerivation v) self.legacyPackages.${system});
2118
};

pkgs/AutoLifter/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}:
1414
stdenv.mkDerivation rec {
1515
name = "AutoLifter";
16-
version = "1.0.0";
16+
version = "0-unstable-2024-01-08";
1717
src =
1818
fetchFromGitHub
1919
{

pkgs/Synduce/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
in
3232
ocamlPackages.buildDunePackage rec {
3333
pname = "Synduce";
34-
version = "0.2";
34+
version = "0-unstable-2023-08-12";
3535
duneVersion = "3";
3636
src =
3737
fetchFromGitHub

pkgs/parsynt/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}:
99
ocamlPackages.buildDunePackage rec {
1010
pname = "Parsynt";
11-
version = "0.3";
11+
version = "0-unstable-2021-12-15";
1212
duneVersion = "3";
1313
src =
1414
fetchFromGitHub

pkgs/reduce-algebra/default.nix

Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
autoPatchelfHook,
23
fetchurl,
34
lib,
45
makeWrapper,
@@ -11,7 +12,6 @@
1112
bzip2,
1213
libiconv,
1314
which,
14-
darwin,
1515
brotli,
1616
fontconfig,
1717
freetype,
@@ -26,52 +26,48 @@
2626
}:
2727
stdenv.mkDerivation {
2828
name = "reduce-algebra";
29-
version = "r6860";
29+
version = "6860";
3030
src = fetchurl {
3131
url = "https://sourceforge.net/projects/reduce-algebra/files/snapshot_2024-08-12/Reduce-svn6860-src.tar.gz";
3232
sha1 = "q81l4MA2h+4ky4Rwt26Vl0QPf5c=";
3333
};
3434
patches = [./fox.patch];
3535

36-
nativeBuildInputs =
37-
[
38-
autoconf
39-
automake
40-
ccache
41-
coreutils
42-
libtool
43-
perl
44-
ncurses
45-
zlib
46-
bzip2
47-
libiconv
48-
which
49-
makeWrapper
50-
51-
# homebrew package
52-
expat
53-
brotli
54-
fontconfig
55-
freetype
56-
gettext
57-
libffi
58-
libpng
59-
xorg.libX11
60-
xorg.libXau
61-
xorg.libxcb
62-
xorg.libXcursor
63-
xorg.libXdmcp
64-
xorg.libXext
65-
xorg.libXfixes
66-
xorg.libXft
67-
xorg.libXi
68-
xorg.libXrandr
69-
xorg.libXrender
70-
]
71-
++ lib.optionals stdenv.isDarwin [
72-
darwin.apple_sdk.frameworks.Carbon
73-
darwin.stubs.rez
74-
];
36+
nativeBuildInputs = [
37+
autoconf
38+
automake
39+
ccache
40+
coreutils
41+
libtool
42+
perl
43+
ncurses
44+
zlib
45+
bzip2
46+
libiconv
47+
which
48+
makeWrapper
49+
50+
# homebrew package
51+
expat
52+
brotli
53+
fontconfig
54+
freetype
55+
gettext
56+
libffi
57+
libpng
58+
xorg.libX11
59+
xorg.libXau
60+
xorg.libxcb
61+
xorg.libXcursor
62+
xorg.libXdmcp
63+
xorg.libXext
64+
xorg.libXfixes
65+
xorg.libXft
66+
xorg.libXi
67+
xorg.libXrandr
68+
xorg.libXrender
69+
autoPatchelfHook
70+
];
7571

7672
preConfigure = ''
7773
# Configuration: Rewrite CSL hard-coded paths to use dynamic libraries
@@ -133,18 +129,46 @@ stdenv.mkDerivation {
133129
substituteInPlace csl/configure csl/configure.ac \
134130
--replace 'LIBS="-lncurses $LIBS"' 'LIBS="-lncurses -lz $LIBS"'
135131
136-
./autogen.sh --fast --with-csl --with-psl
132+
# reduce includes precompiled bpsl binaries
133+
# need to patch them to use the Nix dynamic linker
134+
find psl/dist/kernel -type f -name "bpsl" | while read -r file; do
135+
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$file" || true
136+
done
137+
# Note: bpsl is broken on Darwin
138+
139+
substituteInPlace csl/cslbase/Makefile csl/cslbase/Makefile.am csl/cslbase/Makefile.in \
140+
configure configure.ac \
141+
--replace 'g++' '$(CXX)' \
142+
--replace 'gcc' '$(CC)'
143+
144+
./autogen.sh --fast --with-csl ${
145+
if stdenv.isDarwin
146+
then ""
147+
else "--with-psl"
148+
}
137149
'';
138150

139-
configureFlags = [
140-
"--disable-libtool-lock"
141-
"--disable-option-checking"
142-
"--with-ccache"
143-
"--with-csl"
144-
"--with-lto"
145-
"--with-psl"
146-
"--without-autogen"
147-
];
151+
configureFlags =
152+
[
153+
"--disable-libtool-lock"
154+
"--disable-option-checking"
155+
"--with-ccache"
156+
"--with-csl"
157+
"--with-lto"
158+
"--without-autogen"
159+
]
160+
++ (
161+
if stdenv.isDarwin
162+
then [
163+
"CXXFLAGS=-std=c++20"
164+
"--without-fox"
165+
"--disable-universal"
166+
"--with-clang"
167+
]
168+
else [
169+
"--with-psl"
170+
]
171+
);
148172
dontDisableStatic = true;
149173

150174
installPhase =
@@ -169,17 +193,11 @@ stdenv.mkDerivation {
169193
cp cslbuild/*/redfront/rfpsl $out/psl/rfpsl
170194
chmod +x $out/psl/rfpsl
171195
172-
makeWrapper $out/csl/redcsl $out/bin/reduce \
173-
--argv0 "reduce" \
174-
--chdir $out
175-
176196
makeWrapper $out/csl/redcsl $out/bin/redcsl \
177-
--argv0 "redcsl" \
178-
--chdir $out
197+
--argv0 "redcsl"
179198
180199
makeWrapper $out/psl/redpsl $out/bin/redpsl \
181-
--argv0 "redpsl" \
182-
--chdir $out
200+
--argv0 "redpsl"
183201
''
184202
else ''
185203
BUILD=$(scripts/findhost.sh $(./config.guess))
@@ -207,17 +225,11 @@ stdenv.mkDerivation {
207225
chmod +x $out/redcsl $out/bin/rfcsl
208226
chmod +x $out/redpsl $out/bin/rfpsl
209227
210-
makeWrapper $out/redcsl $out/bin/reduce \
211-
--argv0 "reduce" \
212-
--chdir $out
213-
214228
makeWrapper $out/redcsl $out/bin/redcsl \
215-
--argv0 "redcsl" \
216-
--chdir $out
229+
--argv0 "redcsl"
217230
218231
makeWrapper $out/redpsl $out/bin/redpsl \
219-
--argv0 "redpsl" \
220-
--chdir $out
232+
--argv0 "redpsl"
221233
'';
222234

223235
meta = with lib; {

0 commit comments

Comments
 (0)