Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
d92860e825 | |||
6ac19fe898 | |||
75fd905547 | |||
3df814c64c | |||
84f4aa9be3 | |||
0a518ab331 | |||
5caed6729a | |||
7846872aaa | |||
54e05d5d78 | |||
7c84ae8c0e | |||
256823ff11 | |||
00db6b1718 | |||
f914537eb2 | |||
5f29a3edfa | |||
c4b14164c0 | |||
8f129d9175 | |||
3830d488b8 | |||
7b5ed9ebae | |||
1b504c4557 | |||
7d2a9047c3 | |||
1e5db2ca2a | |||
35e8eac61a | |||
e7553c37d4 | |||
cc6233cb63 | |||
16743bbc26 | |||
ac479aa53d | |||
2ca188a473 | |||
2cf454e559 | |||
690ab9ea07 | |||
8f656f5252 | |||
7a61acf5e2 | |||
171d6f590b | |||
d63aaee2d3 | |||
e453c7aa25 | |||
99d386900e | |||
c2fb288a07 | |||
7a9def97cb | |||
815b213a2a | |||
1e44bc1a8f | |||
2507c24de7 | |||
d78b349ca1 | |||
4b37c8073f |
3
.cargo/audit.toml
Normal file
3
.cargo/audit.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[advisories]
|
||||||
|
# TODO: check if chrono fixed this
|
||||||
|
ignore = [ "RUSTSEC-2020-0159", "RUSTSEC-2020-0071" ]
|
698
Cargo.lock
generated
698
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
26
Cargo.toml
26
Cargo.toml
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "hoc"
|
name = "hoc"
|
||||||
version = "0.21.0"
|
version = "0.21.3"
|
||||||
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
@ -14,33 +14,33 @@ name = "hoc"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "2.6.0"
|
actix-rt = "2.6.0"
|
||||||
actix-web = "4.0.0-beta.21"
|
actix-web = "4.0.0-rc.3"
|
||||||
badge = "0.3.0"
|
badge = "0.3.0"
|
||||||
bytes = "1.1.0"
|
bytes = "1.1.0"
|
||||||
config = { version = "0.11.0", features = ["toml"] }
|
config = { version = "0.12.0", features = ["toml"] }
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
futures = "0.3.19"
|
futures = "0.3.21"
|
||||||
git2 = "0.13.25"
|
git2 = "0.14.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
number_prefix = "0.4.0"
|
number_prefix = "0.4.0"
|
||||||
openssl-probe = "0.1.5"
|
openssl-probe = "0.1.5"
|
||||||
reqwest = "0.11.9"
|
reqwest = "0.11.9"
|
||||||
serde = "1.0.136"
|
serde = "1.0.136"
|
||||||
serde_derive = "1.0.136"
|
serde_derive = "1.0.136"
|
||||||
serde_json = "1.0.78"
|
serde_json = "1.0.79"
|
||||||
tracing = "0.1.29"
|
tracing = "0.1.31"
|
||||||
tracing-actix-web = "0.5.0-beta.11"
|
tracing-actix-web = "0.5.0-rc.3"
|
||||||
tracing-bunyan-formatter = "0.3.2"
|
tracing-bunyan-formatter = "0.3.2"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
tracing-log = "0.1.2"
|
tracing-log = "0.1.2"
|
||||||
tracing-subscriber = { version = "0.3.7", features = ["registry", "env-filter"] }
|
tracing-subscriber = { version = "0.3.9", features = ["registry", "env-filter"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
ructe = "0.13.4"
|
ructe = "0.14.0"
|
||||||
vergen = { version = "6.0.2", default-features = false, features = ["git"] }
|
vergen = { version = "6.0.2", default-features = false, features = ["git"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
awc = "3.0.0-beta.19"
|
awc = "3.0.0-beta.21"
|
||||||
ructe = "0.13.4"
|
ructe = "0.14.0"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
tokio = "1.16.1"
|
tokio = "1.17.0"
|
||||||
|
9
build.rs
9
build.rs
@ -1,15 +1,12 @@
|
|||||||
extern crate ructe;
|
extern crate ructe;
|
||||||
extern crate vergen;
|
extern crate vergen;
|
||||||
|
|
||||||
use ructe::Ructe;
|
use ructe::{Ructe, RucteError};
|
||||||
use vergen::{vergen, Config, ShaKind};
|
use vergen::{vergen, Config, ShaKind};
|
||||||
|
|
||||||
fn main() {
|
fn main() -> Result<(), RucteError> {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
*config.git_mut().sha_kind_mut() = ShaKind::Short;
|
*config.git_mut().sha_kind_mut() = ShaKind::Short;
|
||||||
vergen(config).expect("Unable to generate static repo info");
|
vergen(config).expect("Unable to generate static repo info");
|
||||||
Ructe::from_env()
|
Ructe::from_env()?.compile_templates("templates")
|
||||||
.expect("ructe")
|
|
||||||
.compile_templates("templates")
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{}
|
|
56
default.nix
56
default.nix
@ -1,56 +0,0 @@
|
|||||||
{ sources ? import ./nix/sources.nix
|
|
||||||
, system ? builtins.currentSystem
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
rustOverlay = import "${sources.nixpkgs-mozilla}/rust-overlay.nix";
|
|
||||||
cargo2nixOverlay = import "${sources.cargo2nix}/overlay";
|
|
||||||
|
|
||||||
pkgs = import sources.nixpkgs {
|
|
||||||
# pkgs = import <nixpkgs> {
|
|
||||||
inherit system;
|
|
||||||
overlays = [ cargo2nixOverlay rustOverlay ];
|
|
||||||
};
|
|
||||||
|
|
||||||
rustPkgs = pkgs.rustBuilder.makePackageSet' {
|
|
||||||
rustChannel = "stable";
|
|
||||||
packageFun = import ./Cargo.nix;
|
|
||||||
localPatterns =
|
|
||||||
[
|
|
||||||
''^(src|tests)(/.*)?''
|
|
||||||
''[^/]*\.(rs|toml)$''
|
|
||||||
# include other directory from the project repository
|
|
||||||
''^templates(/.*)?''
|
|
||||||
''^static(/.*)?''
|
|
||||||
''^.git.*(/.*)?''
|
|
||||||
];
|
|
||||||
# packageOverrides
|
|
||||||
};
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
inherit rustPkgs;
|
|
||||||
shell = pkgs.mkShell {
|
|
||||||
inputsFrom = pkgs.lib.mapAttrsToList (_: pkg: pkg { }) rustPkgs.noBuild.workspace;
|
|
||||||
nativeBuildInputs = with rustPkgs; [ cargo rustc ];
|
|
||||||
};
|
|
||||||
package = (rustPkgs.workspace.hoc {}).overrideAttrs (drv: {
|
|
||||||
buildInputs = drv.buildInputs or [ ] ++ [ pkgs.git ];
|
|
||||||
});
|
|
||||||
dockerImage =
|
|
||||||
pkgs.dockerTools.buildImage {
|
|
||||||
name = "vbrandl/hits-of-code";
|
|
||||||
tag = package.version;
|
|
||||||
|
|
||||||
contents =
|
|
||||||
[
|
|
||||||
package
|
|
||||||
pkgs.cacert
|
|
||||||
pkgs.gitMinimal
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
|
||||||
Cmd = [ "/bin/hoc" ];
|
|
||||||
WorkingDir = "/home/hoc";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
{
|
|
||||||
"cargo2nix": {
|
|
||||||
"branch": "master",
|
|
||||||
"description": "Convert a Cargo.lock to mkRustCrate statements for import in Nix",
|
|
||||||
"homepage": "",
|
|
||||||
"owner": "tenx-tech",
|
|
||||||
"repo": "cargo2nix",
|
|
||||||
"rev": "7bc062ccffc41dc7d3759b8b797e8b4f8dd23a15",
|
|
||||||
"sha256": "1z7xwk1hbp26aydsk3y07riy0ivwqss06n1470mvdl7allfcd1w5",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/tenx-tech/cargo2nix/archive/7bc062ccffc41dc7d3759b8b797e8b4f8dd23a15.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"niv": {
|
|
||||||
"branch": "master",
|
|
||||||
"description": "Easy dependency management for Nix projects",
|
|
||||||
"homepage": "https://github.com/nmattia/niv",
|
|
||||||
"owner": "nmattia",
|
|
||||||
"repo": "niv",
|
|
||||||
"rev": "98c74a80934123cb4c3bf3314567f67311eb711a",
|
|
||||||
"sha256": "1w8n54hapd4x9f1am33icvngkqns7m3hl9yair38yqq08ffwg0kn",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/nmattia/niv/archive/98c74a80934123cb4c3bf3314567f67311eb711a.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"branch": "nixpkgs-unstable",
|
|
||||||
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
|
|
||||||
"homepage": "https://github.com/NixOS/nixpkgs",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs-channels",
|
|
||||||
"rev": "f6bfb371cba2b5a02f200c2747c1fe2c72bd782f",
|
|
||||||
"sha256": "0y3hlbyvznrpr1d2vxj2511hkjg733wdnxfaib3fgy9i9jr8ivzn",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs-channels/archive/f6bfb371cba2b5a02f200c2747c1fe2c72bd782f.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
},
|
|
||||||
"nixpkgs-mozilla": {
|
|
||||||
"branch": "master",
|
|
||||||
"description": "mozilla related nixpkgs (extends nixos/nixpkgs repo)",
|
|
||||||
"homepage": null,
|
|
||||||
"owner": "mozilla",
|
|
||||||
"repo": "nixpkgs-mozilla",
|
|
||||||
"rev": "e912ed483e980dfb4666ae0ed17845c4220e5e7c",
|
|
||||||
"sha256": "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed483e980dfb4666ae0ed17845c4220e5e7c.tar.gz",
|
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
||||||
}
|
|
||||||
}
|
|
134
nix/sources.nix
134
nix/sources.nix
@ -1,134 +0,0 @@
|
|||||||
# This file has been generated by Niv.
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
#
|
|
||||||
# The fetchers. fetch_<type> fetches specs of type <type>.
|
|
||||||
#
|
|
||||||
|
|
||||||
fetch_file = pkgs: spec:
|
|
||||||
if spec.builtin or true then
|
|
||||||
builtins_fetchurl { inherit (spec) url sha256; }
|
|
||||||
else
|
|
||||||
pkgs.fetchurl { inherit (spec) url sha256; };
|
|
||||||
|
|
||||||
fetch_tarball = pkgs: spec:
|
|
||||||
if spec.builtin or true then
|
|
||||||
builtins_fetchTarball { inherit (spec) url sha256; }
|
|
||||||
else
|
|
||||||
pkgs.fetchzip { inherit (spec) url sha256; };
|
|
||||||
|
|
||||||
fetch_git = spec:
|
|
||||||
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
|
|
||||||
|
|
||||||
fetch_builtin-tarball = spec:
|
|
||||||
builtins.trace
|
|
||||||
''
|
|
||||||
WARNING:
|
|
||||||
The niv type "builtin-tarball" will soon be deprecated. You should
|
|
||||||
instead use `builtin = true`.
|
|
||||||
|
|
||||||
$ niv modify <package> -a type=tarball -a builtin=true
|
|
||||||
''
|
|
||||||
builtins_fetchTarball { inherit (spec) url sha256; };
|
|
||||||
|
|
||||||
fetch_builtin-url = spec:
|
|
||||||
builtins.trace
|
|
||||||
''
|
|
||||||
WARNING:
|
|
||||||
The niv type "builtin-url" will soon be deprecated. You should
|
|
||||||
instead use `builtin = true`.
|
|
||||||
|
|
||||||
$ niv modify <package> -a type=file -a builtin=true
|
|
||||||
''
|
|
||||||
(builtins_fetchurl { inherit (spec) url sha256; });
|
|
||||||
|
|
||||||
#
|
|
||||||
# Various helpers
|
|
||||||
#
|
|
||||||
|
|
||||||
# The set of packages used when specs are fetched using non-builtins.
|
|
||||||
mkPkgs = sources:
|
|
||||||
let
|
|
||||||
sourcesNixpkgs =
|
|
||||||
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
|
|
||||||
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
|
||||||
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
|
||||||
in
|
|
||||||
if builtins.hasAttr "nixpkgs" sources
|
|
||||||
then sourcesNixpkgs
|
|
||||||
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
|
||||||
import <nixpkgs> {}
|
|
||||||
else
|
|
||||||
abort
|
|
||||||
''
|
|
||||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
|
||||||
add a package called "nixpkgs" to your sources.json.
|
|
||||||
'';
|
|
||||||
|
|
||||||
# The actual fetching function.
|
|
||||||
fetch = pkgs: name: spec:
|
|
||||||
|
|
||||||
if ! builtins.hasAttr "type" spec then
|
|
||||||
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
|
||||||
else if spec.type == "file" then fetch_file pkgs spec
|
|
||||||
else if spec.type == "tarball" then fetch_tarball pkgs spec
|
|
||||||
else if spec.type == "git" then fetch_git spec
|
|
||||||
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
|
|
||||||
else if spec.type == "builtin-url" then fetch_builtin-url spec
|
|
||||||
else
|
|
||||||
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
|
||||||
|
|
||||||
# Ports of functions for older nix versions
|
|
||||||
|
|
||||||
# a Nix version of mapAttrs if the built-in doesn't exist
|
|
||||||
mapAttrs = builtins.mapAttrs or (
|
|
||||||
f: set: with builtins;
|
|
||||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
|
||||||
);
|
|
||||||
|
|
||||||
# fetchTarball version that is compatible between all the versions of Nix
|
|
||||||
builtins_fetchTarball = { url, sha256 }@attrs:
|
|
||||||
let
|
|
||||||
inherit (builtins) lessThan nixVersion fetchTarball;
|
|
||||||
in
|
|
||||||
if lessThan nixVersion "1.12" then
|
|
||||||
fetchTarball { inherit url; }
|
|
||||||
else
|
|
||||||
fetchTarball attrs;
|
|
||||||
|
|
||||||
# fetchurl version that is compatible between all the versions of Nix
|
|
||||||
builtins_fetchurl = { url, sha256 }@attrs:
|
|
||||||
let
|
|
||||||
inherit (builtins) lessThan nixVersion fetchurl;
|
|
||||||
in
|
|
||||||
if lessThan nixVersion "1.12" then
|
|
||||||
fetchurl { inherit url; }
|
|
||||||
else
|
|
||||||
fetchurl attrs;
|
|
||||||
|
|
||||||
# Create the final "sources" from the config
|
|
||||||
mkSources = config:
|
|
||||||
mapAttrs (
|
|
||||||
name: spec:
|
|
||||||
if builtins.hasAttr "outPath" spec
|
|
||||||
then abort
|
|
||||||
"The values in sources.json should not have an 'outPath' attribute"
|
|
||||||
else
|
|
||||||
spec // { outPath = fetch config.pkgs name spec; }
|
|
||||||
) config.sources;
|
|
||||||
|
|
||||||
# The "config" used by the fetchers
|
|
||||||
mkConfig =
|
|
||||||
{ sourcesFile ? ./sources.json
|
|
||||||
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
|
|
||||||
, pkgs ? mkPkgs sources
|
|
||||||
}: rec {
|
|
||||||
# The sources, i.e. the attribute set of spec name to spec
|
|
||||||
inherit sources;
|
|
||||||
|
|
||||||
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
|
||||||
inherit pkgs;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
|
@ -1 +1,8 @@
|
|||||||
with import ./. { }; shell
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
openssl
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
}
|
||||||
|
@ -18,21 +18,16 @@ pub struct Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
#[deprecated]
|
|
||||||
pub fn new() -> Result<Self, ConfigError> {
|
|
||||||
Self::load()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn load() -> Result<Self, ConfigError> {
|
pub fn load() -> Result<Self, ConfigError> {
|
||||||
let mut config = Config::new();
|
Config::builder()
|
||||||
config
|
.add_source(File::with_name("hoc.toml").required(false))
|
||||||
.merge(File::with_name("hoc.toml").required(false))?
|
.add_source(Environment::with_prefix("hoc"))
|
||||||
.merge(Environment::with_prefix("hoc"))?
|
|
||||||
.set_default("repodir", "./repos")?
|
.set_default("repodir", "./repos")?
|
||||||
.set_default("cachedir", "./cache")?
|
.set_default("cachedir", "./cache")?
|
||||||
.set_default("workers", 4)?
|
.set_default("workers", 4)?
|
||||||
.set_default("port", 8080)?
|
.set_default("port", 8080)?
|
||||||
.set_default("host", "0.0.0.0")?;
|
.set_default("host", "0.0.0.0")?
|
||||||
config.try_into()
|
.build()?
|
||||||
|
.try_deserialize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
src/lib.rs
13
src/lib.rs
@ -462,11 +462,13 @@ async fn async_p404(repo_count: web::Data<AtomicUsize>) -> Result<HttpResponse>
|
|||||||
p404(repo_count)
|
p404(repo_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn css() -> HttpResponse {
|
#[get("/tacit-css.min.css")]
|
||||||
|
async fn css() -> HttpResponse {
|
||||||
HttpResponse::Ok().content_type("text/css").body(CSS)
|
HttpResponse::Ok().content_type("text/css").body(CSS)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn favicon32() -> HttpResponse {
|
#[get("/favicon.ico")]
|
||||||
|
async fn favicon32() -> HttpResponse {
|
||||||
HttpResponse::Ok().content_type("image/png").body(FAVICON)
|
HttpResponse::Ok().content_type("image/png").body(FAVICON)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,15 +486,14 @@ async fn start_server(listener: TcpListener, settings: Settings) -> std::io::Res
|
|||||||
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
|
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
|
||||||
.service(index)
|
.service(index)
|
||||||
.service(health_check)
|
.service(health_check)
|
||||||
.service(web::resource("/tacit-css.min.css").route(web::get().to(css)))
|
.service(css)
|
||||||
.service(web::resource("/favicon.ico").route(web::get().to(favicon32)))
|
.service(favicon32)
|
||||||
.service(generate)
|
.service(generate)
|
||||||
.default_service(web::to(async_p404));
|
.default_service(web::to(async_p404));
|
||||||
let app = GitHub::register_service(app);
|
let app = GitHub::register_service(app);
|
||||||
let app = Gitlab::register_service(app);
|
let app = Gitlab::register_service(app);
|
||||||
let app = Bitbucket::register_service(app);
|
let app = Bitbucket::register_service(app);
|
||||||
let app = Sourcehut::register_service(app);
|
Sourcehut::register_service(app)
|
||||||
app
|
|
||||||
})
|
})
|
||||||
.workers(workers)
|
.workers(workers)
|
||||||
.listen(listener)?
|
.listen(listener)?
|
||||||
|
31
tests/resources.rs
Normal file
31
tests/resources.rs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
mod util;
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn favicon() {
|
||||||
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
|
let client = awc::Client::default();
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.get(&format!("{}/favicon.ico", test_app.address))
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.expect("Failed to execute request");
|
||||||
|
|
||||||
|
assert!(response.status().is_success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn tacit_css() {
|
||||||
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
|
let client = awc::Client::default();
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.get(&format!("{}/tacit-css.min.css", test_app.address))
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.expect("Failed to execute request");
|
||||||
|
|
||||||
|
assert!(response.status().is_success());
|
||||||
|
}
|
80
vm.nix
80
vm.nix
@ -1,80 +0,0 @@
|
|||||||
# Nix configuration for a VM to run a custom configured Vim
|
|
||||||
#
|
|
||||||
# It is intended as an example of building a VM that builds Vim for testing
|
|
||||||
# and evaluation purposes. It does not represent a production or secure
|
|
||||||
# deployment.
|
|
||||||
|
|
||||||
{ sources ? import ./nix/sources.nix
|
|
||||||
, pkgs ? import sources.nixpkgs { }
|
|
||||||
, callPackage ? pkgs.callPackage
|
|
||||||
, config
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
# config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
hoc = pkgs.callPackage ./default.nix { };
|
|
||||||
|
|
||||||
# hoc = cargoNix.rootCrate.build;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
environment = {
|
|
||||||
systemPackages = with pkgs; [
|
|
||||||
(
|
|
||||||
hoc
|
|
||||||
# import ./default.nix
|
|
||||||
)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
networking.hostName = "hoc"; # Define your hostname.
|
|
||||||
|
|
||||||
system.stateVersion = "19.09"; # The version of NixOS originally installed
|
|
||||||
|
|
||||||
# Set security options:
|
|
||||||
security = {
|
|
||||||
sudo = {
|
|
||||||
enable = true; # Enable sudo
|
|
||||||
wheelNeedsPassword = false; # Allow wheel members to run sudo without a passowrd
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
||||||
|
|
||||||
# List services that you want to enable:
|
|
||||||
services.openssh = {
|
|
||||||
enable = true; # Enable the OpenSSH daemon.
|
|
||||||
#permitRootLogin = "yes"; # Probably want to change this in production
|
|
||||||
#challengeResponseAuthentication = true; # Probably want to change this in production
|
|
||||||
#passwordAuthentication = true; # Probably want to change this in production
|
|
||||||
openFirewall = true;
|
|
||||||
hostKeys = [
|
|
||||||
{
|
|
||||||
path = "/etc/ssh/ssh_host_ed25519_key"; # Generate a key for the vm
|
|
||||||
type = "ed25519"; # Use the current best key type
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Users of the Vim VM:
|
|
||||||
users.mutableUsers = false; # Remove any users not defined in here
|
|
||||||
|
|
||||||
users.users.root = {
|
|
||||||
password = "123456"; # Probably want to change this in production
|
|
||||||
};
|
|
||||||
|
|
||||||
# Misc groups:
|
|
||||||
users.groups.nixos.gid = 1000;
|
|
||||||
|
|
||||||
# NixOS users
|
|
||||||
users.users.nixos = {
|
|
||||||
isNormalUser = true;
|
|
||||||
uid = 1000;
|
|
||||||
group = "nixos";
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
password = "123456"; # Probably want to change this in production
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
Reference in New Issue
Block a user