Include a package in the flake
This commit is contained in:
		
							parent
							
								
									620b84fd46
								
							
						
					
					
						commit
						68d5b081b1
					
				
					 2 changed files with 70 additions and 14 deletions
				
			
		
							
								
								
									
										21
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										21
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -15,6 +15,26 @@
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "naersk": {
 | 
				
			||||||
 | 
					      "inputs": {
 | 
				
			||||||
 | 
					        "nixpkgs": [
 | 
				
			||||||
 | 
					          "nixpkgs"
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "locked": {
 | 
				
			||||||
 | 
					        "lastModified": 1614785451,
 | 
				
			||||||
 | 
					        "narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=",
 | 
				
			||||||
 | 
					        "owner": "nmattia",
 | 
				
			||||||
 | 
					        "repo": "naersk",
 | 
				
			||||||
 | 
					        "rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9",
 | 
				
			||||||
 | 
					        "type": "github"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "original": {
 | 
				
			||||||
 | 
					        "owner": "nmattia",
 | 
				
			||||||
 | 
					        "repo": "naersk",
 | 
				
			||||||
 | 
					        "type": "github"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "nixpkgs": {
 | 
					    "nixpkgs": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1617042094,
 | 
					        "lastModified": 1617042094,
 | 
				
			||||||
| 
						 | 
					@ -34,6 +54,7 @@
 | 
				
			||||||
    "root": {
 | 
					    "root": {
 | 
				
			||||||
      "inputs": {
 | 
					      "inputs": {
 | 
				
			||||||
        "flake-utils": "flake-utils",
 | 
					        "flake-utils": "flake-utils",
 | 
				
			||||||
 | 
					        "naersk": "naersk",
 | 
				
			||||||
        "nixpkgs": "nixpkgs",
 | 
					        "nixpkgs": "nixpkgs",
 | 
				
			||||||
        "rust-overlay": "rust-overlay"
 | 
					        "rust-overlay": "rust-overlay"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										55
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										55
									
								
								flake.nix
									
										
									
									
									
								
							| 
						 | 
					@ -11,27 +11,62 @@
 | 
				
			||||||
        nixpkgs.follows = "nixpkgs";
 | 
					        nixpkgs.follows = "nixpkgs";
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					    naersk = {
 | 
				
			||||||
 | 
					      url = "github:nmattia/naersk";
 | 
				
			||||||
 | 
					      inputs.nixpkgs.follows = "nixpkgs";
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  outputs = { self, nixpkgs, flake-utils, rust-overlay }@inputs:
 | 
					  outputs = { self, nixpkgs, flake-utils, rust-overlay, naersk }@inputs:
 | 
				
			||||||
    flake-utils.lib.simpleFlake {
 | 
					    flake-utils.lib.simpleFlake {
 | 
				
			||||||
      inherit self nixpkgs;
 | 
					      inherit self nixpkgs;
 | 
				
			||||||
      name = "tlaternet";
 | 
					      name = "tlaternet";
 | 
				
			||||||
      preOverlays = [ rust-overlay.overlay ];
 | 
					      preOverlays = [ rust-overlay.overlay ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      shell = { pkgs }:
 | 
					      overlay = final: prev: {
 | 
				
			||||||
        let
 | 
					        tlaternet = let
 | 
				
			||||||
          rust_channel =
 | 
					          # The rust toolchain to use
 | 
				
			||||||
            pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
 | 
					          toolchain =
 | 
				
			||||||
        in pkgs.mkShell {
 | 
					            prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
 | 
				
			||||||
          nativeBuildInputs = with pkgs; [
 | 
					
 | 
				
			||||||
            (rust_channel.override {
 | 
					          # The rust build lib, set to use the toolchain
 | 
				
			||||||
 | 
					          naersk-lib = naersk.lib.${prev.system}.override {
 | 
				
			||||||
 | 
					            cargo = toolchain;
 | 
				
			||||||
 | 
					            rustc = toolchain;
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          # pkg-config, needed to include many native libs
 | 
				
			||||||
 | 
					          nativeBuildInputs = [ prev.pkgconfig ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          # Native libs
 | 
				
			||||||
 | 
					          buildInputs = [ prev.openssl ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        in rec {
 | 
				
			||||||
 | 
					          # The packages provided by this flake
 | 
				
			||||||
 | 
					          tlaternet = {
 | 
				
			||||||
 | 
					            webserver = prev.callPackage
 | 
				
			||||||
 | 
					              ({ rustPlatform, openssl, pkgconfig, ... }:
 | 
				
			||||||
 | 
					                naersk-lib.buildPackage {
 | 
				
			||||||
 | 
					                  inherit nativeBuildInputs buildInputs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                  pname = "tlaternet-webserver";
 | 
				
			||||||
 | 
					                  root = ./.;
 | 
				
			||||||
 | 
					                }) { };
 | 
				
			||||||
 | 
					          };
 | 
				
			||||||
 | 
					          defaultPackage = tlaternet.webserver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          # A dev shell to hack manually; note this includes
 | 
				
			||||||
 | 
					          # additional toolchain components
 | 
				
			||||||
 | 
					          devShell = prev.mkShell {
 | 
				
			||||||
 | 
					            inherit buildInputs;
 | 
				
			||||||
 | 
					            nativeBuildInputs = nativeBuildInputs ++ [
 | 
				
			||||||
 | 
					              (toolchain.override {
 | 
				
			||||||
                extensions =
 | 
					                extensions =
 | 
				
			||||||
                  [ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
 | 
					                  [ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
 | 
				
			||||||
              })
 | 
					              })
 | 
				
			||||||
            pkgconfig
 | 
					 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
          buildInputs = with pkgs; [ openssl ];
 | 
					          };
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue