fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6cfg = config . services . avizo ; 7settingsFormat = pkgs . formats . ini { }; 8in { 9meta . maintainers = [ hm . maintainers . pltanton ]; 10 11options . services . avizo = { 12enable = mkEnableOption "avizo, a simple notification daemon" ; 13 14settings = mkOption { 15type = ( pkgs . formats . ini { }). type ; 16default = { }; 17example = literalExpression '' 18{ 19default = { 20time = 1.0; 21y-offset = 0.5; 22fade-in = 0.1; 23fade-out = 0.2; 24padding = 10; 25}; 26} 27'' ; 28description = '' 29The settings that will be written to the avizo configuration file. 30'' ; 31}; 32 33package = mkOption { 34type = types . package ; 35default = pkgs . avizo ; 36defaultText = literalExpression "pkgs.avizo" ; 37example = literalExpression '' 38pkgs.avizo.overrideAttrs (final: prev: { 39patchPhase = "cp ''${./images}/*.png data/images/"; 40}) 41'' ; 42description = "The `avizo` package to use." ; 43}; 44}; 45 46config = mkIf cfg . enable { 47assertions = 48[ ( hm . assertions . assertPlatform "services.avizo" pkgs platforms . linux ) ]; 49 50xdg . configFile . "avizo/config.ini" = mkIf ( cfg . settings != { }) { 51source = settingsFormat . generate "avizo-config.ini" cfg . settings ; 52}; 53 54home . packages = [ cfg . package ]; 55 56systemd . user = { 57services . avizo = { 58Unit = { 59Description = "Volume/backlight OSD indicator" ; 60PartOf = [ "graphical-session.target" ]; 61After = [ "graphical-session.target" ]; 62ConditionEnvironment = "WAYLAND_DISPLAY" ; 63Documentation = "man:avizo(1)" ; 64}; 65 66Service = { 67Type = "simple" ; 68ExecStart = " ${ cfg . package } /bin/avizo-service" ; 69Restart = "always" ; 70}; 71 72Install = { WantedBy = [ "graphical-session.target" ]; }; 73}; 74}; 75}; 76}