summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..8e634bf
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,43 @@
+let
+ utils = (import ./nix) {};
+ pkgs = utils.pkgs;
+ system = utils.system;
+in
+ rec {
+ srv = (import ./srv).build;
+ static = (import ./static).build;
+ config = (import ./config.nix);
+
+ service = pkgs.writeText "mediocregopher-mediocre-blog" ''
+ [Unit]
+ Description=mediocregopher mediocre blog
+ Requires=network.target
+ After=network.target
+
+ [Service]
+ Restart=always
+ RestartSec=1s
+ User=mediocregopher
+ ExecStart=${srv}/bin/mediocre-blog \
+ -pow-secret "${config.powSecret}" \
+ -ml-smtp-addr "${config.mlSMTPAddr}" \
+ -ml-smtp-auth "${config.mlSMTPAuth}" \
+ -data-dir "${config.dataDir}" \
+ -public-url "${config.publicURL}" \
+ -static-dir "${static}" \
+ -listen-proto "${config.listenProto}" \
+ -listen-addr "${config.listenAddr}"
+
+ [Install]
+ WantedBy=multi-user.target
+ '';
+
+ install = pkgs.writeScript "mediocregopher-mediocre-blog" ''
+ set -e -x
+
+ sudo cp ${service} /etc/systemd/system/mediocregopher-mediocre-blog.service
+ sudo systemctl daemon-reload
+ sudo systemctl enable mediocregopher-mediocre-blog.service
+ sudo systemctl restart mediocregopher-mediocre-blog.service
+ '';
+ }