about summary refs log blame commit diff stats
path: root/flake.nix
blob: 381c846c0e42d9317f8c7276ca98291e2fa1fc3e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
 


                                                          
 



                                         
      

                                                                              
      




                                         
    
             
         
                
                
       

                                                                
                                                  
                                                                     
        
                                        
                   

                                                       
          

                                                              
      
                            
 
           
{
  description = "A collection of nix flake templates";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs = {
        systems.follows = "systems";
      };
    };

    systems = {
      url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
    };
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };
  };

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    treefmt-nix,
    ...
  }: let
    templates = import ./templates.nix {inherit (nixpkgs) lib;};
  in
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages."${system}";
      treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
    in {
      devShells.default = pkgs.mkShell {
        packages = with pkgs; [
          cocogitto

          # needed for the `update_common_files` script
          jq
        ];
      };

      checks.formatting = treefmtEval.config.build.check self;
      formatter = treefmtEval.config.build.wrapper;
    })
    // {inherit templates;};
}
# vim: ts=2