Browse Source

Factor out example systems

Signed-off-by: Magic_RB <magic_rb@redalder.org>
master
Magic_RB 1 month ago
parent
commit
160c62901d
Signed by: Magic_RB GPG Key ID: 08D5287CC5DDCA0E
3 changed files with 98 additions and 89 deletions
  1. +94
    -0
      examples/apache/default.nix
  2. +2
    -0
      examples/gitea/.gitignore
  3. +2
    -89
      flake.nix

+ 94
- 0
examples/apache/default.nix View File

@ -0,0 +1,94 @@
nglib:
(nglib "x86_64-linux").makeSystem {
system = "x86_64-linux";
name = "nixng-apache";
config = ({ pkgs, config, ... }:
let
ids = config.ids;
in
{
config = {
runit = {
enable = true;
isContainer = true;
};
init.services.apache2 = {
ensureSomething.link."documentRoot" = {
src = "${pkgs.apacheHttpd}/htdocs";
dst = "/var/www";
};
};
users.users."www-data" = {
uid = ids.uids.www-data;
group = "www-data";
};
users.groups."www-data" = {
gid = ids.gids.www-data;
};
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";
};
};
};
};
}
];
};
};
});
}

+ 2
- 0
examples/gitea/.gitignore View File

@ -2,3 +2,5 @@ internal_token
jwt_secret
lfs_jwt_secret
secret_key
result

+ 2
- 89
flake.nix View File

@ -62,95 +62,8 @@
});
};
dockerTest = ((self.lib "x86_64-linux").makeSystem {
system = "x86_64-linux";
name = "nixng-docker";
config = ({ pkgs, options, ... }: {
config = {
runit = {
enable = true;
isContainer = true;
};
init.services.apache2 = {
ensureSomething.link."documentRoot" = {
src = "${pkgs.apacheHttpd}/htdocs";
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";
};
};
};
};
}
];
};
};
});
});
giteaSystem = import ./examples/gitea self.lib;
apacheSystem = import ./examples/apache self.lib;
overlay = import ./overlay;
packages = nixpkgs.lib.genAttrs


Loading…
Cancel
Save