Add visit command
This commit is contained in:
		
							parent
							
								
									eefc02f206
								
							
						
					
					
						commit
						056f6f7068
					
				
					 1 changed files with 19 additions and 8 deletions
				
			
		
							
								
								
									
										27
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										27
									
								
								flake.nix
									
										
									
									
									
								
							| 
						 | 
					@ -11,26 +11,37 @@
 | 
				
			||||||
    flake-utils.lib.eachDefaultSystem (system:
 | 
					    flake-utils.lib.eachDefaultSystem (system:
 | 
				
			||||||
      let
 | 
					      let
 | 
				
			||||||
        pkgs = import nixpkgs { inherit system; };
 | 
					        pkgs = import nixpkgs { inherit system; };
 | 
				
			||||||
        inherit (pkgs) mkShell;
 | 
					        inherit (pkgs) mkShell writeScriptBin;
 | 
				
			||||||
        format = pkgs.writeScriptBin "format" ''
 | 
					        run = pkg: "${pkgs.${pkg}}/bin/${pkg}";
 | 
				
			||||||
          ${pkgs.nixfmt}/bin/nixfmt **/*.nix
 | 
					
 | 
				
			||||||
 | 
					        format = writeScriptBin "format" ''
 | 
				
			||||||
 | 
					          ${run "nixfmt"} **/*.nix
 | 
				
			||||||
        '';
 | 
					        '';
 | 
				
			||||||
        update = pkgs.writeScriptBin "update" ''
 | 
					        update = writeScriptBin "update" ''
 | 
				
			||||||
          # Update root
 | 
					          # Update root
 | 
				
			||||||
          ${pkgs.nix}/bin/nix flake update
 | 
					          $${run "nix"} flake update
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          for dir in `ls -d */`; do # Iterate through all the templates
 | 
					          for dir in `ls -d */`; do # Iterate through all the templates
 | 
				
			||||||
            (
 | 
					            (
 | 
				
			||||||
              cd $dir
 | 
					              cd $dir
 | 
				
			||||||
              ${pkgs.nix}/bin/nix flake update # Update flake.lock
 | 
					              ${run "nix"} flake update # Update flake.lock
 | 
				
			||||||
              ${pkgs.direnv}/bin/direnv reload # Make sure things work after the update
 | 
					              ${run "direnv"} reload    # Make sure things work after the update
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					          done
 | 
				
			||||||
 | 
					        '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        visit = writeScriptBin "visit" ''
 | 
				
			||||||
 | 
					          for dir in `ls -d */`; do
 | 
				
			||||||
 | 
					            (
 | 
				
			||||||
 | 
					              cd $dir
 | 
				
			||||||
 | 
					              ${run "direnv"} reload
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
          done
 | 
					          done
 | 
				
			||||||
        '';
 | 
					        '';
 | 
				
			||||||
      in {
 | 
					      in {
 | 
				
			||||||
        devShells = {
 | 
					        devShells = {
 | 
				
			||||||
          default = mkShell {
 | 
					          default = mkShell {
 | 
				
			||||||
            buildInputs = with pkgs; [ format update ];
 | 
					            buildInputs = [ format update visit ];
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue