Last active
June 26, 2018 04:48
-
-
Save ElvishJerricco/fedfd0df1e0e7e191013af691fba7876 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ ... }: { | |
imports = [./myservice.nix]; | |
services.example-hserv.enable = true; | |
# Normal configuration.nix stuff here... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
{ | |
# Typically, your module only *sets* options. | |
# By specifying an `options` field, we are telling it we'd like to make our own options. | |
options = { | |
services.example-hserv.enable = lib.mkOption { | |
description = "Serve the valgrind docs with hserve"; | |
type = lib.types.bool; | |
default = false; | |
}; | |
}; | |
# Since we specified `options`, our typical configuration options must now be nested under `config`. | |
config = { | |
# `config` refers to the final values of all configuration. | |
# We can refer to the option that we declared above to get the user's definition. | |
# We use `mkIf` to only do this configuration when that value is `true`. | |
systemd.services.example-hserv = lib.mkIf config.services.example-hserv.enable { | |
description = "Example hserv service"; | |
path = [pkgs.haskellPackages.hserv]; | |
script = '' | |
(cd ${pkgs.valgrind.doc}/share/doc/valgrind/html && hserv) | |
''; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment