2024-01-28 20:32:33 +00:00
|
|
|
{
|
|
|
|
description = "Common setup for many projects that use a variety of languages.";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
|
|
|
|
|
|
|
nixago.url = "github:jmgilman/nixago";
|
|
|
|
nixago.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
nixago-exts.url = "github:nix-community/nixago-extensions";
|
|
|
|
nixago-exts.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs @ { self, nixpkgs, nixago, nixago-exts, ... }:
|
|
|
|
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
|
2024-01-28 22:18:12 +00:00
|
|
|
rec
|
2024-01-28 20:32:33 +00:00
|
|
|
{
|
2024-01-28 20:49:19 +00:00
|
|
|
# Expose the configuration information.
|
2024-01-28 21:11:23 +00:00
|
|
|
lib = {
|
2024-01-28 22:33:58 +00:00
|
|
|
mkConfig =
|
2024-01-28 22:18:12 +00:00
|
|
|
{ system
|
|
|
|
, pkgs
|
2024-01-28 22:21:43 +00:00
|
|
|
, conform ? { }
|
2024-01-29 03:53:54 +00:00
|
|
|
, contributorCovenant ? { }
|
2024-03-06 04:15:38 +00:00
|
|
|
, dotnet ? { }
|
2024-01-29 03:53:54 +00:00
|
|
|
, developerCertificateOfOrigin ? { }
|
2024-02-06 00:42:45 +00:00
|
|
|
, copyright ? null
|
|
|
|
, mit ? { }
|
|
|
|
, creativeCommonsAttributionShareAlike ? { }
|
|
|
|
, creativeCommonsAttributionNonCommercialShareAlike ? { }
|
2024-01-29 20:31:10 +00:00
|
|
|
, prettier ? { }
|
2024-01-28 22:18:12 +00:00
|
|
|
, rust ? { }
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
let
|
2024-01-28 22:21:43 +00:00
|
|
|
conformDefaults = { scopes = [ ]; };
|
2024-01-29 03:53:54 +00:00
|
|
|
contributorCovenantDefaults = { enable = false; };
|
|
|
|
developerCertificateOfOriginDefaults = { enable = false; };
|
2024-03-06 04:15:38 +00:00
|
|
|
dotnetDefaults = { enable = false; };
|
2024-01-29 20:31:10 +00:00
|
|
|
prettierDefaults = { proseWrap = "preserve"; };
|
2024-01-29 03:53:54 +00:00
|
|
|
rustDefaults = { enable = false; };
|
2024-02-06 00:42:45 +00:00
|
|
|
licenseDefaults = { enable = false; filename = "LICENSE.md"; };
|
2024-01-29 03:53:54 +00:00
|
|
|
|
|
|
|
text-engine = import ./src/engines/text.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
lib = pkgs.lib;
|
|
|
|
};
|
2024-01-29 01:57:32 +00:00
|
|
|
|
2024-01-28 22:18:12 +00:00
|
|
|
configs = import ./src/configs/default.nix {
|
|
|
|
inherit system pkgs nixago nixago-exts;
|
2024-01-29 03:53:54 +00:00
|
|
|
|
|
|
|
text-engine = text-engine { };
|
|
|
|
|
2024-02-06 00:42:45 +00:00
|
|
|
conform = conformDefaults // conform;
|
2024-01-29 03:53:54 +00:00
|
|
|
contributorCovenant = contributorCovenantDefaults // contributorCovenant;
|
2024-02-06 00:42:45 +00:00
|
|
|
copyright = copyright;
|
|
|
|
creativeCommonsAttributionNonCommercialShareAlike = licenseDefaults // creativeCommonsAttributionNonCommercialShareAlike;
|
|
|
|
creativeCommonsAttributionShareAlike = licenseDefaults // creativeCommonsAttributionShareAlike;
|
2024-01-29 03:53:54 +00:00
|
|
|
developerCertificateOfOrigin = developerCertificateOfOriginDefaults // developerCertificateOfOrigin;
|
2024-03-06 04:15:38 +00:00
|
|
|
dotnet = dotnetDefaults // dotnet;
|
2024-02-06 00:42:45 +00:00
|
|
|
mit = licenseDefaults // mit;
|
2024-01-29 20:31:10 +00:00
|
|
|
prettier = prettierDefaults // prettier;
|
2024-01-28 22:18:12 +00:00
|
|
|
rust = rustDefaults // rust;
|
|
|
|
};
|
|
|
|
in
|
2024-01-28 22:33:58 +00:00
|
|
|
{
|
2024-01-29 20:31:10 +00:00
|
|
|
packages = [
|
|
|
|
pkgs.lefthook
|
|
|
|
pkgs.treefmt
|
|
|
|
pkgs.conform
|
2024-03-06 04:15:38 +00:00
|
|
|
pkgs.nodePackages.prettier
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
]
|
|
|
|
++ pkgs.lib.lists.optional (dotnet // dotnetDefaults).enable [
|
|
|
|
pkgs.csharpier
|
2024-01-29 20:31:10 +00:00
|
|
|
];
|
2024-01-28 22:33:58 +00:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
${configs.shellHook}
|
|
|
|
${pkgs.lefthook}/bin/lefthook install
|
|
|
|
'';
|
|
|
|
};
|
2024-01-28 21:11:23 +00:00
|
|
|
};
|
|
|
|
|
2024-01-28 20:32:33 +00:00
|
|
|
# Set up the developer shell.
|
|
|
|
devShells = forEachSupportedSystem ({ system, pkgs }:
|
|
|
|
let
|
2024-01-28 22:33:58 +00:00
|
|
|
config = lib.mkConfig {
|
2024-01-28 22:18:12 +00:00
|
|
|
inherit system pkgs;
|
2024-01-29 03:53:54 +00:00
|
|
|
contributorCovenant.contact = "contact@mfgames.com";
|
2024-02-06 00:42:45 +00:00
|
|
|
contributorCovenant.enable = true;
|
2024-01-29 03:53:54 +00:00
|
|
|
developerCertificateOfOrigin.enable = true;
|
2024-02-06 00:42:45 +00:00
|
|
|
copyright = "2024, Moonfire Games";
|
|
|
|
mit.enable = true;
|
2024-01-29 20:31:10 +00:00
|
|
|
prettier.proseWrap = "always";
|
2024-01-28 22:18:12 +00:00
|
|
|
};
|
2024-01-28 20:32:33 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
# Shell
|
|
|
|
default = pkgs.mkShell {
|
2024-01-28 22:33:58 +00:00
|
|
|
packages = [ ] ++ config.packages;
|
|
|
|
shellHook = config.shellHook;
|
2024-01-28 20:32:33 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
# Formatting for the Nix files
|
|
|
|
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
|
|
|
|
};
|
|
|
|
}
|