Compare commits
3 commits
51d41e19d0
...
ec29b3c156
Author | SHA1 | Date | |
---|---|---|---|
ec29b3c156 | |||
ab98af5e83 | |||
091b653c9a |
332
flake.lock
332
flake.lock
|
@ -143,6 +143,29 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dream2nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"nixpkgs"
|
||||
],
|
||||
"purescript-overlay": "purescript-overlay",
|
||||
"pyproject-nix": "pyproject-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714329124,
|
||||
"narHash": "sha256-WD0cmUjWc691xABl6Oc8MH7tdCdE9s34GjFgwZWEqLM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "9e457e1fbdc5f3224cf6875b42205a71313a722d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"eww": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
|
@ -200,6 +223,22 @@
|
|||
}
|
||||
},
|
||||
"flake-compat_3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_4": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1641205782,
|
||||
|
@ -265,14 +304,17 @@
|
|||
},
|
||||
"flake-utils_4": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
"systems": [
|
||||
"ngipkgs",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -281,6 +323,46 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_5": {
|
||||
"inputs": {
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"grasp": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
|
@ -381,12 +463,38 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ngipkgs": {
|
||||
"inputs": {
|
||||
"dream2nix": "dream2nix",
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-stable": "nixpkgs-stable",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"sops-nix": "sops-nix",
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715912428,
|
||||
"narHash": "sha256-LjCcGL7hTCu84mJwB9X1oS0tQ/IdBDpd8NvVJxSRrI0=",
|
||||
"owner": "Chickensoupwithrice",
|
||||
"repo": "ngipkgs",
|
||||
"rev": "86b3c17c35f1d23e3c82245ce79ceed262dcba9f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Chickensoupwithrice",
|
||||
"ref": "aynish/atomic-server-module",
|
||||
"repo": "ngipkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-matrix-appservices": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-compat": "flake-compat_3",
|
||||
"flake-compat": "flake-compat_4",
|
||||
"nixlib": "nixlib",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683490239,
|
||||
|
@ -434,6 +542,38 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714245158,
|
||||
"narHash": "sha256-9P2M0+tf1TE7Z5PwDVwhheuD2mFf6/phPr0Jvl7cxcc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2b1f64b358f2cab62617f26b3870fd0ee375d848",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1714272655,
|
||||
"narHash": "sha256-3/ghIWCve93ngkx5eNPdHIKJP/pMzSr5Wc4rNKE1wOc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "12430e43bd9b81a6b4e79e64f87c624ade701eaf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1662099760,
|
||||
"narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=",
|
||||
|
@ -449,7 +589,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1710420202,
|
||||
"narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=",
|
||||
|
@ -501,6 +641,77 @@
|
|||
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_3",
|
||||
"flake-utils": [
|
||||
"ngipkgs",
|
||||
"flake-utils"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"ngipkgs",
|
||||
"nixpkgs-stable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713954846,
|
||||
"narHash": "sha256-RWFafuSb5nkWGu8dDbW7gVb8FOQOPqmX/9MlxUUDguw=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "6fb82e44254d6a0ece014ec423cb62d92435336f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"purescript-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"dream2nix",
|
||||
"nixpkgs"
|
||||
],
|
||||
"slimlock": "slimlock"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1696022621,
|
||||
"narHash": "sha256-eMjFmsj2G1E0Q5XiibUNgFjTiSz0GxIeSSzzVdoN730=",
|
||||
"owner": "thomashoneyman",
|
||||
"repo": "purescript-overlay",
|
||||
"rev": "047c7933abd6da8aa239904422e22d190ce55ead",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "thomashoneyman",
|
||||
"repo": "purescript-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pyproject-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1702448246,
|
||||
"narHash": "sha256-hFg5s/hoJFv7tDpiGvEvXP0UfFvFEDgTdyHIjDVHu1I=",
|
||||
"owner": "davhau",
|
||||
"repo": "pyproject.nix",
|
||||
"rev": "5a06a2697b228c04dd2f35659b4b659ca74f7aeb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "davhau",
|
||||
"ref": "dream2nix",
|
||||
"repo": "pyproject.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
|
@ -512,12 +723,13 @@
|
|||
"hardware": "hardware",
|
||||
"home-manager": "home-manager_2",
|
||||
"llamacpp": "llamacpp",
|
||||
"ngipkgs": "ngipkgs",
|
||||
"nix-matrix-appservices": "nix-matrix-appservices",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nur": "nur",
|
||||
"poonam": "poonam",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"rust-overlay": "rust-overlay_2",
|
||||
"tidalcycles": "tidalcycles",
|
||||
"unstable": "unstable",
|
||||
"vimwikicli": "vimwikicli"
|
||||
|
@ -525,17 +737,21 @@
|
|||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
"flake-utils": [
|
||||
"ngipkgs",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1691201768,
|
||||
"narHash": "sha256-h+QJMpawZoK1+8efF6UjQoY1EHZfHteXVa5OYnlqRWA=",
|
||||
"lastModified": 1714270637,
|
||||
"narHash": "sha256-sq/0YEupY9yoRpg9ft8r2sjoRo84MQipionTuk4w1YI=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "18ee2a71de24273e4ad4503b5604532f0b53f382",
|
||||
"rev": "44f8738f4b9805f7c60118c48f85da835839311a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -544,6 +760,75 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715912155,
|
||||
"narHash": "sha256-UXHk4dKvvm5mSuDDON3lXU5CHKiTRnIjA5mUtDOtKEU=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "d3a96b08a7280a5753246129b462eed3662815d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"slimlock": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"dream2nix",
|
||||
"purescript-overlay",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1688610262,
|
||||
"narHash": "sha256-Wg0ViDotFWGWqKIQzyYCgayeH8s4U1OZcTiWTQYdAp4=",
|
||||
"owner": "thomashoneyman",
|
||||
"repo": "slimlock",
|
||||
"rev": "b5c6cdcaf636ebbebd0a1f32520929394493f1a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "thomashoneyman",
|
||||
"repo": "slimlock",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"ngipkgs",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"ngipkgs",
|
||||
"nixpkgs-stable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713892811,
|
||||
"narHash": "sha256-uIGmA2xq41vVFETCF1WW4fFWFT2tqBln+aXnWrvjGRE=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "f1b0adc27265274e3b0c9b872a8f476a098679bd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"superdirt-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -592,6 +877,21 @@
|
|||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
|
@ -651,11 +951,11 @@
|
|||
},
|
||||
"unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1704194953,
|
||||
"narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=",
|
||||
"lastModified": 1712163089,
|
||||
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
18
hosts/profiles/ghost/default.nix
Normal file
18
hosts/profiles/ghost/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{pkgs, ... }:
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
};
|
||||
|
||||
# Enables MySQL
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
};
|
||||
|
||||
services."write.sealight.xyz".enable = true;
|
||||
}
|
148
modules/nixos/ghost.nix
Normal file
148
modules/nixos/ghost.nix
Normal file
|
@ -0,0 +1,148 @@
|
|||
{ options, lib, config, pkgs, ... }:
|
||||
let
|
||||
# domain for the Ghost blog
|
||||
serverName = "write.sealight.xyz";
|
||||
# port on which the Ghost service runs
|
||||
port = 1357;
|
||||
# user used to run the Ghost service
|
||||
userName = builtins.replaceStrings [ "." ] [ "_" ] serverName;
|
||||
# MySQL database used by Ghost
|
||||
dbName = userName;
|
||||
# MySQL user used by Ghost
|
||||
dbUser = userName;
|
||||
# directory used to save the blog content
|
||||
dataDir = "/var/lib/${userName}";
|
||||
# Ghost package we created in the section above
|
||||
ghost = import ./ghost { inherit pkgs; };
|
||||
# script that sets up the Ghost content directory
|
||||
setupScript = pkgs.writeScript "${serverName}-setup.sh" ''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
chmod g+s "${dataDir}"
|
||||
[[ ! -d "${dataDir}/content" ]] && cp -r "${ghost}/content" "${dataDir}/content"
|
||||
chown -R "${userName}":"${userName}" "${dataDir}/content"
|
||||
chmod -R +w "${dataDir}/content"
|
||||
ln -f -s "/etc/${serverName}.json" "${dataDir}/config.production.json"
|
||||
[[ -d "${dataDir}/current" ]] && rm "${dataDir}/current"
|
||||
ln -f -s "${ghost}/current" "${dataDir}/current"
|
||||
[[ -d "${dataDir}/content/themes/casper" ]] && rm "${dataDir}/content/themes/casper"
|
||||
ln -f -s "${ghost}/current/content/themes/casper" "${dataDir}/content/themes/casper"
|
||||
'';
|
||||
|
||||
databaseService = "mysql.service";
|
||||
|
||||
serviceConfig = config.services."${serverName}";
|
||||
options = { enable = lib.mkEnableOption "${serverName} service"; };
|
||||
in {
|
||||
options.services.${serverName} = options;
|
||||
config = lib.mkIf serviceConfig.enable {
|
||||
# Creates the user and group
|
||||
users.users.${userName} = {
|
||||
isSystemUser = true;
|
||||
group = userName;
|
||||
createHome = true;
|
||||
home = dataDir;
|
||||
};
|
||||
users.groups.${userName} = { };
|
||||
|
||||
# Creates the Ghost config
|
||||
environment.etc."${serverName}.json".text = ''
|
||||
{
|
||||
"url": "https://${serverName}",
|
||||
"server": {
|
||||
"port": ${port},
|
||||
"host": "0.0.0.0"
|
||||
},
|
||||
"database": {
|
||||
"client": "mysql",
|
||||
"connection": {
|
||||
"host": "localhost",
|
||||
"user": "${dbUser}",
|
||||
"database": "${dbName}",
|
||||
"password": "",
|
||||
"socketPath": "/run/mysqld/mysqld.sock"
|
||||
}
|
||||
},
|
||||
"mail": {
|
||||
"transport": "sendmail"
|
||||
},
|
||||
"logging": {
|
||||
"transports": ["stdout"]
|
||||
},
|
||||
"paths": {
|
||||
"contentPath": "${dataDir}/content"
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
# Sets up the Systemd service
|
||||
systemd.services."${serverName}" = {
|
||||
enable = true;
|
||||
description = "${serverName} ghost blog";
|
||||
restartIfChanged = true;
|
||||
restartTriggers =
|
||||
[ ghost config.environment.etc."${serverName}.json".source ];
|
||||
requires = [ databaseService ];
|
||||
after = [ databaseService ];
|
||||
path = [ pkgs.nodejs pkgs.vips ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
User = userName;
|
||||
Group = userName;
|
||||
WorkingDirectory = dataDir;
|
||||
# Executes the setup script before start
|
||||
ExecStartPre = setupScript;
|
||||
# Runs Ghost with node
|
||||
ExecStart = "${pkgs.nodejs}/bin/node current/index.js";
|
||||
# Sandboxes the Systemd service
|
||||
AmbientCapabilities = [ ];
|
||||
CapabilityBoundingSet = [ ];
|
||||
KeyringMode = "private";
|
||||
LockPersonality = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateTmp = true;
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHome = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectSystem = "full";
|
||||
RemoveIPC = true;
|
||||
RestrictAddressFamilies = [ ];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
};
|
||||
environment = { NODE_ENV = "production"; };
|
||||
};
|
||||
|
||||
# Sets up the blog virtual host on NGINX
|
||||
services.nginx.virtualHosts.${serverName} = {
|
||||
# Sets up Lets Encrypt SSL certificates for the blog
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; };
|
||||
extraConfig = ''
|
||||
charset UTF-8;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=2592000; includeSubDomains" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
'';
|
||||
};
|
||||
|
||||
# Sets up MySQL database and user for Ghost
|
||||
services.mysql = {
|
||||
ensureDatabases = [ dbName ];
|
||||
ensureUsers = [{
|
||||
name = dbUser;
|
||||
ensurePermissions = { "${dbName}.*" = "ALL PRIVILEGES"; };
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
9
pkgs/ghost/builder.sh
Normal file
9
pkgs/ghost/builder.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
source "$stdenv"/setup
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
npm install --loglevel=info --logs-max=0 "ghost-cli@$ghostCliVersion"
|
||||
|
||||
mkdir --parents "$out"/
|
||||
node_modules/ghost-cli/bin/ghost install "$version" --db=sqlite3 \
|
||||
--no-enable --no-prompt --no-stack --no-setup --no-start --dir "$out"
|
||||
|
11
pkgs/ghost/default.nix
Normal file
11
pkgs/ghost/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs }:
|
||||
|
||||
let
|
||||
pname = "ghost";
|
||||
version = "5.8.0";
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
buildInputs = with pkgs; [ nodejs yarn vips ];
|
||||
ghostCliVersion = "1.21.1";
|
||||
builder = ./builder.sh;
|
||||
}
|
Loading…
Reference in a new issue