build: Nix package

This commit is contained in:
2026-04-01 23:55:07 +02:00
parent d0115672dd
commit 1e85dd224a
2 changed files with 40 additions and 1 deletions

3
.gitignore vendored
View File

@@ -1,7 +1,8 @@
# Devenv # Devenv/Nix
.devenv* .devenv*
devenv.local.nix devenv.local.nix
devenv.local.yaml devenv.local.yaml
/result
# direnv # direnv
.direnv .direnv

38
default.nix Normal file
View File

@@ -0,0 +1,38 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation {
pname = "gulie";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = [ pkgs.guile ];
dontBuild = true;
installPhase = ''
runHook preInstall
# Install Guile source modules
install -d $out/share/guile/site/3.0
cp -r gulie $out/share/guile/site/3.0/
# Install binary, patching the shebang to use the Nix store guile
install -D -m 755 bin/gulie $out/bin/gulie
substituteInPlace $out/bin/gulie \
--replace-fail '#!/usr/bin/env -S guile' '#!${pkgs.guile}/bin/guile'
# Wrap so GUILE_LOAD_PATH is set at runtime modules live under site/3.0
wrapProgram $out/bin/gulie \
--set GUILE_LOAD_PATH "$out/share/guile/site/3.0"
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Linter and formatter for Guile Scheme";
mainProgram = "gulie";
platforms = platforms.unix;
};
}