mfgames-writing-setup-flake/flake.nix
2024-01-30 14:44:31 -06:00

72 lines
1.9 KiB
Nix

{
description = "Common setup for mfgames-writing projects.";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
mfgames-project-setup.url = "git+https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git";
};
outputs = inputs @ { self, nixpkgs, mfgames-project-setup, ... }:
let
# Helpers for producing system-specific outputs
supportedSystems = [ "x86_64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
inherit system;
pkgs = import nixpkgs { inherit system; };
});
in
rec
{
# Expose the configuration information.
lib = {
mkConfig =
{ system
, pkgs
, ...
}:
{
packages = [
pkgs.pandoc
pkgs.nodejs-18_x
# EPUB
pkgs.epubcheck
# PDF
pkgs.pdftk
pkgs.python39Full
pkgs.python39Packages.weasyprint
];
};
};
# Set up the developer shell.
devShells = forEachSupportedSystem ({ system, pkgs }:
let
project-config = mfgames-project-setup.lib.mkConfig {
inherit system pkgs;
contributorCovenant.enable = true;
contributorCovenant.contact = "contact@mfgames.com";
developerCertificateOfOrigin.enable = true;
};
writing-config = lib.mkConfig {
inherit system pkgs;
};
in
{
# Shell
default = pkgs.mkShell {
packages = [ ]
++ project-config.packages
++ writing-config.packages;
shellHook = project-config.shellHook;
};
});
# Formatting for the Nix files
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
};
}