forked from DGNum/infrastructure
feat(web01): Deploy static websites (without https for now)
This commit is contained in:
parent
03d4fd3982
commit
11030744b5
4 changed files with 110 additions and 0 deletions
|
@ -16,6 +16,7 @@ lib.extra.mkConfig {
|
|||
"ntfy-sh"
|
||||
"plausible"
|
||||
"redirections"
|
||||
"static"
|
||||
"wordpress"
|
||||
];
|
||||
|
||||
|
|
13
machines/web01/static/default.nix
Normal file
13
machines/web01/static/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
_:
|
||||
|
||||
let
|
||||
websites = import ./npins;
|
||||
|
||||
mkVhost = name:
|
||||
{ outPath, ... }: {
|
||||
# enableACME = true;
|
||||
# forceSSL = true;
|
||||
root = "${outPath}/www";
|
||||
};
|
||||
|
||||
in { services.nginx.virtualHosts = builtins.mapAttrs mkVhost websites; }
|
47
machines/web01/static/npins/default.nix
Normal file
47
machines/web01/static/npins/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Generated by npins. Do not modify; will be overwritten regularly
|
||||
let
|
||||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource = spec:
|
||||
assert spec ? type; let
|
||||
path =
|
||||
if spec.type == "Git" then mkGitSource spec
|
||||
else if spec.type == "GitRelease" then mkGitSource spec
|
||||
else if spec.type == "PyPi" then mkPyPiSource spec
|
||||
else if spec.type == "Channel" then mkChannelSource spec
|
||||
else builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource = { repository, revision, url ? null, hash, ... }:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else assert repository.type == "Git"; builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource = { url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource = { url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
49
machines/web01/static/npins/sources.json
Normal file
49
machines/web01/static/npins/sources.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"pins": {
|
||||
"48h.arts.ens.fr": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "Git",
|
||||
"url": "https://git.dgnum.eu/DGNum/48h.arts.ens.fr.git"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "7605283c144509606a952e003a1164618129eb4c",
|
||||
"url": null,
|
||||
"hash": "0x1iyq52awazxyhsx07qv5slgwym0k3gkhbnfflqcn2jmwkir0yr"
|
||||
},
|
||||
"interq.ens.fr": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "Git",
|
||||
"url": "https://git.dgnum.eu/DGNum/interq.ens.fr.git"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "8d3713de58cd45bf2ff078c8437321ec73925c7a",
|
||||
"url": null,
|
||||
"hash": "18kwwkp1w4yhg0kbjranj3fvfmr57awb3gnqmaxlnjk7c8l70ycg"
|
||||
},
|
||||
"lanuit.ens.fr": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "Git",
|
||||
"url": "https://git.dgnum.eu/DGNum/lanuit.ens.fr.git"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "f4dc07090fbd74970929b2cf411c74b090618c8f",
|
||||
"url": null,
|
||||
"hash": "0hpym1r8d8hgp4g7p6lk26fgcv9ia6993z91as1gfjs9ff3wgk0a"
|
||||
},
|
||||
"qda.ens.fr": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "Git",
|
||||
"url": "https://git.dgnum.eu/DGNum/qda.ens.fr.git"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "8b17a3c3a61041d9672077376b78d22519282096",
|
||||
"url": null,
|
||||
"hash": "10wr13yrq9p2pzg0pvv5vh3y2v6gb66iyc5civ3i90v7y2k1l9sx"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
Loading…
Reference in a new issue