diff options
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/browserpass.nix | 33 | ||||
-rw-r--r-- | nixos/modules/programs/sway-beta.nix | 91 | ||||
-rw-r--r-- | nixos/modules/programs/sway.nix | 57 | ||||
-rw-r--r-- | nixos/modules/programs/waybar.nix | 20 | ||||
-rw-r--r-- | nixos/modules/programs/zsh/oh-my-zsh.xml | 6 | ||||
-rw-r--r-- | nixos/modules/programs/zsh/zsh.nix | 37 |
6 files changed, 110 insertions, 134 deletions
diff --git a/nixos/modules/programs/browserpass.nix b/nixos/modules/programs/browserpass.nix index 5f8a44a9848e..47b9d1ccb1f6 100644 --- a/nixos/modules/programs/browserpass.nix +++ b/nixos/modules/programs/browserpass.nix @@ -4,15 +4,34 @@ with lib; { - ###### interface - options = { - programs.browserpass.enable = mkEnableOption "the NativeMessaging configuration for Chromium, Chrome, and Vivaldi."; - }; + options.programs.browserpass.enable = mkEnableOption "Browserpass native messaging host"; - ###### implementation config = mkIf config.programs.browserpass.enable { - environment.systemPackages = [ pkgs.browserpass ]; - environment.etc = { + environment.etc = let + appId = "com.github.browserpass.native.json"; + source = part: "${pkgs.browserpass}/lib/browserpass/${part}/${appId}"; + in { + # chromium + "chromium/native-messaging-hosts/${appId}".source = source "hosts/chromium"; + "chromium/policies/managed/${appId}".source = source "policies/chromium"; + + # chrome + "opt/chrome/native-messaging-hosts/${appId}".source = source "hosts/chromium"; + "opt/chrome/policies/managed/${appId}".source = source "policies/chromium"; + + # vivaldi + "opt/vivaldi/native-messaging-hosts/${appId}".source = source "hosts/chromium"; + "opt/vivaldi/policies/managed/${appId}".source = source "policies/chromium"; + + # brave + "opt/brave/native-messaging-hosts/${appId}".source = source "hosts/chromium"; + "opt/brave/policies/managed/${appId}".source = source "policies/chromium"; + } + # As with the v2 backwards compatibility in the pkgs.browserpass + # declaration, this part can be removed once the browser extension + # auto-updates to v3 (planned 2019-04-13, see + # https://github.com/browserpass/browserpass-native/issues/31) + // { "chromium/native-messaging-hosts/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-host.json"; "chromium/policies/managed/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-policy.json"; "opt/chrome/native-messaging-hosts/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-host.json"; diff --git a/nixos/modules/programs/sway-beta.nix b/nixos/modules/programs/sway-beta.nix deleted file mode 100644 index 3c235de0ce63..000000000000 --- a/nixos/modules/programs/sway-beta.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let - cfg = config.programs.sway-beta; - swayPackage = cfg.package; - - swayWrapped = pkgs.writeShellScriptBin "sway" '' - set -o errexit - - if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then - export _SWAY_WRAPPER_ALREADY_EXECUTED=1 - ${cfg.extraSessionCommands} - fi - - if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then - export DBUS_SESSION_BUS_ADDRESS - exec ${swayPackage}/bin/sway "$@" - else - exec ${pkgs.dbus}/bin/dbus-run-session ${swayPackage}/bin/sway "$@" - fi - ''; - swayJoined = pkgs.symlinkJoin { - name = "sway-joined"; - paths = [ swayWrapped swayPackage ]; - }; -in { - options.programs.sway-beta = { - enable = mkEnableOption '' - Sway, the i3-compatible tiling Wayland compositor. This module will be removed after the final release of Sway 1.0 - ''; - - package = mkOption { - type = types.package; - default = pkgs.sway-beta; - defaultText = "pkgs.sway-beta"; - description = '' - The package to be used for `sway`. - ''; - }; - - extraSessionCommands = mkOption { - type = types.lines; - default = ""; - example = '' - export SDL_VIDEODRIVER=wayland - # needs qt5.qtwayland in systemPackages - export QT_QPA_PLATFORM=wayland - export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - ''; - description = '' - Shell commands executed just before Sway is started. - ''; - }; - - extraPackages = mkOption { - type = with types; listOf package; - default = with pkgs; [ - swaylock swayidle - xwayland rxvt_unicode dmenu - ]; - defaultText = literalExample '' - with pkgs; [ swaylock swayidle xwayland rxvt_unicode dmenu ]; - ''; - example = literalExample '' - with pkgs; [ - xwayland - i3status i3status-rust - termite rofi light - ] - ''; - description = '' - Extra packages to be installed system wide. - ''; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages; - security.pam.services.swaylock = {}; - hardware.opengl.enable = mkDefault true; - fonts.enableDefaultFonts = mkDefault true; - programs.dconf.enable = mkDefault true; - }; - - meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ]; -} diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix index b3847db8cd9c..457faaa3c102 100644 --- a/nixos/modules/programs/sway.nix +++ b/nixos/modules/programs/sway.nix @@ -16,9 +16,9 @@ let if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then export DBUS_SESSION_BUS_ADDRESS - exec sway-setcap "$@" + exec ${swayPackage}/bin/sway "$@" else - exec ${pkgs.dbus}/bin/dbus-run-session sway-setcap "$@" + exec ${pkgs.dbus}/bin/dbus-run-session ${swayPackage}/bin/sway "$@" fi ''; swayJoined = pkgs.symlinkJoin { @@ -28,22 +28,24 @@ let in { options.programs.sway = { enable = mkEnableOption '' - the tiling Wayland compositor Sway. After adding yourself to the "sway" - group you can manually launch Sway by executing "sway" from a terminal. - If you call "sway" with any parameters the extraSessionCommands won't be - executed and Sway won't be launched with dbus-launch''; + Sway, the i3-compatible tiling Wayland compositor. You can manually launch + Sway by executing "exec sway" on a TTY. Copy /etc/sway/config to + ~/.config/sway/config to modify the default configuration. See + https://github.com/swaywm/sway/wiki and "man 5 sway" for more information. + Please have a look at the "extraSessionCommands" example for running + programs natively under Wayland''; extraSessionCommands = mkOption { type = types.lines; default = ""; example = '' - # Define a keymap (US QWERTY is the default) - export XKB_DEFAULT_LAYOUT=de,us - export XKB_DEFAULT_VARIANT=nodeadkeys - export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,caps:escape - # Change the Keyboard repeat delay and rate - export WLC_REPEAT_DELAY=660 - export WLC_REPEAT_RATE=25 + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 ''; description = '' Shell commands executed just before Sway is started. @@ -53,14 +55,17 @@ in { extraPackages = mkOption { type = with types; listOf package; default = with pkgs; [ - i3status xwayland rxvt_unicode dmenu + swaylock swayidle + xwayland rxvt_unicode dmenu ]; defaultText = literalExample '' - with pkgs; [ i3status xwayland rxvt_unicode dmenu ]; + with pkgs; [ swaylock swayidle xwayland rxvt_unicode dmenu ]; ''; example = literalExample '' with pkgs; [ - i3lock light termite + xwayland + i3status i3status-rust + termite rofi light ] ''; description = '' @@ -70,23 +75,19 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages; - security.wrappers.sway = { - program = "sway-setcap"; - source = "${swayPackage}/bin/sway"; - capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip"; - owner = "root"; - group = "sway"; - permissions = "u+rx,g+rx"; + environment = { + systemPackages = [ swayJoined ] ++ cfg.extraPackages; + etc = { + "sway/config".source = "${swayPackage}/etc/sway/config"; + #"sway/security.d".source = "${swayPackage}/etc/sway/security.d/"; + #"sway/config.d".source = "${swayPackage}/etc/sway/config.d/"; + }; }; - - users.groups.sway = {}; security.pam.services.swaylock = {}; - hardware.opengl.enable = mkDefault true; fonts.enableDefaultFonts = mkDefault true; programs.dconf.enable = mkDefault true; }; - meta.maintainers = with lib.maintainers; [ gnidorah primeos ]; + meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ]; } diff --git a/nixos/modules/programs/waybar.nix b/nixos/modules/programs/waybar.nix new file mode 100644 index 000000000000..22530e6c7d4d --- /dev/null +++ b/nixos/modules/programs/waybar.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, config, ... }: + +with lib; + +{ + options.programs.waybar = { + enable = mkEnableOption "waybar"; + }; + + config = mkIf config.programs.waybar.enable { + systemd.user.services.waybar = { + description = "Waybar as systemd service"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + script = "${pkgs.waybar}/bin/waybar"; + }; + }; + + meta.maintainers = [ maintainers.FlorianFranzen ]; +} diff --git a/nixos/modules/programs/zsh/oh-my-zsh.xml b/nixos/modules/programs/zsh/oh-my-zsh.xml index b26980daf067..568c2de65576 100644 --- a/nixos/modules/programs/zsh/oh-my-zsh.xml +++ b/nixos/modules/programs/zsh/oh-my-zsh.xml @@ -87,9 +87,9 @@ <para> <emphasis>Please keep in mind that this is not compatible with - <literal>programs.zsh.ohMyZsh.custom</literal> as it requires an immutable store - path while <literal>custom</literal> shall remain mutable! An evaluation - failure will be thrown if both <literal>custom</literal> and + <literal>programs.zsh.ohMyZsh.custom</literal> as it requires an immutable + store path while <literal>custom</literal> shall remain mutable! An + evaluation failure will be thrown if both <literal>custom</literal> and <literal>customPkgs</literal> are set.</emphasis> </para> </section> diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 164d8db5859a..deb94922da80 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -79,6 +79,33 @@ in type = types.lines; }; + histSize = mkOption { + default = 2000; + description = '' + Change history size. + ''; + type = types.int; + }; + + histFile = mkOption { + default = "$HOME/.zsh_history"; + description = '' + Change history file. + ''; + type = types.str; + }; + + setOptions = mkOption { + type = types.listOf types.str; + default = [ + "HIST_IGNORE_DUPS" "SHARE_HISTORY" "HIST_FCNTL_LOCK" + ]; + example = [ "EXTENDED_HISTORY" "RM_STAR_WAIT" ]; + description = '' + Configure zsh options. + ''; + }; + enableCompletion = mkOption { default = true; description = '' @@ -162,12 +189,12 @@ in . /etc/zinputrc - # history defaults - SAVEHIST=2000 - HISTSIZE=2000 - HISTFILE=$HOME/.zsh_history + # Don't export these, otherwise other shells (bash) will try to use same histfile + SAVEHIST=${toString cfg.histSize} + HISTSIZE=${toString cfg.histSize} + HISTFILE=${cfg.histFile} - setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK + ${optionalString (cfg.setOptions != []) "setopt ${concatStringsSep " " cfg.setOptions}"} HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" |