mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-18 14:28:15 +00:00
Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.programs.imv;
|
|
|
|
toConfig = attrs:
|
|
''
|
|
# Generated by Home Manager.
|
|
'' + generators.toINI { } attrs;
|
|
in {
|
|
meta.maintainers = [ maintainers.christoph-heiss ];
|
|
|
|
options.programs.imv = {
|
|
enable = mkEnableOption
|
|
"imv: a command line image viewer intended for use with tiling window managers";
|
|
|
|
package = mkPackageOption pkgs "imv" { nullable = true; };
|
|
|
|
settings = mkOption {
|
|
default = { };
|
|
type = with types; attrsOf (attrsOf (oneOf [ bool int str ]));
|
|
description = ''
|
|
Configuration options for imv. See
|
|
{manpage}`imv(5)`.
|
|
'';
|
|
example = literalExpression ''
|
|
{
|
|
options.background = "ffffff";
|
|
aliases.x = "close";
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions =
|
|
[ (hm.assertions.assertPlatform "programs.imv" pkgs platforms.linux) ];
|
|
|
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile =
|
|
mkIf (cfg.settings != { }) { "imv/config".text = toConfig cfg.settings; };
|
|
};
|
|
}
|