Add dvt script to flake outputs
This commit is contained in:
		
							parent
							
								
									20b5b176c1
								
							
						
					
					
						commit
						801caa1fcf
					
				
					 2 changed files with 23 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
.direnv/
 | 
					.direnv/
 | 
				
			||||||
target
 | 
					target
 | 
				
			||||||
 | 
					result
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								flake.nix
									
										
									
									
									
								
							| 
						 | 
					@ -133,19 +133,38 @@
 | 
				
			||||||
          ${exec "nixpkgs-fmt"} **/*.nix
 | 
					          ${exec "nixpkgs-fmt"} **/*.nix
 | 
				
			||||||
        '';
 | 
					        '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        dvt = writeScriptBin "dvt" ''
 | 
				
			||||||
 | 
					          if [ -z $1 ]; then
 | 
				
			||||||
 | 
					            echo "no template specified"
 | 
				
			||||||
 | 
					            exit 1
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          TEMPLATE=$1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          ${exec "nix"} \
 | 
				
			||||||
 | 
					            --experimental-features 'nix-command flakes' \
 | 
				
			||||||
 | 
					            flake init \
 | 
				
			||||||
 | 
					            --template \
 | 
				
			||||||
 | 
					            "github:the-nix-way/dev-templates#''${TEMPLATE}"
 | 
				
			||||||
 | 
					        '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        update = writeScriptBin "update" ''
 | 
					        update = writeScriptBin "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
 | 
				
			||||||
              ${exec "nix"} flake update # Update flake.lock
 | 
					              ${exec "nix"} flake update # Update flake.lock
 | 
				
			||||||
              ${
 | 
					              ${exec "direnv"} reload    # Make sure things work after the update
 | 
				
			||||||
                exec "direnv"
 | 
					 | 
				
			||||||
              } reload    # Make sure things work after the update
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
          done
 | 
					          done
 | 
				
			||||||
        '';
 | 
					        '';
 | 
				
			||||||
      in
 | 
					      in
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        devShells = { default = mkShell { buildInputs = [ format update ]; }; };
 | 
					        devShells = { default = mkShell { buildInputs = [ format update ]; }; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        packages = rec {
 | 
				
			||||||
 | 
					          default = dvt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          inherit dvt;
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue