nixos-config/modules/nixos/tildefriends.nix
2024-04-17 20:39:12 +02:00

35 lines
899 B
Nix

{
lib,
pkgs,
config,
...
}:
with lib; let
# WORK IN PROGRESS
# WORK IN PROGRESS
# WORK IN PROGRESS
# Shorter name to access final settings a
# user of hello.nix module HAS ACTUALLY SET.
# cfg is a typical convention.
cfg = config.services.hello;
in {
# Declare what settings a user of this "hello.nix" module CAN SET.
options.services.hello = {
enable = mkEnableOption "hello service";
greeter = mkOption {
type = types.str;
default = "world";
};
};
# Define what other settings, services and resources should be active IF
# a user of this "hello.nix" module ENABLED this module
# by setting "services.hello.enable = true;".
config = mkIf cfg.enable {
systemd.services.hello = {
wantedBy = ["multi-user.target"];
serviceConfig.ExecStart = "${pkgs.hello}/bin/hello -g'Hello, ${escapeShellArg cfg.greeter}!'";
};
};
}