add nix config in home/modules/nix.nix when not nixos
This commit is contained in:
		
							parent
							
								
									b2330c7a1d
								
							
						
					
					
						commit
						4a5d46559b
					
				
					 3 changed files with 72 additions and 1 deletions
				
			
		| 
						 | 
					@ -1 +1,17 @@
 | 
				
			||||||
{ ... }: { }
 | 
					{ lib, ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  imports = [
 | 
				
			||||||
 | 
					    ./nix.nix
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  options = {
 | 
				
			||||||
 | 
					    youthlic.nixos.enable = lib.mkOption {
 | 
				
			||||||
 | 
					      type = lib.types.bool;
 | 
				
			||||||
 | 
					      default = false;
 | 
				
			||||||
 | 
					      example = true;
 | 
				
			||||||
 | 
					      description = ''
 | 
				
			||||||
 | 
					        whether the os is nixos
 | 
				
			||||||
 | 
					      '';
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										51
									
								
								home/modules/nix.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								home/modules/nix.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  inputs,
 | 
				
			||||||
 | 
					  lib,
 | 
				
			||||||
 | 
					  config,
 | 
				
			||||||
 | 
					  pkgs,
 | 
				
			||||||
 | 
					  outputs,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					}:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  config =
 | 
				
			||||||
 | 
					    let
 | 
				
			||||||
 | 
					      cfg = config.youthlic.nixos;
 | 
				
			||||||
 | 
					    in
 | 
				
			||||||
 | 
					    (lib.mkIf (!cfg.enable) {
 | 
				
			||||||
 | 
					      nixpkgs = {
 | 
				
			||||||
 | 
					        config = {
 | 
				
			||||||
 | 
					          allowUnfree = true;
 | 
				
			||||||
 | 
					          allowUnfreePredicate = (_: true);
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        overlays = [
 | 
				
			||||||
 | 
					          outputs.overlays.modifications
 | 
				
			||||||
 | 
					          outputs.overlays.additions
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					      nix = {
 | 
				
			||||||
 | 
					        package = pkgs.nix;
 | 
				
			||||||
 | 
					        settings = {
 | 
				
			||||||
 | 
					          inherit (outputs.nix.settings) substituters;
 | 
				
			||||||
 | 
					          trusted-public-keys = [
 | 
				
			||||||
 | 
					            "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
 | 
				
			||||||
 | 
					            "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
 | 
				
			||||||
 | 
					            "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
 | 
				
			||||||
 | 
					          ];
 | 
				
			||||||
 | 
					          auto-optimise-store = lib.mkDefault true;
 | 
				
			||||||
 | 
					          experimental-features = [
 | 
				
			||||||
 | 
					            "nix-command"
 | 
				
			||||||
 | 
					            "flakes"
 | 
				
			||||||
 | 
					          ];
 | 
				
			||||||
 | 
					          warn-dirty = false;
 | 
				
			||||||
 | 
					          use-xdg-base-directories = true;
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        registry.home = lib.mkDefault {
 | 
				
			||||||
 | 
					          from = {
 | 
				
			||||||
 | 
					            type = "indirect";
 | 
				
			||||||
 | 
					            id = "home";
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
 | 
					          flake = inputs.nixpkgs;
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -50,6 +50,10 @@
 | 
				
			||||||
              outputs.homeManagerModules."${unixName}"
 | 
					              outputs.homeManagerModules."${unixName}"
 | 
				
			||||||
              (rootPath + "/home/${unixName}/configurations/${hostName}")
 | 
					              (rootPath + "/home/${unixName}/configurations/${hostName}")
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            config = {
 | 
				
			||||||
 | 
					              youthlic.nixos.enable = true;
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        extraSpecialArgs = {
 | 
					        extraSpecialArgs = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue