build: Nix package
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,7 +1,8 @@
|
||||
# Devenv
|
||||
# Devenv/Nix
|
||||
.devenv*
|
||||
devenv.local.nix
|
||||
devenv.local.yaml
|
||||
/result
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
38
default.nix
Normal file
38
default.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user