From fadff728c49669c956cce9219f473b347f7308eb Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Wed, 16 Mar 2022 12:03:06 -0400 Subject: [PATCH] Test module --- modules/default.nix | 5 +++++ modules/hello.nix | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 modules/default.nix create mode 100644 modules/hello.nix diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..06e1ccc --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./hello.nix + ]; +} diff --git a/modules/hello.nix b/modules/hello.nix new file mode 100644 index 0000000..ed09a0a --- /dev/null +++ b/modules/hello.nix @@ -0,0 +1,23 @@ +{ lib, pkgs, config, ...}: + +with lib; +let + cfg = config.services.hello; + +in { + options.services.hello = { + enable = mkEnableOption "Hello service."; + greeter = mkOption { + type = types.str; + default = "world"; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ + (pkgs.writeShellScriptBin "hello" '' + echo "'Hello, ${escapeShellArg cfg.greeter}!'" + ''); + ]; + }; +}