chicken6-flake/flake.nix

64 lines
1.7 KiB
Nix
Raw Normal View History

2024-09-16 08:09:13 +00:00
{
2024-09-21 16:38:24 +00:00
description = "A flake to use Chicken 6 with TinyCC.";
2024-09-16 08:09:13 +00:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs @ {
self,
nixpkgs,
systems,
...
}: let
inherit (nixpkgs) lib;
2024-09-21 16:38:24 +00:00
forAllSystems = lib.genAttrs [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
pkgsFor = forAllSystems (system:
2024-09-16 08:09:13 +00:00
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [chicken];
});
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
version = "6.0.0";
in {
overlays = {
default = self.overlays.chicken;
chicken = final: prev: {
2024-12-11 14:24:54 +00:00
# tcc-mob = final.callPackage ./nix/tinycc.nix {
# stdenv = final.gcc13Stdenv;
# };
2024-09-21 16:38:24 +00:00
chicken = final.callPackage ./nix/chicken.nix {
2024-09-16 08:09:13 +00:00
stdenv = final.gcc13Stdenv;
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
};
2024-09-21 16:38:24 +00:00
devShells = forAllSystems (system: {
2024-09-16 08:09:13 +00:00
default = let
pkgs = import nixpkgs {
overlays = [ self.overlays.chicken ];
};
in pkgs.mkShell {
2024-12-11 14:24:54 +00:00
packages = with pkgs; [ chicken ];
2024-09-21 16:38:24 +00:00
shellHook = ''
export CHICKEN_INSTALL_REPOSITORY="$(pwd)/.chicken/eggs"
2024-12-11 14:24:54 +00:00
export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/12:$CHICKEN_REPOSITORY_PATH:$(pwd)/.chicken/eggs"
2024-09-21 16:38:24 +00:00
export PATH="$PATH:$CHICKEN_INSTALL_PREFIX/bin"
'';
2024-09-16 08:09:13 +00:00
};
});
};
}