Update the flake #7
861
Cargo.lock
generated
861
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
100
flake.lock
100
flake.lock
|
@ -1,6 +1,21 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1631561581,
|
||||
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
||||
|
@ -21,6 +36,27 @@
|
|||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659610603,
|
||||
"narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"tlaternet-templates",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1632266297,
|
||||
"narHash": "sha256-J1yeJk6Gud9ef2pEf6aKQemrfg1pVngYDSh+SAY94xk=",
|
||||
|
@ -36,6 +72,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1660318005,
|
||||
"narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5c211b47aeadcc178c5320afd4e74c7eed5c389f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1632408697,
|
||||
"narHash": "sha256-JqTfu361AwFmV0WszXLAjfukqGxBbHRopRgdp9A2w8s=",
|
||||
|
@ -53,18 +105,41 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
"rust-overlay": "rust-overlay",
|
||||
"tlaternet-templates": "tlaternet-templates"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660358625,
|
||||
"narHash": "sha256-uv+ZtOAEeM5tw78CLdRQmbZyDZYc0piSflthG2kNnrc=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "18354cce8137aaef0d505d6f677e9bbdd542020d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay_2": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"tlaternet-templates",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"tlaternet-templates",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
|
@ -81,6 +156,27 @@
|
|||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"tlaternet-templates": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"naersk": "naersk_2",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1633433130,
|
||||
"narHash": "sha256-jkW+HV8cJvE86gppOEXQl2ke+bDHJ7SAp8eJp8pJ0N8=",
|
||||
"ref": "master",
|
||||
"rev": "1232950c06ae16bf17fb16ac1f5f2231e971936b",
|
||||
"revCount": 16,
|
||||
"type": "git",
|
||||
"url": "https://gitea.tlater.net/tlaternet/tlaternet.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.tlater.net/tlaternet/tlaternet.git"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
110
flake.nix
110
flake.nix
|
@ -2,71 +2,81 @@
|
|||
description = "tlater.net web server";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
flake-utils.follows = "flake-utils";
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
naersk = {
|
||||
url = "github:nmattia/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
tlaternet-templates = {
|
||||
url = "git+https://gitea.tlater.net/tlaternet/tlaternet.git";
|
||||
# No need to override anything here; we can save some downloads
|
||||
# if we rely on the webserver to do that.
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, naersk }@inputs:
|
||||
flake-utils.lib.simpleFlake {
|
||||
inherit self nixpkgs;
|
||||
name = "tlaternet-webserver";
|
||||
preOverlays = [ rust-overlay.overlay ];
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
naersk,
|
||||
tlaternet-templates,
|
||||
}: let
|
||||
# At the moment, we only deploy to x86_64-linux. Update when we
|
||||
# care about another platform.
|
||||
system = "x86_64-linux";
|
||||
overlays = [
|
||||
rust-overlay.overlays.default
|
||||
];
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
|
||||
overlay = final: prev: {
|
||||
tlaternet-webserver = let
|
||||
# The rust toolchain to use
|
||||
toolchain =
|
||||
prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
# The rust build lib, set to use the toolchain
|
||||
naersk-lib = naersk.lib.${prev.system}.override {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
# Rust build config
|
||||
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
naersk-lib = naersk.lib.${system}.override {
|
||||
cargo = rust-toolchain;
|
||||
rustc = rust-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
|
||||
packages = {
|
||||
webserver = prev.callPackage
|
||||
({ rustPlatform, openssl, pkgconfig, ... }:
|
||||
naersk-lib.buildPackage {
|
||||
inherit nativeBuildInputs buildInputs;
|
||||
|
||||
pname = "tlaternet-webserver";
|
||||
root = ./.;
|
||||
}) { };
|
||||
};
|
||||
defaultPackage = packages.webserver;
|
||||
|
||||
# A dev shell to hack manually; note this includes
|
||||
# additional toolchain components
|
||||
devShell = prev.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
pkg-config
|
||||
openssl
|
||||
];
|
||||
in {
|
||||
packages.${system} = rec {
|
||||
tlaternet-webserver = naersk-lib.buildPackage {
|
||||
inherit buildInputs;
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
(toolchain.override {
|
||||
extensions =
|
||||
[ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
|
||||
pname = "tlaternet-webserver";
|
||||
root = pkgs.lib.cleanSource self;
|
||||
};
|
||||
default = tlaternet-webserver;
|
||||
};
|
||||
|
||||
apps.${system} = {
|
||||
run-with-templates = let
|
||||
script = pkgs.writeShellScriptBin "run-with-templates" ''
|
||||
export ROCKET_TEMPLATE_DIR=${tlaternet-templates.packages.${system}.tlaternet-templates}
|
||||
${self.packages.${system}.tlaternet-webserver}/bin/tlaternet-webserver
|
||||
'';
|
||||
in {
|
||||
type = "app";
|
||||
program = "${script}/bin/run-with-templates";
|
||||
};
|
||||
};
|
||||
|
||||
devShells.${system} = {
|
||||
default = pkgs.mkShell {
|
||||
packages = builtins.concatLists [
|
||||
buildInputs
|
||||
[
|
||||
(rust-toolchain.override {
|
||||
extensions = ["rust-src" "rust-analysis" "rust-analyzer-preview"];
|
||||
})
|
||||
]
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue