mirror of
				https://github.com/nmasur/dotfiles
				synced 2025-10-30 08:03:15 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   config,
 | |
|   pkgs,
 | |
|   lib,
 | |
|   ...
 | |
| }:
 | |
| 
 | |
| let
 | |
|   cfg = config.nmasur.presets.programs.nixpkgs-darwin;
 | |
| in
 | |
| 
 | |
| {
 | |
| 
 | |
|   options.nmasur.presets.programs.nixpkgs-darwin.enable = lib.mkEnableOption {
 | |
|     description = "Nixpkgs tools for macOS";
 | |
|     default = config.nmasur.presets.programs.nixpkgs && pkgs.stdenv.isDarwin;
 | |
|   };
 | |
| 
 | |
|   config = lib.mkIf (cfg.enable) {
 | |
| 
 | |
|     programs.fish = {
 | |
|       shellAbbrs = {
 | |
|         nr = {
 | |
|           function = lib.mkForce "rebuild-darwin";
 | |
|         };
 | |
|         nro = {
 | |
|           function = lib.mkForce "rebuild-darwin-offline";
 | |
|         };
 | |
|       };
 | |
|       functions = {
 | |
|         rebuild-darwin = {
 | |
|           body = ''
 | |
|             git -C ${config.dotfilesPath} add --intent-to-add --all
 | |
|             echo "darwin-rebuild switch --flake ${config.dotfilesPath}#lookingglass"
 | |
|           '';
 | |
|         };
 | |
|         rebuild-darwin-offline = {
 | |
|           body = ''
 | |
|             git -C ${config.dotfilesPath} add --intent-to-add --all
 | |
|             echo "darwin-rebuild switch --option substitute false --flake ${config.dotfilesPath}#lookingglass"
 | |
|           '';
 | |
|         };
 | |
|         rebuild-home = lib.mkForce {
 | |
|           body = ''
 | |
|             git -C ${config.dotfilesPath} add --intent-to-add --all
 | |
|             echo "${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#lookingglass";
 | |
|           '';
 | |
|         };
 | |
|       };
 | |
|     };
 | |
| 
 | |
|   };
 | |
| }
 |