noogle/flake.nix

62 lines
1.6 KiB
Nix
Raw Normal View History

2022-11-26 12:36:08 +03:00
{
2023-01-25 17:54:44 +03:00
inputs = {
dream2nix.url = "github:nix-community/dream2nix";
nixdoc-fork.url = "github:hsjobeki/nixdoc";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, pre-commit-hooks, ... }@inp:
let
system = "x86_64-linux";
pkgs = inp.nixpkgs.legacyPackages.${system};
inherit (builtins.fromJSON (builtins.readFile ./package.json)) name;
in
(inp.dream2nix.lib.makeFlakeOutputs {
2022-11-26 12:36:08 +03:00
systemsFromFile = ./nix_systems;
config.projectRoot = ./.;
source = ./.;
settings = [
{
subsystemInfo.nodejs = 18;
}
];
packageOverrides = {
${name}.staticPage = {
preBuild = ''
2023-01-25 17:54:44 +03:00
cp ${inp.nixdoc-fork.packages.${system}.data} ./models/lib.json
'';
2022-11-26 12:36:08 +03:00
installPhase = ''
runHook preInstall
npm run export
mkdir -p $out/static
cp -r ./out/* $out/static/
runHook postInstall
'';
};
};
2022-12-18 19:31:42 +03:00
})
// {
devShells.${system}.default = pkgs.mkShell {
2023-01-25 17:54:44 +03:00
buildInputs = with pkgs; [ nodejs-18_x ];
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
checks.${system} = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
markdownlint.enable = true;
};
};
2022-12-18 19:31:42 +03:00
};
};
2022-11-26 12:36:08 +03:00
}