From 1547c22f29df8c6383fd8f758cc0edae62310f71 Mon Sep 17 00:00:00 2001 From: Andromeda Date: Fri, 20 Mar 2026 03:46:57 -0400 Subject: [PATCH 1/2] Create Nix flake --- flake.lock | 27 ++++++++++++ flake.nix | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..7889e5a84 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..ebd20d6db --- /dev/null +++ b/flake.nix @@ -0,0 +1,119 @@ +{ + description = "The GAP package Digraphs"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + in + { + packages = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + gap = pkgs.gap; + gaproot = "${gap}/lib/gap"; + in + { + default = self.packages.${system}.digraphs; + + digraphs = pkgs.stdenv.mkDerivation { + pname = "gap-digraphs"; + version = "1.14.0"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + autoconf + automake + gcc + gnumake + ]; + + buildInputs = [ + gap + ]; + + configurePhase = '' + runHook preConfigure + + # Generate the configure script + mkdir -p gen + aclocal -Wall --force + autoconf -Wall -f + autoheader -Wall -f + + # Run configure, pointing at the GAP root + ./configure --with-gaproot=${gaproot} + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + make + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/digraphs" + + # Copy GAP source files + cp -r gap "$out/digraphs/" + cp -r lib "$out/digraphs/" 2>/dev/null || true + cp -r doc "$out/digraphs/" 2>/dev/null || true + cp -r data "$out/digraphs/" 2>/dev/null || true + cp -r tst "$out/digraphs/" 2>/dev/null || true + + # Copy the compiled shared object + cp -r bin "$out/digraphs/" + + # Copy package metadata files + cp PackageInfo.g "$out/digraphs/" + cp init.g "$out/digraphs/" + cp read.g "$out/digraphs/" + cp -r makedoc.g "$out/digraphs/" 2>/dev/null || true + cp LICENSE "$out/digraphs/" 2>/dev/null || true + cp CHANGELOG.md "$out/digraphs/" 2>/dev/null || true + cp README.md "$out/digraphs/" 2>/dev/null || true + + runHook postInstall + ''; + + meta = with pkgs.lib; { + description = "GAP methods for graphs, digraphs, and multidigraphs"; + homepage = "https://digraphs.github.io/Digraphs"; + license = licenses.gpl3Plus; + platforms = platforms.unix; + }; + }; + } + ); + + devShells = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + gap = pkgs.gap; + in + { + default = pkgs.mkShell { + inputsFrom = [ self.packages.${system}.digraphs ]; + + packages = with pkgs; [ + gap-full + ]; + + shellHook = '' + export GAPROOT="${gap}/lib/gap" + echo "\$GAPROOT=$GAPROOT" + ''; + }; + } + ); + }; +} From 8c8a9fdd99d8d56126ef97bed3a949ae6e866b24 Mon Sep 17 00:00:00 2001 From: Andromeda Date: Fri, 20 Mar 2026 03:47:02 -0400 Subject: [PATCH 2/2] Add Nix build output to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dc35dcb51..04765d017 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ main.xml Makefile manual.lab missing +result src/pkgconfig.h.in tags tst/out/