Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2d5959d
[#3] Build with Nix
kisp Jul 24, 2024
dc873a1
wip
kisp Jul 24, 2024
26fdd44
wip
kisp Jul 24, 2024
bf07143
wip
kisp Jul 24, 2024
8e888d8
wip
kisp Jul 24, 2024
d488a3a
wip
kisp Jul 24, 2024
bcb2513
wip
kisp Jul 24, 2024
e7e0a09
wip
kisp Jul 24, 2024
716e8d2
wip
kisp Jul 24, 2024
a3431fa
wip
kisp Jul 24, 2024
3ed6b65
wip
kisp Jul 24, 2024
b516a21
wip
kisp Jul 24, 2024
0727741
wip
kisp Jul 24, 2024
0415686
wip
kisp Jul 24, 2024
3960dbb
wip
kisp Jul 24, 2024
c595b54
wip
kisp Jul 24, 2024
e3bd168
wip
kisp Jul 24, 2024
155e63f
wip
kisp Jul 24, 2024
20a46d0
wip
kisp Jul 24, 2024
3076a79
wip
kisp Jul 24, 2024
4a7cba4
wip
kisp Jul 24, 2024
a9465ff
wip
kisp Jul 24, 2024
1bef0e2
wip
kisp Jul 24, 2024
748a146
wip
kisp Jul 24, 2024
bbeee21
wip
kisp Jul 24, 2024
a49a5e0
wip
kisp Jul 24, 2024
3c69682
wip
kisp Jul 24, 2024
fe55825
wip
kisp Jul 24, 2024
727e73d
wip
kisp Jul 24, 2024
d72210f
wip
kisp Jul 24, 2024
481be35
wip
kisp Jul 24, 2024
6f2297a
ch
kisp Jul 24, 2024
c07d86b
ch
kisp Jul 24, 2024
47f0fa5
.gitignore
kisp Jul 24, 2024
4ed1c48
shell.nix
kisp Jul 24, 2024
c35fc68
wip
kisp Jul 24, 2024
ec796a4
wip
kisp Jul 24, 2024
3a086a6
wip
kisp Jul 24, 2024
b628941
shell.nix
kisp Jul 24, 2024
814548c
nix-build.sh
kisp Jul 24, 2024
e4cdcf5
nix-build.sh
kisp Jul 24, 2024
3ff2bae
ch
kisp Jul 24, 2024
00e07f3
gemset.nix
kisp Jul 24, 2024
5ca401a
shell.nix
kisp Jul 24, 2024
99a5938
ch
kisp Jul 24, 2024
7d81649
shell.nix
kisp Jul 24, 2024
5ecba0b
nix-test.sh
kisp Jul 24, 2024
60e3b8d
nix-test.sh
kisp Jul 24, 2024
b51ba25
Add .envrc
kisp Feb 13, 2026
5c84a7a
Change .envrc
kisp Feb 13, 2026
ca75d22
Add default.nix
kisp Feb 13, 2026
730c142
Change default.nix
kisp Feb 13, 2026
e9d82fe
ch
kisp Feb 13, 2026
90f0d4d
Change .envrc
kisp Feb 13, 2026
00f31b8
Add .github/workflows/ci.yml
kisp Feb 13, 2026
29da18b
Change .github/workflows/ci.yml
kisp Feb 13, 2026
23ac0f3
Change .github/workflows/ci.yml
kisp Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://github.com/NixOS/nixpkgs/tags
# 24.05
export NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/63dacb46bf939521bdc93981b4cbb7ecb58427a0.tar.gz

# use nix

export LC_ALL=C

export ASGL_HOME=$(pwd)
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
on:
# push:
# branches:
# - master
# pull_request:
# branches:
# - master
workflow_dispatch:

name: Build asgl

jobs:
build_template:
name: Build asgl
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/63dacb46bf939521bdc93981b4cbb7ecb58427a0.tar.gz

- name: download shell env
run: nix-shell --run ls

- name: ecl version
run: nix-shell --run 'ecl --version'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ lisp-scripts/compile-file-system-p.lisp
tmp
bin/asgl
gecode
*.cxx
*.o
gr1/gr1
gr1/gr1.c
Expand Down Expand Up @@ -71,3 +72,4 @@ gecode.c
af-constraints.c
sat.c
README.pdf
result
52 changes: 52 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ pkgs ? import <nixpkgs> {} }:

let
ecl = pkgs.callPackage ./ecl-cpp.nix { };
gecode = pkgs.callPackage ./gecode.nix { };
in

pkgs.stdenv.mkDerivation rec {
pname = "asgl";
version = "0.1.4";

src = ./.;

nativeBuildInputs = [
pkgs.autoconf
pkgs.automake
pkgs.makeWrapper
pkgs.gcc
pkgs.ragel
];

buildInputs = [
ecl
gecode
pkgs.gmp
pkgs.mpfr
pkgs.libffi
pkgs.ruby
pkgs.bundler
];

# Configure with --without-gist as per upstream build
configurePhase = ''
echo "Running autoreconf..."
autoreconf -vfi

echo "Configuring ASGL..."
./configure --without-gist
'';

buildPhase = ''
echo "Building ASGL..."
bash scripts/generate-make-mk.sh
make all
'';

installPhase = ''
echo "Installing ASGL into $out..."
mkdir -p $out/bin
cp bin/asgl $out/bin/
'';
}
15 changes: 15 additions & 0 deletions ecl-1.16.2-libffi-3.3-abi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/c/ffi.d b/src/c/ffi.d
index 8861303e..8a959c23 100644
--- a/src/c/ffi.d
+++ b/src/c/ffi.d
@@ -145,8 +145,8 @@ static struct {
#elif defined(X86_WIN64)
{@':win64', FFI_WIN64},
#elif defined(X86_ANY) || defined(X86) || defined(X86_64)
- {@':cdecl', FFI_SYSV},
- {@':sysv', FFI_SYSV},
+ {@':cdecl', FFI_UNIX64},
+ {@':sysv', FFI_UNIX64},
{@':unix64', FFI_UNIX64},
#endif
};
97 changes: 97 additions & 0 deletions ecl-cpp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
lib,
stdenv,
fetchurl,
fetchpatch,
libtool,
autoconf,
automake,
gmp,
mpfr,
libffi,
makeWrapper,
noUnicode ? false,
gcc,
threadSupport ? false,
useBoehmgc ? true,
boehmgc,
}:

assert useBoehmgc -> boehmgc != null;

let
s = # Generated upstream information
rec {
baseName = "ecl";
version = "16.1.2";
name = "${baseName}-${version}";
url = "https://common-lisp.net/project/ecl/static/files/release/ecl-16.1.2.tgz";
sha256 = "16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d";
};
buildInputs = [
libtool
autoconf
automake
makeWrapper
];
propagatedBuildInputs =
[
libffi
gmp
mpfr
gcc
]
++ lib.optionals useBoehmgc [
# replaces ecl's own gc which other packages can depend on, thus propagated
boehmgc
];
in
stdenv.mkDerivation {
inherit (s) name version;
inherit buildInputs propagatedBuildInputs;

src = fetchurl { inherit (s) url sha256; };

configureFlags = [
(if threadSupport then "--enable-threads" else "--disable-threads")
"--with-gmp-prefix=${gmp.dev}"
"--with-cxx"
"--with-libffi-prefix=${libffi.dev}"
] ++ (lib.optional (!noUnicode) "--enable-unicode");

patches = [
(fetchpatch {
# Avoid infinite loop, see https://gitlab.com/embeddable-common-lisp/ecl/issues/43 (fixed upstream)
name = "avoid-infinite-loop.patch";
url = "https://gitlab.com/embeddable-common-lisp/ecl/commit/caba1989f40ef917e7486f41b9cd5c7e3c5c2d79.patch";
sha256 = "07vw91psbc9gdn8grql46ra8lq3bgkzg5v480chnbryna4sv6lbb";
})
(fetchpatch {
# Fix getcwd with long pathnames
# Rebased version of
# https://gitlab.com/embeddable-common-lisp/ecl/commit/ac5f011f57a85a38627af154bc3ee7580e7fecd4.patch
name = "getcwd.patch";
url = "https://git.sagemath.org/sage.git/plain/build/pkgs/ecl/patches/16.1.2-getcwd.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
sha256 = "1fbi8gn7rv8nqff5mpaijsrch3k3z7qc5cn4h1vl8qrr8xwqlqhb";
})
./ecl-1.16.2-libffi-3.3-abi.patch
];

hardeningDisable = [ "format" ];

postInstall = ''
sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
wrapProgram "$out/bin/ecl" \
--prefix PATH ':' "${gcc}/bin" \
--prefix NIX_LDFLAGS ' ' "-L${gmp.lib or gmp.out or gmp}/lib" \
--prefix NIX_LDFLAGS ' ' "-L${libffi.lib or libffi.out or libffi}/lib"
'';

meta = {
inherit (s) version;
description = "Lisp implementation aiming to be small, fast and easy to embed";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.unix;
};
}
48 changes: 48 additions & 0 deletions gecode.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
lib,
stdenv,
fetchurl,
fetchpatch,
perl,
}:

stdenv.mkDerivation rec {
pname = "gecode";
version = "4.3.3";

src = fetchurl {
url = "https://github.com/Gecode/gecode/archive/refs/tags/release-${version}.tar.gz";
sha256 = "sha256-EOmQqEtfBH/J4w7wtcFhrVuU7F0NWJO9Qfn4b0QHZaw=";
};

patches = [
# (import ./fix-const-weights-clang-patch.nix fetchpatch)
];

postPatch = ''
substituteInPlace gecode/flatzinc/lexer.yy.cpp \
--replace "register " ""
'';

nativeBuildInputs = [ perl ];

preConfigure = "patchShebangs configure";

configureFlags = [
"--disable-gist"
"--disable-qt"
"--disable-examples"
"--disable-flatzinc"
"--disable-float-vars"
];

env.CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++14";

meta = with lib; {
license = licenses.mit;
homepage = "https://www.gecode.org";
description = "Toolkit for developing constraint-based systems";
platforms = platforms.all;
maintainers = [ maintainers.manveru ];
};
}
117 changes: 117 additions & 0 deletions gemset.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
aruba = {
dependencies = ["childprocess" "cucumber" "rspec-expectations"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0hlq03shd7cl72n7nark8dm5gdrsjpcqkxd2qrkcjzd35nkqqlbw";
type = "gem";
};
version = "0.6.2";
};
builder = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "14fii7ab8qszrvsvhz6z2z3i4dw0h41a62fjr2h1j8m41vbrmyv2";
type = "gem";
};
version = "3.2.2";
};
childprocess = {
dependencies = ["ffi"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0cxzh17vjlmpqfcas4815x50dc1gzfwgbs51zzpd4chrl6ak4n4v";
type = "gem";
};
version = "0.5.5";
};
cucumber = {
dependencies = ["builder" "diff-lcs" "gherkin" "multi_json" "multi_test"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "170a0yclrc1i9m5wjgwzga3ipb5mbapiha8jcg0g2gjnmzvd77nr";
type = "gem";
};
version = "1.3.19";
};
diff-lcs = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1vf9civd41bnqi6brr5d9jifdw73j9khc6fkhfl1f8r9cpkdvlx1";
type = "gem";
};
version = "1.2.5";
};
ffi = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0ph098bv92rn5wl6rn2hwb4ng24v4187sz8pa0bpi9jfh50im879";
type = "gem";
};
version = "1.9.8";
};
gherkin = {
dependencies = ["multi_json"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1mxfgw15pii1jmq00xxbyp77v71mh3bp99ndgwzfwkxvbcisha25";
type = "gem";
};
version = "2.12.2";
};
multi_json = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1mg3hp17ch8bkf3ndj40s50yjs0vrqbfh3aq5r02jkpjkh23wgxl";
type = "gem";
};
version = "1.11.0";
};
multi_test = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1sx356q81plr67hg16jfwz9hcqvnk03bd9n75pmdw8pfxjfy1yxd";
type = "gem";
};
version = "0.1.2";
};
rspec-expectations = {
dependencies = ["diff-lcs" "rspec-support"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "08ba5hprb3kf849yylkxm9dd9lfazh7gapiqxy5lapwqxbqpa3ky";
type = "gem";
};
version = "3.2.0";
};
rspec-support = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "194zry5195ls2hni7r9824vqb5d3qfg4jb15fgj8glfy0rvw3zxl";
type = "gem";
};
version = "3.2.2";
};
}
11 changes: 11 additions & 0 deletions nix-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -euxo pipefail

# git add .
# git commit -m wip || true

git clean -fxd

nix-shell \
--pure --run 'bash steps.sh'
Loading