Files
p2p-rendering-computation/nix/templates/haskell/flake.nix
2025-05-27 23:49:08 +01:00

79 lines
1.8 KiB
Nix

{
description = "Start of Haskell P2PRC flake";
inputs =
{
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
p2prc-flake = {
url = "github:xecarlox94/p2p-rendering-computation?ref=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = { nixpkgs, p2prc-flake, flake-utils, ... }:
(flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
# TODO: p2prc overlays into a single list
overlays = [
p2prc-flake.overlays.${system}.default
p2prc-flake.overlays.${system}.bindings
];
};
# TODO: Add this to a p2prc-nix lib
initProject = pkgs.writeShellApplication {
name = "initProject";
runtimeInputs = with pkgs; [
cabal2nix
cabal-install
];
text = ''
# TODO: add this check
# if [ -f *.cabal ]; then echo "The file exists"; fi
cabal init
echo "RUNNING"
cabal2nix . > ./project.nix;
git add .
'';
};
in {
packages = {
# TODO: fix issue
default = pkgs.haskellPackages.callPackage ./project.nix { };
init = initProject;
};
# TODO: override haskell binding lib devshell
devShells.default = pkgs.mkShell {
packages = with pkgs; [
cabal2nix
cabal-install
];
buildInputs = [
p2prc-flake.packages.${system}.default
initProject
];
shellHook = ''
cabal2nix . > ./project.nix;
'';
};
}
));
}