at master 1.4 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8let 9 cfg = config.programs.nautilus-open-any-terminal; 10in 11{ 12 options.programs.nautilus-open-any-terminal = { 13 enable = lib.mkEnableOption "nautilus-open-any-terminal"; 14 15 terminal = lib.mkOption { 16 type = with lib.types; nullOr str; 17 default = null; 18 description = '' 19 The terminal emulator to add to context-entry of nautilus. Supported terminal 20 emulators are listed in <https://github.com/Stunkymonkey/nautilus-open-any-terminal#supported-terminal-emulators>. 21 ''; 22 }; 23 }; 24 25 config = lib.mkIf cfg.enable { 26 environment.systemPackages = with pkgs; [ 27 nautilus-python 28 nautilus-open-any-terminal 29 ]; 30 31 environment.sessionVariables = lib.mkIf (!config.services.desktopManager.gnome.enable) { 32 NAUTILUS_4_EXTENSION_DIR = "${pkgs.nautilus-python}/lib/nautilus/extensions-4"; 33 }; 34 35 environment.pathsToLink = [ 36 "/share/nautilus-python/extensions" 37 ]; 38 39 programs.dconf = lib.optionalAttrs (cfg.terminal != null) { 40 enable = true; 41 profiles.user.databases = [ 42 { 43 settings."com/github/stunkymonkey/nautilus-open-any-terminal".terminal = cfg.terminal; 44 lockAll = true; 45 } 46 ]; 47 }; 48 }; 49 meta = { 50 maintainers = with lib.maintainers; [ 51 stunkymonkey 52 linsui 53 ]; 54 }; 55}