add examples to flake
This commit is contained in:
		
							parent
							
								
									3db1fb643f
								
							
						
					
					
						commit
						35f87eeed9
					
				
					 2 changed files with 53 additions and 56 deletions
				
			
		
							
								
								
									
										16
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										16
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							|  | @ -20,21 +20,6 @@ | |||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nix-filter": { | ||||
|       "locked": { | ||||
|         "lastModified": 1730207686, | ||||
|         "narHash": "sha256-SCHiL+1f7q9TAnxpasriP6fMarWE5H43t25F5/9e28I=", | ||||
|         "owner": "numtide", | ||||
|         "repo": "nix-filter", | ||||
|         "rev": "776e68c1d014c3adde193a18db9d738458cd2ba4", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "numtide", | ||||
|         "repo": "nix-filter", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs": { | ||||
|       "locked": { | ||||
|         "lastModified": 1730963269, | ||||
|  | @ -54,7 +39,6 @@ | |||
|     "root": { | ||||
|       "inputs": { | ||||
|         "naersk": "naersk", | ||||
|         "nix-filter": "nix-filter", | ||||
|         "nixpkgs": "nixpkgs" | ||||
|       } | ||||
|     } | ||||
|  |  | |||
							
								
								
									
										93
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										93
									
								
								flake.nix
									
										
									
									
									
								
							|  | @ -3,7 +3,6 @@ | |||
| 
 | ||||
|   inputs = { | ||||
|     nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; | ||||
|     nix-filter.url = "github:numtide/nix-filter"; | ||||
|     naersk = { | ||||
|       url = "github:nix-community/naersk"; | ||||
|       inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | @ -15,7 +14,6 @@ | |||
|       self, | ||||
|       nixpkgs, | ||||
|       naersk, | ||||
|       nix-filter, | ||||
|     }: | ||||
|     let | ||||
|       lib = nixpkgs.lib; | ||||
|  | @ -47,46 +45,61 @@ | |||
|             cargo = rust-toolchain-core; | ||||
|             rustc = rust-toolchain-core; | ||||
|           }; | ||||
|           source = nix-filter.lib.filter { | ||||
|              root = ./.; | ||||
|              include = [ | ||||
|                ./Cargo.toml | ||||
|                ./Cargo.lock | ||||
|                ./crates | ||||
|                ./Web437_IBM_BIOS.woff | ||||
|                ./README.md | ||||
|                ./LICENSE | ||||
|              ]; | ||||
|            }; | ||||
|           nativeBuildInputs = with pkgs; [ | ||||
|             pkg-config | ||||
|             makeWrapper | ||||
|           ]; | ||||
|           buildInputs = with pkgs; [ | ||||
|             xe | ||||
|             lzma | ||||
|           ]; | ||||
|           makeExample = | ||||
|             package: example: | ||||
|             naersk'.buildPackage { | ||||
|               pname = example; | ||||
|               cargoBuildOptions = | ||||
|                 x: | ||||
|                 x | ||||
|                 ++ [ | ||||
|                   "--package" | ||||
|                   package | ||||
|                 ]; | ||||
|               src = ./.; | ||||
|               nativeBuildInputs = nativeBuildInputs; | ||||
|               strictDeps = true; | ||||
|               buildInputs = buildInputs; | ||||
|               overrideMain = old: { | ||||
|                   preConfigure = '' | ||||
|                     cargo_build_options="$cargo_build_options --example ${example}" | ||||
|                   ''; | ||||
|                 }; | ||||
|             }; | ||||
|           makePackage = | ||||
|             package: | ||||
|             let | ||||
|               package-param = [ | ||||
|                 "--package" | ||||
|                 package | ||||
|               ]; | ||||
|             in | ||||
|             naersk'.buildPackage { | ||||
|               pname = package; | ||||
|               cargoBuildOptions = x: x ++ package-param; | ||||
|               cargoTestOptions = x: x ++ package-param; | ||||
|               src = ./.; | ||||
|               doCheck = true; | ||||
|               nativeBuildInputs = nativeBuildInputs; | ||||
|               strictDeps = true; | ||||
|               buildInputs = buildInputs; | ||||
|             }; | ||||
|         in | ||||
|         rec { | ||||
|           servicepoint = naersk'.buildPackage rec { | ||||
|             cargoBuildOptions = | ||||
|               x: | ||||
|               x | ||||
|               ++ [ | ||||
|                 "-p" | ||||
|                 "servicepoint" | ||||
|               ]; | ||||
|             cargoTestOptions = | ||||
|               x: | ||||
|               x | ||||
|               ++ [ | ||||
|                 "-p" | ||||
|                 "servicepoint" | ||||
|               ]; | ||||
|             src = source; | ||||
|             doCheck = true; | ||||
|             nativeBuildInputs = with pkgs; [ | ||||
|               pkg-config | ||||
|               makeWrapper | ||||
|             ]; | ||||
|             strictDeps = true; | ||||
|             buildInputs = with pkgs; [ | ||||
|               xe | ||||
|               lzma | ||||
|             ]; | ||||
|           }; | ||||
|           servicepoint = makePackage "servicepoint"; | ||||
|           announce = makeExample "servicepoint" "announce"; | ||||
|           game-of-life = makeExample "servicepoint" "game_of_life"; | ||||
|           moving-line = makeExample "servicepoint" "moving_line"; | ||||
|           random-brightness = makeExample "servicepoint" "random_brightness"; | ||||
|           wiping-clear = makeExample "servicepoint" "wiping_clear"; | ||||
|         } | ||||
|       ); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter