chicken5-flake/flake.nix
2024-09-16 23:14:33 +02:00

59 lines
1.6 KiB
Nix

{
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;
};
};
chicken = final: prev: {
chicken = final.callPackage ./nix/chicken.nix {
stdenv = final.gcc13Stdenv;
};
};
};
devShells = eachSystem (system: {
default = let
pkgs = import nixpkgs {
overlays = [ self.overlays.tcc-mob self.overlays.chicken ];
};
in pkgs.mkShell {
packages = with pkgs; [ tcc-mob chicken pkg-config ]
++ (with pkgs.chickenPackages_5.chickenEggs; [
lsp-server
transducers
]);
shellHook = ''
export CC=${pkgs.tcc-mob}/bin/tcc
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"
'';
};
});
};
}