aperture: add module
This commit is contained in:
parent
85c83f7096
commit
9ab59a43cc
4 changed files with 74 additions and 0 deletions
48
modules/programs/aperture.nix
Normal file
48
modules/programs/aperture.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.aperture;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
|
||||
options.programs.aperture = {
|
||||
enable = mkEnableOption "aperture";
|
||||
package = mkPackageOption pkgs "aperture" { nullable = true; };
|
||||
settings = mkOption {
|
||||
inherit (yamlFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
listenaddr = "localhost:8081";
|
||||
staticroot = "./static";
|
||||
servestatic = false;
|
||||
debuglevel = "debug";
|
||||
autocert = false;
|
||||
servername = "aperture.example.com";
|
||||
};
|
||||
description = ''
|
||||
Configuration settings for aperture. All the available options can be found here:
|
||||
<https://github.com/lightninglabs/aperture/blob/master/sample-conf.yaml>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file.".aperture/aperture.yaml" = mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "aperture.yaml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
6
tests/modules/programs/aperture/aperture.yaml
Normal file
6
tests/modules/programs/aperture/aperture.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
autocert: false
|
||||
debuglevel: debug
|
||||
listenaddr: localhost:8081
|
||||
servername: aperture.example.com
|
||||
servestatic: false
|
||||
staticroot: ./static
|
||||
1
tests/modules/programs/aperture/default.nix
Normal file
1
tests/modules/programs/aperture/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ aperture-settings = ./settings.nix; }
|
||||
19
tests/modules/programs/aperture/settings.nix
Normal file
19
tests/modules/programs/aperture/settings.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
programs.aperture = {
|
||||
enable = true;
|
||||
settings = {
|
||||
listenaddr = "localhost:8081";
|
||||
staticroot = "./static";
|
||||
servestatic = false;
|
||||
debuglevel = "debug";
|
||||
autocert = false;
|
||||
servername = "aperture.example.com";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.aperture/aperture.yaml
|
||||
assertFileContent home-files/.aperture/aperture.yaml \
|
||||
${./aperture.yaml}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue