chicken5-flake/flake.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

2024-09-16 10:16:45 +00:00
{
description = "A flake to use a development version of Chicken.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs = inputs @ {
self,
nixpkgs,
systems,
...
}: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [chicken tcc-mob];
});
in {
overlays = {
default = self.overlays.chicken;
tcc-mob = final: prev: {
tcc-mob = final.callPackage ./nix/tinycc.nix {
stdenv = final.gcc13Stdenv;
};
};
};
devShells = eachSystem (system: {
default = let
pkgs = import nixpkgs {
overlays = [ self.overlays.tcc-mob ];
};
in pkgs.mkShell {
packages = with pkgs; [ tcc-mob pkg-config ];
shellHook = ''
mkdir -p .chicken; cd .chicken
curl https://code.call-cc.org/releases/5.4.0/chicken-5.4.0.tar.gz | tar xzf -
cd ..
make -C .chicken/chicken-5.4.0 -j16 PREFIX=$(pwd)/.chicken C_COMPILER=${pkgs.tcc-mob}/bin/tcc
export CHICKEN_INSTALL_PREFIX="$(pwd)/.chicken"
export CHICKEN_INSTALL_REPOSITORY="$(pwd)/.chicken/eggs"
export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/11:$CHICKEN_REPOSITORY_PATH:$(pwd)/.chicken/eggs"
export PATH="$PATH:$CHICKEN_INSTALL_PREFIX/bin"
'';
};
});
};
}