commit ebd86c6f70a2948d1b8f737253fa039ff76e6049
parent 408b0893d013fd9a0c51447a805965c5a1876801
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Thu, 15 May 2025 09:38:54 +0200
fix: remove agate module
It led to a conflict with nixpkgs 'services.agate' and I already
thought of removing it before, as hosting a Gemini server has no
longer been a necessity for a while now.
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
3 files changed, 0 insertions(+), 196 deletions(-)
diff --git a/hosts/main-server/default.nix b/hosts/main-server/default.nix
@@ -13,49 +13,6 @@ rec {
];
services = {
- agate = {
- enable = true;
- preStart = {
- scripts =
- let
- generateAtom = builtins.concatStringsSep " " [
- "${inputs.site}/scripts/generate-atom.sh"
- "/var/tmp/site/gemini"
- "\"Francesco Saccone's blog\""
- "gemini://${domain}"
- ];
- generateSitemap = builtins.concatStringsSep " " [
- "${inputs.site}/scripts/generate-sitemap.sh"
- "/var/tmp/site/gemini"
- "gemini://${domain}"
- ];
- generateGemini = builtins.concatStringsSep " " [
- "${inputs.site}/scripts/generate-gemini.sh"
- "/var/tmp/site/gemini"
- ];
- in
- [
- generateAtom
- generateSitemap
- generateGemini
- ];
- packages = [
- pkgs.coreutils
- pkgs.findutils
- pkgs.gnused
- pkgs.lowdown
- ];
- };
- symlinks = {
- "index.gmi" = "/var/tmp/site/gemini/index.gmi";
- "blog" = "/var/tmp/site/gemini/blog";
- "code" = "/var/tmp/site/gemini/code";
- "public" = "${inputs.site}/public";
- "robots.txt" = "${inputs.site}/robots.txt";
- "atom.xml" = "/var/tmp/site/gemini/atom.xml";
- "sitemap.xml" = "/var/tmp/site/gemini/sitemap.xml";
- };
- };
bind = {
enable = true;
inherit (networking) domain;
diff --git a/modules/nixos/agate/default.nix b/modules/nixos/agate/default.nix
@@ -1,152 +0,0 @@
-{
- lib,
- options,
- config,
- pkgs,
- ...
-}:
-{
-
- options.services.agate = {
- enable = lib.mkOption {
- description = "Whether to enable Agate.";
- default = false;
- type = lib.types.bool;
- };
- directory = lib.mkOption {
- description = "The root directory to statically host.";
- default = "/var/gemini";
- readOnly = true;
- type = lib.types.uniq lib.types.path;
- };
- symlinks = lib.mkOption {
- description = ''
- For each symlink name, which will be created in the root directory, its
- target.
- '';
- default = { };
- type = lib.types.attrsOf lib.types.path;
- };
- preStart = {
- scripts = lib.mkOption {
- description = ''
- The list of scripts to run before starting the server.
- '';
- default = [ ];
- type = lib.types.listOf lib.types.path;
- };
- packages = lib.mkOption {
- description = "The list of packages required by the scripts.";
- default = [ ];
- type = lib.types.listOf lib.types.package;
- };
- };
- };
-
- config = lib.mkIf config.services.agate.enable {
- users = {
- users = {
- agate = {
- hashedPassword = "!";
- isSystemUser = true;
- group = "agate";
- createHome = true;
- home = config.services.agate.directory;
- };
- };
- groups = {
- agate = { };
- };
- };
-
- systemd = {
- services = {
- agate-setup = {
- enable = true;
- wantedBy = [ "multi-user.target" ];
- serviceConfig =
- let
- clean = pkgs.writeShellScriptBin "clean" ''
- ${pkgs.sbase}/bin/rm -rf \
- ${config.services.agate.directory}/*
-
- ${pkgs.sbase}/bin/mkdir -p \
- ${config.services.agate.directory}/.certificates
- '';
- symlinks =
- config.services.agate.symlinks
- |> builtins.mapAttrs (
- name: target: ''
- ${pkgs.sbase}/bin/mkdir -p \
- ${config.services.agate.directory}/${builtins.dirOf name}
-
- ${pkgs.sbase}/bin/ln -sf ${target} \
- ${config.services.agate.directory}/${name}
- ''
- )
- |> builtins.attrValues
- |> builtins.concatStringsSep "\n"
- |> pkgs.writeShellScriptBin "symlinks";
- permissions = pkgs.writeShellScriptBin "permissions" ''
- ${pkgs.sbase}/bin/chmod -R g+rwx \
- ${config.services.agate.directory}
- '';
- in
- {
- User = "root";
- Group = "root";
- Type = "oneshot";
- ExecStart = [
- "${clean}/bin/clean"
- "${symlinks}/bin/symlinks"
- "${permissions}/bin/permissions"
- ];
- };
- };
- agate =
- let
- inherit (config.services.agate) preStart;
- in
- rec {
- enable = true;
- wantedBy = [ "multi-user.target" ];
- requires = [ "agate-setup.service" ];
- after = [ "network.target" ];
- path = preStart.packages;
- serviceConfig =
- let
- script = pkgs.writeShellScriptBin "script" ''
- ${builtins.concatStringsSep "\n" preStart.scripts}
-
- ${pkgs.agate}/bin/agate \
- --content ${config.services.agate.directory} \
- --hostname ${config.networking.domain} \
- --addr [::]:1965 \
- --addr 0.0.0.0:1965
- '';
- in
- {
- User = "root";
- Group = "root";
- Restart = "on-failure";
- Type = "simple";
- ExecStart = "${script}/bin/script";
- };
- };
- };
- paths = {
- agate = {
- enable = true;
- wantedBy = [ "multi-user.target" ];
- pathConfig = {
- PathModified = [
- config.services.agate.directory
- ] ++ builtins.attrValues config.services.agate.symlinks;
- };
- };
- };
- };
-
- networking.firewall.allowedTCPPorts = [ 1965 ];
- };
-}
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
@@ -1,7 +1,6 @@
{ ... }:
{
imports = [
- ./agate
./bind
./doas
./git