mirror of
https://git.sr.ht/~magic_rb/website
synced 2024-11-21 15:54:21 +01:00
Move container to systems, simplify
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
7751dd3ccd
commit
e2249619a8
17
flake.lock
17
flake.lock
|
@ -21,17 +21,16 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1617561707,
|
||||
"narHash": "sha256-mQ05xYziJutQIi4pHfI1QbOq6EvrfN6GcvM/hM9sSV0=",
|
||||
"ref": "master",
|
||||
"rev": "2570dcc47d42d959221480156196d0a22086f00b",
|
||||
"revCount": 19,
|
||||
"type": "git",
|
||||
"url": "https://gitea.redalder.org/Magic_RB/NixNG"
|
||||
"lastModified": 1619975252,
|
||||
"narHash": "sha256-Amx08/6MpMPLkqAukuIDjjxXdoAaZ/ruD88b3oC+Zbw=",
|
||||
"path": "/nix/store/qq21z50yf6aqbccrz3qxp3alqka5ddbw-source",
|
||||
"rev": "f3929584d72e2b741e243d4439a2874011b6d994",
|
||||
"revCount": 61,
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.redalder.org/Magic_RB/NixNG"
|
||||
"id": "nixng",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
|
|
141
flake.nix
141
flake.nix
|
@ -9,11 +9,6 @@
|
|||
url = "github:hniksic/emacs-htmlize";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nixng = {
|
||||
url = "git+https://gitea.redalder.org/Magic_RB/NixNG";
|
||||
flake = true;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixng, org-thtml, emacs-htmlize, ... }@inputs:
|
||||
|
@ -21,122 +16,36 @@
|
|||
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
||||
|
||||
websiteBase = pkgs:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "magic_rb-website";
|
||||
version = "0.1";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [ pkgs.emacs ];
|
||||
|
||||
buildPhase = ''
|
||||
cp ${org-thtml}/ox-thtml.el ./ox-thtml.el
|
||||
cp ${emacs-htmlize}/htmlize.el ./htmlize.el
|
||||
mkdir tmp && export HOME=$(pwd)/tmp
|
||||
emacs --script ./make.el
|
||||
|
||||
find public_html -name 'sitemap.*' -exec rm {} \;
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r public_html/* $out
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
website = forAllSystems (system:
|
||||
|
||||
website = pkgs:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "magic_rb-website";
|
||||
version = "0.1";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [ pkgs.emacs ];
|
||||
|
||||
buildPhase = ''
|
||||
cp ${org-thtml}/ox-thtml.el ./ox-thtml.el
|
||||
cp ${emacs-htmlize}/htmlize.el ./htmlize.el
|
||||
mkdir tmp && export HOME=$(pwd)/tmp
|
||||
emacs --script ./make.el
|
||||
|
||||
find public_html -name 'sitemap.*' -exec rm {} \;
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r public_html/* $out
|
||||
'';
|
||||
};
|
||||
|
||||
defaultPackage = forAllSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
websiteBase pkgs
|
||||
self.website pkgs
|
||||
);
|
||||
|
||||
websiteImage = (nixng.lib "x86_64-linux").makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "website";
|
||||
config = ({ pkgs, options, ... }: {
|
||||
runit = {
|
||||
enable = true;
|
||||
isContainer = true;
|
||||
};
|
||||
init.services.apache2 = {
|
||||
ensureSomething.link."documentRoot" = {
|
||||
src = "${websiteBase pkgs}";
|
||||
dst = "/var/www";
|
||||
};
|
||||
};
|
||||
users.users."www-data" = {
|
||||
uid = 1001;
|
||||
group = "www-data";
|
||||
};
|
||||
users.groups."www-data" = {
|
||||
gid = 1001;
|
||||
};
|
||||
services.apache2 = {
|
||||
enable = true;
|
||||
configuration = [
|
||||
{
|
||||
LoadModule = [
|
||||
[ "mpm_event_module" "modules/mod_mpm_event.so" ]
|
||||
[ "log_config_module" "modules/mod_log_config.so" ]
|
||||
[ "unixd_module" "modules/mod_unixd.so" ]
|
||||
[ "authz_core_module" "modules/mod_authz_core.so" ]
|
||||
[ "dir_module" "modules/mod_dir.so" ]
|
||||
[ "mime_module" "modules/mod_mime.so" ]
|
||||
];
|
||||
}
|
||||
{
|
||||
Listen = "0.0.0.0:80";
|
||||
|
||||
ServerRoot = "/var/www";
|
||||
ServerName = "blowhole";
|
||||
PidFile = "/httpd.pid";
|
||||
|
||||
User = "www-data";
|
||||
Group = "www-data";
|
||||
|
||||
DocumentRoot = "/var/www";
|
||||
}
|
||||
|
||||
{
|
||||
ErrorLog = "/dev/stderr";
|
||||
TransferLog = "/dev/stdout";
|
||||
|
||||
LogLevel = "info";
|
||||
}
|
||||
|
||||
{
|
||||
AddType = [
|
||||
[ "image/svg+xml" "svg" "svgz" ]
|
||||
];
|
||||
AddEncoding = [ "gzip" "svgz" ];
|
||||
|
||||
TypesConfig = "${pkgs.apacheHttpd}/conf/mime.types";
|
||||
}
|
||||
|
||||
{
|
||||
Directory = {
|
||||
"/" = {
|
||||
Require = [ "all" "denied" ];
|
||||
Options = "SymlinksIfOwnerMatch";
|
||||
};
|
||||
};
|
||||
|
||||
VirtualHost = {
|
||||
"*:80" = {
|
||||
Directory = {
|
||||
"/var/www" = {
|
||||
Require = [ "all" "granted" ];
|
||||
Options = [ "-Indexes" "+FollowSymlinks" ];
|
||||
DirectoryIndex = "index.html";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue