fork/home-manager
git clone https://git.julia.blue/fork/home-manager
f092a922
master
1{ lib , pkgs , config , ...} : 2let 3cfg = config . programs . rio ; 4 5settingsFormat = pkgs . formats . toml { }; 6 7inherit ( pkgs . stdenv . hostPlatform ) isDarwin ; 8in { 9options . programs . rio = { 10enable = lib . mkEnableOption null // { 11description = lib . mdDoc '' 12Enable Rio, a terminal built to run everywhere, as a native desktop applications by 13Rust/WebGPU or even in the browsers powered by WebAssembly/WebGPU. 14'' ; 15}; 16 17package = lib . mkPackageOption pkgs "rio" { }; 18 19settings = lib . mkOption { 20type = settingsFormat . type ; 21default = { }; 22description = '' 23Configuration written to <filename>$XDG_CONFIG_HOME/rio/config.toml</filename> on Linux or 24<filename>$HOME/Library/Application Support/rio/config.toml</filename> on Darwin. See 25<link xlink:href="https://raphamorim.io/rio/docs/#configuration-file"/> for options. 26'' ; 27}; 28}; 29meta . maintainers = [ lib . maintainers . otavio ]; 30 31config = lib . mkIf cfg . enable ( lib . mkMerge [ 32{ 33home . packages = [ cfg . package ]; 34} 35 36# Only manage configuration if not empty 37( lib . mkIf ( cfg . settings != { } && ! isDarwin ) { 38xdg . configFile . "rio/config.toml" . source = if lib . isPath cfg . settings then 39cfg . settings 40else 41settingsFormat . generate "rio.toml" cfg . settings ; 42}) 43 44( lib . mkIf ( cfg . settings != { } && isDarwin ) { 45home . file . "Library/Application Support/rio/config.toml" . source = 46if lib . isPath cfg . settings then 47cfg . settings 48else 49settingsFormat . generate "rio.toml" cfg . settings ; 50}) 51]); 52}