From d84ee5d67a7055a9eccd4b6b84218ef13378d028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Sat, 4 Jun 2022 16:45:33 +0200 Subject: [PATCH 1/8] Remove unused scream pulse service file --- .../virtualisation/scream-pulse.service.nix | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 modules/virtualisation/scream-pulse.service.nix diff --git a/modules/virtualisation/scream-pulse.service.nix b/modules/virtualisation/scream-pulse.service.nix deleted file mode 100644 index c4337fa0..00000000 --- a/modules/virtualisation/scream-pulse.service.nix +++ /dev/null @@ -1,19 +0,0 @@ -pkgs: -{ - enable = true; - wantedBy = [ "multi-user.target" ]; - unitConfig = { - Description = "Scream IVSHMEM pulse reciever"; - BindsTo = [ "pipewire-pulse.service" ]; - After = [ "pipewire-pulse.service" ]; - Wants = [ "pipewire-pulse.service" ]; - }; - serviceConfig = { - Type = "simple"; - ExecStartPre = [ - "${pkgs.coreutils-full}/bin/truncate -s 0 /dev/shm/scream-ivshmem" - "${pkgs.coreutils-full}/bin/dd if=/dev/zero of=/dev/shm/scream-ivshmem bs=1M count=2" - ]; - ExecStart = "${pkgs.scream}/bin/scream -m /dev/shm/scream-ivshmem"; - }; -} From 3bd0b3c50237be867e91c355247b3f59f3e804f3 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 7 Jul 2022 22:24:43 +0200 Subject: [PATCH 2/8] signal-desktop: works without workaround again Also add --use-tray-icon flag, since it works now --- modules/social/default.nix | 2 +- modules/sway/config/config.d/custom-keybindings.conf | 2 +- pkgs/default.nix | 1 - pkgs/ps-signal-desktop.nix | 9 --------- 4 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 pkgs/ps-signal-desktop.nix diff --git a/modules/social/default.nix b/modules/social/default.nix index 9c53718d..e0d12449 100644 --- a/modules/social/default.nix +++ b/modules/social/default.nix @@ -12,7 +12,7 @@ in config = mkIf cfg.enable { home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] { home.packages = [ - ps-signal-desktop + signal-desktop tdesktop element-desktop irssi diff --git a/modules/sway/config/config.d/custom-keybindings.conf b/modules/sway/config/config.d/custom-keybindings.conf index d5887e3e..bb452ddc 100644 --- a/modules/sway/config/config.d/custom-keybindings.conf +++ b/modules/sway/config/config.d/custom-keybindings.conf @@ -18,7 +18,7 @@ bindsym $mod+F2 exec firefox bindsym $mod+F3 exec $term -e vifm bindsym $mod+Shift+F3 exec gksu $term -e vifm bindsym $mod+F4 exec nautilus -w -bindsym $mod+Shift+F4 exec signal-desktop +bindsym $mod+Shift+F4 exec signal-desktop --use-tray-icon bindsym $mod+F5 exec $term -e 'mocp -C $XDG_CONFIG_DIR/mocp/config' bindsym $mod+Shift+m exec mu bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf diff --git a/pkgs/default.nix b/pkgs/default.nix index dcbd0f0e..ecac30a3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -19,5 +19,4 @@ with final; { drone-docker-runner = writeShellScriptBin "drone-docker-runner" (import ./drone-docker-runner.nix final); # ps-fixes - ps-signal-desktop = writeShellScriptBin "signal-desktop" (import ./ps-signal-desktop.nix final); } diff --git a/pkgs/ps-signal-desktop.nix b/pkgs/ps-signal-desktop.nix deleted file mode 100644 index ff615639..00000000 --- a/pkgs/ps-signal-desktop.nix +++ /dev/null @@ -1,9 +0,0 @@ -self: with self; -let - signal-desktop = self.signal-desktop.overrideAttrs (old: { - meta.platforms = [ "x86_64-linux" "aarch64-linux" ]; - }); -in -'' - exec ${signal-desktop}/bin/signal-desktop --disable-gpu -- "$@" -'' From 6a5b09a26a1cdd9eb8daf92152cf4a860d54b98b Mon Sep 17 00:00:00 2001 From: teutat3s Date: Thu, 7 Jul 2022 22:26:08 +0200 Subject: [PATCH 3/8] audio: remove mopidy-spotify, upstream abandonded support --- modules/audio/mopidy.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/audio/mopidy.nix b/modules/audio/mopidy.nix index 99552113..9d37eaba 100644 --- a/modules/audio/mopidy.nix +++ b/modules/audio/mopidy.nix @@ -1,7 +1,6 @@ pkgs: { enable = true; extensionPackages = with pkgs; [ - mopidy-spotify mopidy-mpd mopidy-soundcloud mopidy-youtube From 237a7534744f5fe8b6033bfe2c9d39a3f999de8d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 8 Jul 2022 14:18:10 +0200 Subject: [PATCH 4/8] audio: switch to wireplumber for pipewire configuration https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration --- modules/audio/default.nix | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index fcceefd3..3fb67664 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -43,32 +43,19 @@ in }; }; config.pipewire-pulse = builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json); + }; - # Bluetooth configuration for pipewire - media-session.config.bluez-monitor.rules = mkIf cfg.bluetooth.enable [ - { - # Matches all cards - matches = [{ "device.name" = "~bluez_card.*"; }]; - actions = { - "update-props" = { - "bluez5.reconnect-profiles" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ]; - # mSBC is not expected to work on all headset + adapter combinations. - "bluez5.msbc-support" = true; - }; - }; + # Bluetooth configuration using wireplumber + # https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration + environment.etc = mkIf cfg.bluetooth.enable { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' + bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" } - { - matches = [ - # Matches all sources - { "node.name" = "~bluez_input.*"; } - # Matches all outputs - { "node.name" = "~bluez_output.*"; } - ]; - actions = { - "node.pause-on-idle" = false; - }; - } - ]; + ''; }; # Enable bluetooth From f7fbdb80afd9aace0342c4ef62384a2bce21fa03 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 8 Jul 2022 14:13:41 +0200 Subject: [PATCH 5/8] hosts: add missing system.stateVersion --- hosts/PubSolarOS.nix | 8 ++++++++ hosts/bootstrap.nix | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/hosts/PubSolarOS.nix b/hosts/PubSolarOS.nix index 70cf7a08..d741a4d1 100644 --- a/hosts/PubSolarOS.nix +++ b/hosts/PubSolarOS.nix @@ -12,4 +12,12 @@ networking.networkmanager.enable = true; fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? } diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix index c6d8f105..acadc449 100644 --- a/hosts/bootstrap.nix +++ b/hosts/bootstrap.nix @@ -18,4 +18,12 @@ # will be overridden by the bootstrapIso instrumentation fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "21.05"; # Did you read the comment? } From b25b0431765309225486aa46f35017b4223efce1 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 9 Aug 2022 11:54:19 +0200 Subject: [PATCH 6/8] nvfetcher: use nixpkgs version --- flake.nix | 1 - shell/devos.nix | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 7f3c2803..f18df6df 100644 --- a/flake.nix +++ b/flake.nix @@ -76,7 +76,6 @@ overlays = [ nur.overlay agenix.overlay - nvfetcher.overlay ./pkgs/default.nix ]; }; diff --git a/shell/devos.nix b/shell/devos.nix index bb9f1744..f49254fa 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -38,9 +38,9 @@ in (devos agenix) { category = "devos"; - name = pkgs.nvfetcher-bin.pname; - help = pkgs.nvfetcher-bin.meta.description; - command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@"; + name = pkgs.nvfetcher.pname; + help = pkgs.nvfetcher.meta.description; + command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@"; } (linter nixpkgs-fmt) (linter editorconfig-checker) From 0cc621a4ec2b5363b058c3111145aaedbef70803 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 9 Aug 2022 11:54:49 +0200 Subject: [PATCH 7/8] deploy-rs: use nixpkgs version --- shell/devos.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/devos.nix b/shell/devos.nix index f49254fa..f799ca03 100644 --- a/shell/devos.nix +++ b/shell/devos.nix @@ -46,7 +46,7 @@ in (linter editorconfig-checker) # (docs python3Packages.grip) too many deps (docs mdbook) - (devos inputs.deploy.packages.${pkgs.system}.deploy-rs) + (devos deploy-rs) ] ++ lib.optional (system != "i686-linux") From bb53317daf59eae90085821575175a12e7c8fd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Wed, 10 Aug 2022 22:42:14 +0200 Subject: [PATCH 8/8] Add spotify as an audio option Adds a `config.pub-solar.audio.spotify` option that when enabled installs and configures `spotifyd` as a systemd daemon and `spotify-tui` as the terminal-based UI. After enabling, run `spt` in the terminal to open the UI. --- modules/audio/default.nix | 27 ++++++++++++++++++++++++++- profiles/base-user/default.nix | 8 +++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index fcceefd3..b43dc4ac 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 diff --git a/profiles/base-user/default.nix b/profiles/base-user/default.nix index 8f304794..9ff21c8e 100644 --- a/profiles/base-user/default.nix +++ b/profiles/base-user/default.nix @@ -16,7 +16,13 @@ in # home to /home/username, useDefaultShell to true, and isSystemUser to false. isNormalUser = true; description = psCfg.user.description; - extraGroups = [ "wheel" "docker" "input" "audio" "networkmanager" "lp" "scanner" ]; + extraGroups = [ + "wheel" + "input" + "networkmanager" + "lp" + "scanner" + ]; initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else ""; shell = pkgs.zsh; openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ];