aphorme: add module
This commit is contained in:
parent
41cae63118
commit
9ccc5b1ef4
4 changed files with 96 additions and 0 deletions
58
modules/programs/aphorme.nix
Normal file
58
modules/programs/aphorme.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkIf
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
;
|
||||
|
||||
cfg = config.programs.aphorme;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
|
||||
options.programs.aphorme = {
|
||||
enable = mkEnableOption "aphorme";
|
||||
package = mkPackageOption pkgs "aphorme" { nullable = true; };
|
||||
settings = mkOption {
|
||||
inherit (tomlFormat) type;
|
||||
default = { };
|
||||
example = {
|
||||
gui_cfg = {
|
||||
icon = true;
|
||||
ui_framework = "EGUI";
|
||||
font_size = 12;
|
||||
window_size = [
|
||||
300
|
||||
300
|
||||
];
|
||||
};
|
||||
|
||||
app_cfg = {
|
||||
paths = [ "$HOME/Desktop" ];
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Configuration settings for aphorme. All the available options can be found here:
|
||||
<https://github.com/Iaphetes/aphorme_launcher?tab=readme-ov-file#configuration>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.aphorme" pkgs lib.platforms.linux)
|
||||
];
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
home.file.".config/aphorme/config.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "aphorme-config.toml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
8
tests/modules/programs/aphorme/config.toml
Normal file
8
tests/modules/programs/aphorme/config.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[app_cfg]
|
||||
paths = ["$HOME/Desktop"]
|
||||
|
||||
[gui_cfg]
|
||||
font_size = 12
|
||||
icon = true
|
||||
ui_framework = "EGUI"
|
||||
window_size = [300, 300]
|
||||
5
tests/modules/programs/aphorme/default.nix
Normal file
5
tests/modules/programs/aphorme/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
aphorme-settings = ./settings.nix;
|
||||
}
|
||||
25
tests/modules/programs/aphorme/settings.nix
Normal file
25
tests/modules/programs/aphorme/settings.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
programs.aphorme = {
|
||||
enable = true;
|
||||
settings = {
|
||||
gui_cfg = {
|
||||
icon = true;
|
||||
ui_framework = "EGUI";
|
||||
font_size = 12;
|
||||
window_size = [
|
||||
300
|
||||
300
|
||||
];
|
||||
};
|
||||
app_cfg = {
|
||||
paths = [ "$HOME/Desktop" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/aphorme/config.toml
|
||||
assertFileContent home-files/.config/aphorme/config.toml \
|
||||
${./config.toml}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue