feat: nix build enabled
This commit is contained in:
		
							parent
							
								
									ef63cd474f
								
							
						
					
					
						commit
						e7594ef2eb
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -10,3 +10,5 @@ | ||||
| */project/.bloop | ||||
| */project/target/ | ||||
| */target/ | ||||
| 
 | ||||
| */result | ||||
|  | ||||
							
								
								
									
										12
									
								
								11-single-price-grid-component/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								11-single-price-grid-component/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| .bsp/ | ||||
| .scala-build/ | ||||
| .metals/ | ||||
| .direnv | ||||
| */dist/ | ||||
| /11-single-price-grid-component/.bloop/ | ||||
| 
 | ||||
| */project/project/ | ||||
| */project/metals.sbt | ||||
| */project/.bloop | ||||
| */project/target/ | ||||
| */target/ | ||||
							
								
								
									
										39
									
								
								11-single-price-grid-component/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								11-single-price-grid-component/default.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | ||||
| { pkgs, sbt-derivation }: | ||||
| 
 | ||||
| let | ||||
|   package = sbt-derivation.lib.mkSbtDerivation { | ||||
|       inherit pkgs; | ||||
|       # ...and the rest of the arguments | ||||
|       pname = "price-grid-app"; | ||||
|       version = "0.0.1"; | ||||
|       src = pkgs.nix-gitignore.gitignoreSource [] ./.; | ||||
|       nativeBuildInputs = [ pkgs.nodePackages.tailwindcss ]; | ||||
|       buildPhase = '' | ||||
|         sbt assembly | ||||
|         tailwindcss -i ./src/input.css -o ./output.css | ||||
|       ''; | ||||
|       # css path different from ordinary development, | ||||
|       # because .gitignore makes it unavailable during nix build | ||||
|       # anyway copied to correct place | ||||
|       installPhase = '' | ||||
|         mkdir -p $out/bin | ||||
|         cp target/scala-*/priceGrid-assembly-*.jar $out/bin/ | ||||
|         mkdir -p $out/bin/dist | ||||
|         cp ./output.css $out/bin/dist/output.css | ||||
|         cp -r public $out/bin/public | ||||
|       ''; | ||||
| 
 | ||||
|       depsSha256 = "sha256-aWLqnPXvchtNqpSfXo5sWyK2QFNn1GqToy58cWrML3U="; | ||||
|     }; | ||||
| 
 | ||||
|   module = { config, pkgs, ... }: { | ||||
|     services.price-grid-app = { | ||||
|       enable = true; | ||||
|       package = package; | ||||
|     }; | ||||
|   }; | ||||
| in | ||||
| { | ||||
|   package = package; | ||||
|   module = module; | ||||
| } | ||||
| @ -33,10 +33,10 @@ case class AppRoutes()(implicit cc: castor.Context, | ||||
|   def index() = Page.wholePageMarkup | ||||
| 
 | ||||
|   @cask.staticFiles("/dist") // this is what path gets matched | ||||
|   def distFiles() = "dist" // this is os path where files are looked up, for the generated files | ||||
|   def distFiles() = "dist" | ||||
| 
 | ||||
|   @cask.staticFiles("/public") // this is what path gets matched | ||||
|   def publicFiles() = "public" // this is os path where files are looked up, for the committed files | ||||
|   def publicFiles() = "public" | ||||
| 
 | ||||
|   initialize() | ||||
| } | ||||
|  | ||||
							
								
								
									
										39
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										39
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @ -18,6 +18,21 @@ | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "flake-utils_2": { | ||||
|       "locked": { | ||||
|         "lastModified": 1667395993, | ||||
|         "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", | ||||
|         "owner": "numtide", | ||||
|         "repo": "flake-utils", | ||||
|         "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "numtide", | ||||
|         "repo": "flake-utils", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs": { | ||||
|       "locked": { | ||||
|         "lastModified": 1687695299, | ||||
| @ -36,7 +51,29 @@ | ||||
|     "root": { | ||||
|       "inputs": { | ||||
|         "flake-utils": "flake-utils", | ||||
|         "nixpkgs": "nixpkgs" | ||||
|         "nixpkgs": "nixpkgs", | ||||
|         "sbt-derivation": "sbt-derivation" | ||||
|       } | ||||
|     }, | ||||
|     "sbt-derivation": { | ||||
|       "inputs": { | ||||
|         "flake-utils": "flake-utils_2", | ||||
|         "nixpkgs": [ | ||||
|           "nixpkgs" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1675083208, | ||||
|         "narHash": "sha256-+sSFhSpV2jckr1qYlX/SaxQ6IdpagD6o4rru/3HAl0I=", | ||||
|         "owner": "zaninime", | ||||
|         "repo": "sbt-derivation", | ||||
|         "rev": "92d6d6d825e3f6ae5642d1cce8ff571c3368aaf7", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "zaninime", | ||||
|         "repo": "sbt-derivation", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "systems": { | ||||
|  | ||||
							
								
								
									
										22
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								flake.nix
									
									
									
									
									
								
							| @ -2,12 +2,19 @@ | ||||
|   description = "learning htmx"; | ||||
|   inputs.nixpkgs.url = "github:nixos/nixpkgs"; | ||||
|   inputs.flake-utils.url = "github:numtide/flake-utils"; | ||||
|   # add this line | ||||
|   inputs.sbt-derivation.url = "github:zaninime/sbt-derivation"; | ||||
|   # recommended for first style of usage documented below, but not necessary | ||||
|   inputs.sbt-derivation.inputs.nixpkgs.follows = "nixpkgs"; | ||||
| 
 | ||||
|   outputs = { self, nixpkgs, flake-utils }: | ||||
|     flake-utils.lib.eachDefaultSystem | ||||
|       (system: | ||||
|         let pkgs = nixpkgs.legacyPackages.${system}; in | ||||
|         { | ||||
|   outputs = { self, nixpkgs, flake-utils, sbt-derivation }: | ||||
|     flake-utils.lib.eachDefaultSystem (system: | ||||
|       let | ||||
|         pkgs = nixpkgs.legacyPackages.${system}; | ||||
|         price-grid = import ./11-single-price-grid-component/default.nix { | ||||
|           inherit pkgs sbt-derivation; | ||||
|         }; | ||||
|       in { | ||||
|         devShells.default = pkgs.mkShell { | ||||
|           buildInputs = [ | ||||
|             pkgs.scala-cli | ||||
| @ -17,7 +24,8 @@ | ||||
|             pkgs.jdk | ||||
|           ]; | ||||
|         }; | ||||
|         } | ||||
|       ); | ||||
|         packages.price-grid-app = price-grid.package; | ||||
|         nixosModules.price-grid-app = price-grid.module; | ||||
|       }); | ||||
|   # see https://serokell.io/blog/practical-nix-flakes | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user