From 5e9558d92f285c86934e0f2afaae6a080d28f541 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Sat, 2 May 2020 06:55:36 +0100 Subject: [PATCH] post(nixos): add `nix.gc` and update config style --- source/_posts/caddy-nixos-part-2.md | 18 +++++++++++++++++- source/_posts/i2p-eepsite-nixos.md | 20 +++++++++++--------- source/_posts/tor-hidden-onion-nixos.md | 20 +++++++++++--------- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/source/_posts/caddy-nixos-part-2.md b/source/_posts/caddy-nixos-part-2.md index 9761c98..0e9b224 100644 --- a/source/_posts/caddy-nixos-part-2.md +++ b/source/_posts/caddy-nixos-part-2.md @@ -225,11 +225,14 @@ Unattended upgrade can be enabled through the following config. Once enabled, Ni In the config, you can also specify the time that the server will reboot. I recommend to only enable it after everything is up and running, especially when setting a web server; you wouldn't want the server to reboot itself in the middle of your tinkering. +(For more advanced usage of `dates`, see [`systemd.time`](https://jlk.fjfi.cvut.cz/arch/manpages/man/systemd.time.7#CALENDAR_EVENTS)) + ``` js system.autoUpgrade = { enable = true; allowReboot = true; - dates = "00:00"; + # Daily 00:00 + dates = "daily UTC"; }; ``` @@ -306,3 +309,16 @@ Kernel compiled with additional security-oriented patch set. [More details](http ``` boot.kernelPackages = pkgs.linuxPackages_hardened; ``` + +## Remove old, unreferenced packages + +Since my web server has limited disk space, it needs to run [garbage collector](https://nixos.org/nixos/manual/index.html#sec-nix-gc) from time to time. + +``` + ## Garbage collector + nix.gc = { + automatic = true; + # Every Monday 00:00 + dates = "weekly UTC"; + }; +``` diff --git a/source/_posts/i2p-eepsite-nixos.md b/source/_posts/i2p-eepsite-nixos.md index 325ec5c..85acc88 100644 --- a/source/_posts/i2p-eepsite-nixos.md +++ b/source/_posts/i2p-eepsite-nixos.md @@ -40,15 +40,17 @@ To join the I2P network, I'm using [i2pd](https://i2pd.website/), an (unofficial enable = true; ifname = "ens3"; address = "xxxx"; - inTunnels.myEep = { - enable = true; - keys = "myEep-keys.dat"; - inPort = 80; - address = "::1"; - destination = "::1"; - port = 8081; - # inbound.length = 1; - # outbound.length = 1; + inTunnels = { + myEep = { + enable = true; + keys = "myEep-keys.dat"; + inPort = 80; + address = "::1"; + destination = "::1"; + port = 8081; + # inbound.length = 1; + # outbound.length = 1; + }; }; enableIPv4 = false; enableIPv6 = true; diff --git a/source/_posts/tor-hidden-onion-nixos.md b/source/_posts/tor-hidden-onion-nixos.md index 1141d49..edb7c99 100644 --- a/source/_posts/tor-hidden-onion-nixos.md +++ b/source/_posts/tor-hidden-onion-nixos.md @@ -37,15 +37,17 @@ The first step is to bring up a Tor hidden service to get an onion address. Add services.tor = { enable = true; enableGeoIP = false; - hiddenServices.myOnion = { - version = 3; - map = [ - { - port = "80"; - toHost = "[::1]"; - toPort = "8080"; - } - ]; + hiddenServices = { + myOnion = { + version = 3; + map = [ + { + port = "80"; + toHost = "[::1]"; + toPort = "8080"; + } + ]; + }; }; extraConfig = ''