Move container to systems, simplify

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2021-05-12 12:17:30 +02:00
parent 7751dd3ccd
commit e2249619a8
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 33 additions and 125 deletions

View file

@ -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": {

105
flake.nix
View file

@ -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,7 +16,10 @@
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
websiteBase = pkgs:
in
{
website = pkgs:
pkgs.stdenv.mkDerivation {
name = "magic_rb-website";
version = "0.1";
@ -42,101 +40,12 @@
cp -r public_html/* $out
'';
};
in
{
website = forAllSystems (system:
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";
};
};
};
};
}
];
};
});
};
};
}