chicken5-flake/flake.nix
2024-09-17 10:38:18 +02:00

58 lines
1.5 KiB
Nix

{
description = "A flake to use a development version of Chicken.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs @ {
self,
nixpkgs,
...
}: let
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
pkgsFor = forAllSystems (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [chicken tcc-mob];
});
in {
overlays = {
default = self.overlays.chicken;
chicken = final: prev: {
tcc-mob = final.callPackage ./nix/tinycc.nix {
stdenv = final.gcc13Stdenv;
};
chicken = final.callPackage ./nix/chicken.nix {
stdenv = final.gcc13Stdenv;
};
};
};
devShells = forAllSystems (system: {
default = let
pkgs = import nixpkgs {
overlays = [ self.overlays.chicken ];
};
in pkgs.mkShell {
packages = with pkgs; [ tcc-mob chicken pkg-config ]
++ (with pkgs.chickenPackages_5.chickenEggs; [
]);
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"
'';
};
});
};
}