{ 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 rec { # Expose the configuration information. lib = { mkConfig = { system , pkgs , conform ? { } , contributorCovenant ? { } , dotnet ? { } , developerCertificateOfOrigin ? { } , copyright ? null , mit ? { } , creativeCommonsAttributionShareAlike ? { } , creativeCommonsAttributionNonCommercialShareAlike ? { } , prettier ? { } , rust ? { } , ... }: let conformDefaults = { scopes = [ ]; }; contributorCovenantDefaults = { enable = false; }; developerCertificateOfOriginDefaults = { enable = false; }; dotnetDefaults = { enable = false; }; prettierDefaults = { proseWrap = "preserve"; }; rustDefaults = { enable = false; }; licenseDefaults = { enable = false; filename = "LICENSE.md"; }; text-engine = import ./src/engines/text.nix { inherit pkgs; lib = pkgs.lib; }; configs = import ./src/configs/default.nix { inherit system pkgs nixago nixago-exts; text-engine = text-engine { }; conform = conformDefaults // conform; contributorCovenant = contributorCovenantDefaults // contributorCovenant; copyright = copyright; creativeCommonsAttributionNonCommercialShareAlike = licenseDefaults // creativeCommonsAttributionNonCommercialShareAlike; creativeCommonsAttributionShareAlike = licenseDefaults // creativeCommonsAttributionShareAlike; developerCertificateOfOrigin = developerCertificateOfOriginDefaults // developerCertificateOfOrigin; dotnet = dotnetDefaults // dotnet; mit = licenseDefaults // mit; prettier = prettierDefaults // prettier; rust = rustDefaults // rust; }; in { packages = [ pkgs.lefthook pkgs.treefmt pkgs.conform pkgs.nodePackages.prettier pkgs.nixpkgs-fmt ] ++ pkgs.lib.lists.optional (dotnet // dotnetDefaults).enable [ pkgs.csharpier ]; shellHook = '' ${configs.shellHook} ${pkgs.lefthook}/bin/lefthook install ''; }; }; # Set up the developer shell. devShells = forEachSupportedSystem ({ system, pkgs }: let config = lib.mkConfig { inherit system pkgs; contributorCovenant.contact = "contact@mfgames.com"; contributorCovenant.enable = true; developerCertificateOfOrigin.enable = true; copyright = "2024, Moonfire Games"; mit.enable = true; prettier.proseWrap = "always"; }; in { # Shell default = pkgs.mkShell { packages = [ ] ++ config.packages; shellHook = config.shellHook; }; }); # Formatting for the Nix files formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt); }; }