fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . foot ; 8iniFormat = pkgs . formats . ini { }; 9 10in { 11meta . maintainers = with lib . maintainers ; [ plabadens ]; 12 13options . programs . foot = { 14enable = mkEnableOption "Foot terminal" ; 15 16package = mkOption { 17type = types . package ; 18default = pkgs . foot ; 19defaultText = literalExpression "pkgs.foot" ; 20description = "The foot package to install" ; 21}; 22 23server . enable = mkEnableOption "Foot terminal server" ; 24 25settings = mkOption { 26type = iniFormat . type ; 27default = { }; 28description = '' 29Configuration written to 30{file}`$XDG_CONFIG_HOME/foot/foot.ini`. See <https://codeberg.org/dnkl/foot/src/branch/master/foot.ini> 31for a list of available options. 32'' ; 33example = literalExpression '' 34{ 35main = { 36term = "xterm-256color"; 37 38font = "Fira Code:size=11"; 39dpi-aware = "yes"; 40}; 41 42mouse = { 43hide-when-typing = "yes"; 44}; 45} 46'' ; 47}; 48}; 49 50config = mkIf cfg . enable { 51assertions = 52[ ( hm . assertions . assertPlatform "programs.foot" pkgs platforms . linux ) ]; 53 54home . packages = [ cfg . package ]; 55 56xdg . configFile . "foot/foot.ini" = mkIf ( cfg . settings != { }) { 57source = iniFormat . generate "foot.ini" cfg . settings ; 58}; 59 60systemd . user . services = mkIf cfg . server . enable { 61foot = { 62Unit = { 63Description = 64"Fast, lightweight and minimalistic Wayland terminal emulator." ; 65Documentation = "man:foot(1)" ; 66PartOf = [ "graphical-session.target" ]; 67After = [ "graphical-session.target" ]; 68}; 69 70Service = { 71ExecStart = " ${ cfg . package } /bin/foot --server" ; 72Restart = "on-failure" ; 73OOMPolicy = "continue" ; 74}; 75 76Install = { WantedBy = [ "graphical-session.target" ]; }; 77}; 78}; 79}; 80}