mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
amoco: add module
This commit is contained in:
parent
6c5025e2bb
commit
c6f8669f09
4 changed files with 54 additions and 0 deletions
38
modules/programs/amoco.nix
Normal file
38
modules/programs/amoco.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
types
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.amoco;
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
options.programs.amoco = {
|
||||
enable = mkEnableOption "amoco";
|
||||
package = mkPackageOption pkgs "amoco" { nullable = true; };
|
||||
config = mkOption {
|
||||
type = with types; either str path;
|
||||
default = "";
|
||||
description = ''
|
||||
Config file for amoco as a Python configuration module.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file.".config/amoco/config" = mkIf (cfg.config != "") {
|
||||
source = if lib.isPath cfg.config then cfg.config else pkgs.writeText "amoco-config" cfg.config;
|
||||
};
|
||||
};
|
||||
}
|
||||
1
tests/modules/programs/amoco/config
Normal file
1
tests/modules/programs/amoco/config
Normal file
|
|
@ -0,0 +1 @@
|
|||
print("No example config found!")
|
||||
1
tests/modules/programs/amoco/default.nix
Normal file
1
tests/modules/programs/amoco/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ amoco-settings = ./settings.nix; }
|
||||
14
tests/modules/programs/amoco/settings.nix
Normal file
14
tests/modules/programs/amoco/settings.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
programs.amoco = {
|
||||
enable = true;
|
||||
config = ''
|
||||
print("No example config found!")
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/amoco/config
|
||||
assertFileContent home-files/.config/amoco/config \
|
||||
${./config}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue