mirror of
https://codeberg.org/muon/home.git
synced 2026-03-08 03:25:16 +00:00
Add embedded syntax hl
This commit is contained in:
parent
5bdf9e3a2c
commit
fc14a394aa
5 changed files with 284 additions and 250 deletions
|
|
@ -25,7 +25,7 @@ sudo cp {/mnt,/mnt/persist}/etc/machine-id
|
|||
## Erasure
|
||||
|
||||
```nix
|
||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||
boot.initrd.postResumeCommands = lib.mkAfter /* bash */ ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/mapper/crypted /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
programs.nyxt = {
|
||||
enable = false;
|
||||
config = ''
|
||||
config =
|
||||
# lisp
|
||||
''
|
||||
(in-package #:nyxt-user)
|
||||
|
||||
(defvar *my-search-engines*
|
||||
|
|
@ -73,7 +75,9 @@
|
|||
hm = "https://home-manager-options.extranix.com/?release=master&query={}";
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
extraConfig =
|
||||
# py
|
||||
''
|
||||
host = c.content.blocking.hosts.lists.append
|
||||
host("https://www.github.developerdan.com/hosts/lists/facebook-extended.txt")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options.mods.impermanence.enable = mkEnableOption "enables impermanence";
|
||||
|
||||
config = mkIf config.mods.impermanence.enable {
|
||||
environment.persistence."/persist" = {
|
||||
directories = [ "/var/lib/nixos" "/var/lib/systemd/coredump" ];
|
||||
files = [ "/var/lib/sops-nix/key.txt" "/etc/machine-id" ];
|
||||
directories = ["/var/lib/nixos" "/var/lib/systemd/coredump"];
|
||||
files = ["/var/lib/sops-nix/key.txt" "/etc/machine-id"];
|
||||
};
|
||||
|
||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||
boot.initrd.postResumeCommands =
|
||||
lib.mkAfter # sh
|
||||
|
||||
''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/mapper/crypted /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
|
|
|
|||
|
|
@ -1,10 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
inherit (lib)
|
||||
generators mapAttrs mkDefault mkEnableOption mkIf mkPackageOption mkOption
|
||||
types;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
generators
|
||||
mapAttrs
|
||||
mkDefault
|
||||
mkEnableOption
|
||||
mkIf
|
||||
mkPackageOption
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.mods.services.grav;
|
||||
|
||||
|
|
@ -12,9 +22,9 @@ let
|
|||
|
||||
poolName = "grav";
|
||||
|
||||
pkgs_grav = pkgs.callPackage ./package.nix { };
|
||||
pkgs_grav = pkgs.callPackage ./package.nix {};
|
||||
|
||||
servedRoot = pkgs.runCommand "grav-served-root" { } ''
|
||||
servedRoot = pkgs.runCommand "grav-served-root" {} ''
|
||||
cp --reflink=auto --no-preserve=mode -r ${pkgs_grav} $out
|
||||
|
||||
for p in assets images user system/config; do
|
||||
|
|
@ -22,10 +32,8 @@ let
|
|||
ln -sf /var/lib/grav/$p $out/$p
|
||||
done
|
||||
'';
|
||||
|
||||
# systemSettingsYaml =
|
||||
# yamlFormat.generate "grav-settings.yaml" cfg.systemSettings;
|
||||
|
||||
in {
|
||||
options.mods.services.grav = {
|
||||
enable = mkEnableOption "grav";
|
||||
|
|
@ -70,7 +78,7 @@ in {
|
|||
default = 3000;
|
||||
};
|
||||
|
||||
phpPackage = mkPackageOption pkgs "php" { };
|
||||
phpPackage = mkPackageOption pkgs "php" {};
|
||||
|
||||
maxUploadSize = mkOption {
|
||||
type = types.str;
|
||||
|
|
@ -97,7 +105,10 @@ in {
|
|||
group = "grav";
|
||||
|
||||
phpPackage = cfg.phpPackage.buildEnv {
|
||||
extensions = { all, enabled }:
|
||||
extensions = {
|
||||
all,
|
||||
enabled,
|
||||
}:
|
||||
with all; [
|
||||
apcu
|
||||
ctype
|
||||
|
|
@ -115,8 +126,9 @@ in {
|
|||
zip
|
||||
];
|
||||
|
||||
extraConfig = generators.toKeyValue {
|
||||
mkKeyValue = generators.mkKeyValueDefault { } " = ";
|
||||
extraConfig =
|
||||
generators.toKeyValue {
|
||||
mkKeyValue = generators.mkKeyValueDefault {} " = ";
|
||||
} {
|
||||
output_buffering = "0";
|
||||
short_open_tag = "Off";
|
||||
|
|
@ -169,10 +181,12 @@ in {
|
|||
${cfg.virtualHost} = {
|
||||
root = "${servedRoot}";
|
||||
|
||||
listen = [{
|
||||
listen = [
|
||||
{
|
||||
addr = cfg.addr;
|
||||
port = cfg.port;
|
||||
}];
|
||||
}
|
||||
];
|
||||
|
||||
locations = {
|
||||
"= /robots.txt" = {
|
||||
|
|
@ -202,8 +216,7 @@ in {
|
|||
};
|
||||
|
||||
# deny running scripts inside core system folders
|
||||
"~* /(system|vendor)/.*\\.(txt|xml|md|html|htm|shtml|shtm|json|yaml|yml|php|php2|php3|php4|php5|phar|phtml|pl|py|cgi|twig|sh|bat)$" =
|
||||
{
|
||||
"~* /(system|vendor)/.*\\.(txt|xml|md|html|htm|shtml|shtm|json|yaml|yml|php|php2|php3|php4|php5|phar|phtml|pl|py|cgi|twig|sh|bat)$" = {
|
||||
priority = 300;
|
||||
extraConfig = ''
|
||||
return 403;
|
||||
|
|
@ -211,8 +224,7 @@ in {
|
|||
};
|
||||
|
||||
# deny running scripts inside user folder
|
||||
"~* /user/.*\\.(txt|md|json|yaml|yml|php|php2|php3|php4|php5|phar|phtml|pl|py|cgi|twig|sh|bat)$" =
|
||||
{
|
||||
"~* /user/.*\\.(txt|md|json|yaml|yml|php|php2|php3|php4|php5|phar|phtml|pl|py|cgi|twig|sh|bat)$" = {
|
||||
priority = 300;
|
||||
extraConfig = ''
|
||||
return 403;
|
||||
|
|
@ -220,8 +232,7 @@ in {
|
|||
};
|
||||
|
||||
# deny access to specific files in the root folder
|
||||
"~ /(LICENSE\\.txt|composer\\.lock|composer\\.json|nginx\\.conf|web\\.config|htaccess\\.txt|\\.htaccess)" =
|
||||
{
|
||||
"~ /(LICENSE\\.txt|composer\\.lock|composer\\.json|nginx\\.conf|web\\.config|htaccess\\.txt|\\.htaccess)" = {
|
||||
priority = 300;
|
||||
extraConfig = ''
|
||||
return 403;
|
||||
|
|
@ -245,7 +256,9 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
extraConfig =
|
||||
# sh
|
||||
''
|
||||
index index.php index.html /index.php$request_uri;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
|
|
@ -268,8 +281,10 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = let datadir = "/var/lib/grav";
|
||||
in map (dir: "d '${dir}' 0750 grav grav - -") [
|
||||
systemd.tmpfiles.rules = let
|
||||
datadir = "/var/lib/grav";
|
||||
in
|
||||
map (dir: "d '${dir}' 0750 grav grav - -") [
|
||||
"/var/cache/grav"
|
||||
"${datadir}/assets"
|
||||
"${datadir}/backup"
|
||||
|
|
@ -287,7 +302,7 @@ in {
|
|||
systemd.services = {
|
||||
"phpfpm-${poolName}" = mkIf (cfg.pool == "${poolName}") {
|
||||
# restartTriggers = [ servedRoot systemSettingsYaml ];
|
||||
restartTriggers = [ servedRoot ];
|
||||
restartTriggers = [servedRoot];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStartPre = pkgs.writeShellScript "grav-pre-start" ''
|
||||
|
|
@ -329,6 +344,6 @@ in {
|
|||
group = "grav";
|
||||
};
|
||||
|
||||
users.groups.grav = { members = [ config.services.nginx.user ]; };
|
||||
users.groups.grav = {members = [config.services.nginx.user];};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.mods.server.nginx;
|
||||
|
||||
in with lib; {
|
||||
in
|
||||
with lib; {
|
||||
options.mods.server.nginx = {
|
||||
enable = mkEnableOption {
|
||||
default = false;
|
||||
|
|
@ -22,14 +25,14 @@ in with lib; {
|
|||
|
||||
ports = mkOption {
|
||||
type = types.attrsOf (types.ints.u16);
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# ACME won't be able to authenticate your domain
|
||||
# if ports 80 & 443 aren't open in your firewall.
|
||||
networking.firewall = { allowedTCPPorts = [ 443 80 ]; };
|
||||
networking.firewall = {allowedTCPPorts = [443 80];};
|
||||
security.acme.defaults.email = "acme@muon.host";
|
||||
security.acme.acceptTerms = true;
|
||||
|
||||
|
|
@ -44,7 +47,9 @@ in with lib; {
|
|||
# Only allow PFS-enabled ciphers with AES256
|
||||
# sslCiphers = "AES256+EECDH:AES256+EDH:!aNULL";
|
||||
|
||||
appendHttpConfig = ''
|
||||
appendHttpConfig =
|
||||
# sh
|
||||
''
|
||||
# Add HSTS header with preloading to HTTPS requests.
|
||||
# Adding this header to HTTP requests is discouraged
|
||||
# map $scheme $hsts_header {
|
||||
|
|
@ -96,10 +101,12 @@ in with lib; {
|
|||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
in mapAttrs' (name: port:
|
||||
nameValuePair ("${name}.${cfg.domain}")
|
||||
in
|
||||
mapAttrs' (name: port:
|
||||
nameValuePair "${name}.${cfg.domain}"
|
||||
# (proxy port // { default = true; })) cfg.ports;
|
||||
(proxy port)) cfg.ports;
|
||||
(proxy port))
|
||||
cfg.ports;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue