From d67e47ae4bc74c7682296df2907414e49f67c918 Mon Sep 17 00:00:00 2001 From: Tasia Iso Date: Thu, 20 Feb 2025 10:27:18 +0100 Subject: [PATCH] nix(module): module boilerplate --- flake.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/flake.nix b/flake.nix index ea046b7d..6f19b53f 100644 --- a/flake.nix +++ b/flake.nix @@ -35,5 +35,27 @@ graphviz ]; }; + + nixosModules.default = { + config, + lib, + ... + }: let + # Shorter name to access final settings a + # user of hello.nix module HAS ACTUALLY SET. + # cfg is a typical convention. + cfg = config.services.tildefriends; + in { + options.services.tildefriends = { + enable = lib.mkEnableOption "Enable Tilde Friends"; + }; + + config = lib.mkIf cfg.enable { + systemd.services.tildefriends = { + wantedBy = ["multi-user.target"]; + serviceConfig.ExecStart = "${pkgs.tildefriends}/bin/tildefriends"; + }; + }; + }; }); }