aboutsummaryrefslogblamecommitdiff
path: root/lib/default.nix
blob: bb1c30f61575d75a41a648bb2c6729cc8c569be2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

           



              



                                    
                                       

                 
                                      
                       
                            
                               

                                         
                     







                                                                    
        





              
                       
                       



                                                      
                                                    



                                           


                            
                                      



                                          









                                                   
{ inputs }:

{
  mkSystem =
    { hostname
    , system
    }:
    inputs.nixpkgs.lib.nixosSystem {
      inherit system;
      specialArgs = {
        inherit inputs system hostname;
      };
      modules = [
        inputs.agenix.nixosModules.age
        ../hosts/common
        ../hosts/${hostname}
        ./private-wireguard.nix
        {
          networking.hostName = hostname;
          nixpkgs = {
            config.allowUnfree = true;
          };
          # Add each input as a registry
          nix.registry = inputs.nixpkgs.lib.mapAttrs'
            (n: v:
              inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; }))
            inputs;
        }
      ];
    };

  mkHome =
    { username
    , system
    , hostname
    , isDesktop ? false
    , isTrusted ? false
    }:
    inputs.home-manager.lib.homeManagerConfiguration {
      inherit username system;
      extraSpecialArgs = {
        inherit system hostname isDesktop isTrusted;
      };
      homeDirectory = "/home/${username}";
      configuration = ../users/${username};
      extraModules = [
        # Base configuration
        {
          nixpkgs = {
            config.allowUnfree = true;
            overlays = [
              inputs.emacs-overlay.overlay
              inputs.nur.overlay
            ];
          };
          programs = {
            home-manager.enable = true;
            git.enable = true;
          };
          systemd.user.startServices = "sd-switch";
        }
      ];
    };
}