diff --git a/modules/arduino/default.nix b/modules/arduino/default.nix new file mode 100644 index 00000000..926a0f62 --- /dev/null +++ b/modules/arduino/default.nix @@ -0,0 +1,23 @@ +{ lib, config, pkgs, ... }: +with lib; +let + psCfg = config.pub-solar; + cfg = config.pub-solar.devops; +in +{ + options.pub-solar.arduino = { + enable = mkEnableOption "Life with home automation"; + }; + config = mkIf cfg.enable { + users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] { + extraGroups = [ "dialout" ]; + }; + + home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { + home.packages = [ + arduino + arduino-cli + ]; + }; + }; +} diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 6b4924a6..be18e0fe 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -9,10 +9,21 @@ in options.pub-solar.audio = { enable = mkEnableOption "Life in highs and lows"; mopidy.enable = mkEnableOption "Life with mopidy"; + spotify.enable = mkEnableOption "Life in DRM"; + spotify.username = mkOption { + description = "Spotify login username or email"; + type = types.str; + example = "yourname@example.com"; + default = ""; + }; bluetooth.enable = mkEnableOption "Life with bluetooth"; }; config = mkIf cfg.enable { + users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] { + extraGroups = [ "audio" ]; + }; + home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ # easyeffects, e.g. for microphone noise filtering @@ -24,9 +35,23 @@ in # Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?) pulseaudio vimpc - ]; + ] ++ (if cfg.spotify.enable then [ pkgs.spotify-tui ] else [ ]); xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc; systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs; + + services.spotifyd = mkIf cfg.spotify.enable { + enable = true; + settings = { + global = { + username = cfg.spotify.username; + password_cmd = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus ${pkgs.libsecret}/bin/secret-tool lookup spotify password"; + bitrate = 320; + volume_normalisation = true; + no_audio_cache = false; + max_cache_size = 1000000000; + }; + }; + }; }; # Enable sound using pipewire-pulse @@ -47,7 +72,7 @@ in # Bluetooth configuration using wireplumber # https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration - environment.etc = { + environment.etc = mkIf cfg.bluetooth.enable { "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' bluez_monitor.properties = { ["bluez5.enable-sbc-xq"] = true, diff --git a/modules/terminal-life/nvim/lsp.vim b/modules/terminal-life/nvim/lsp.vim index f4f4f7b4..6647fc03 100644 --- a/modules/terminal-life/nvim/lsp.vim +++ b/modules/terminal-life/nvim/lsp.vim @@ -81,6 +81,8 @@ lua <