aboutsummaryrefslogblamecommitdiff
path: root/flake.nix
blob: a24974774b916efb7525a0e50883a002d47e23e3 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                
 

                                    
                                                       
 

                                             


                                                                   

                                                             




                                         

                                         
                    
                                                              


                                                                          


                                             
                                 
                                               

      
                             


                                                       
        

                                                    
                                                         
                                                                      
                                               

        


                               


                                                                   
                                                                       
                                                                               
            
 

                                                               
                                                                 

                                                                   
          
 
                                                             



                                                                 
 
                                 


                                    
                       


                        

                 
            

          
 
{
  description = "personal NixOS configurations";

  inputs = {
    # Nixpkgs, NixOS's official repo
    nixpkgs.url = "github:nixos/nixpkgs/release-22.05";

    utils.url = "github:numtide/flake-utils";

    # We use the unstable nixpkgs repo for some packages.
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";

    emacs-overlay.url = "github:nix-community/emacs-overlay";

    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nur.url = "github:nix-community/NUR";

    home-manager = {
      url = "github:nix-community/home-manager/release-22.05";
      # We want home-manager to use the same set of nixpkgs as our system.
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  # Output config, or config for NixOS system
  outputs = { self, ... }@inputs:
    let lib = import ./nix { inherit inputs; };
    in
    {
      nixosConfigurations = {
        carmel = lib.mkSystem { hostname = "carmel"; };
        aptos = lib.mkSystem { hostname = "aptos"; };
        tahoe = lib.mkSystem { hostname = "tahoe"; };
      };
    } // inputs.utils.lib.eachDefaultSystem (system:
      let
        pkgs = import inputs.nixpkgs { inherit system; };
        home-manager = inputs.home-manager.defaultPackage."${system}";
        ci = import ./ops/ci { inherit pkgs; };
      in
      {
        packages = pkgs // {
          inherit home-manager;

          tools = {
            dnsupdate = import ./tools/dnsupdate { inherit pkgs; };
            govanity = import ./tools/govanity { inherit pkgs; };
            ipconverter = import ./tools/ipconverter { inherit pkgs; };
            git-blame-stats = import ./tools/git-blame-stats { inherit pkgs; };
          };

          users.fcuny = {
            blog = import ./users/fcuny/blog { inherit pkgs; };
            notes = import ./users/fcuny/notes { inherit pkgs; };
            resume = import ./users/fcuny/resume { inherit pkgs; };
          };
        };

        # `nix run .#ci.format` formats in current directory!
        apps.ci.format = ci.fmt.mkFmtScript self;

        # `nix run .#ci.shellcheck` formats in current directory!
        apps.ci.shellcheck = ci.shell.mkShellCheckScript self;

        devShell = pkgs.mkShell {
          buildInputs = with pkgs; [
            nixUnstable
            nixfmt
            nixpkgs-fmt
            rnix-lsp
            home-manager
            git
            go
            gopls
          ];
        };
      });
}