From 5e13aedf36a92cbed234f45fca4ff6bed01cc33e Mon Sep 17 00:00:00 2001 From: Madeleine Date: Sat, 15 Apr 2023 19:27:45 +0100 Subject: [PATCH] updates for my nixos system --- flake.nix | 2 +- maddie/common/jetbrains.nix | 1 + maddie/common/media.nix | 1 + maddie/nixos/audio.nix | 8 +++- maddie/nixos/audio/volume.sh | 24 ++++++++++++ maddie/nixos/bosskey/bosskey.sh | 55 +++++++++++---------------- maddie/nixos/kdeconnect.nix | 2 +- maddie/nixos/openrgb.nix | 2 +- maddie/nixos/popcorntime.nix | 7 ++++ maddie/nixos/secrets.nix | 5 +++ maddie/nixos/syncplay.nix | 7 ++++ maddie/nixos/xob.nix | 20 ++++++++++ maddie/nixos/xob/styles.cfg | 35 +++++++++++++++++ overlays.nix | 4 +- systems/mdesktop/networking.nix | 2 +- systems/mdesktop/noise-supression.nix | 5 +++ systems/mdesktop/openrazer.nix | 9 +++++ systems/mdesktop/openrgb.nix | 8 ++++ 18 files changed, 157 insertions(+), 40 deletions(-) create mode 100755 maddie/nixos/audio/volume.sh create mode 100644 maddie/nixos/popcorntime.nix create mode 100644 maddie/nixos/syncplay.nix create mode 100644 maddie/nixos/xob.nix create mode 100644 maddie/nixos/xob/styles.cfg create mode 100644 systems/mdesktop/openrazer.nix create mode 100644 systems/mdesktop/openrgb.nix diff --git a/flake.nix b/flake.nix index e04aa42..e5dbb4f 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ }; in { - nixosConfigurations."luna" = nixpkgs.lib.nixosSystem { + nixosConfigurations."MDesktop" = nixpkgs.lib.nixosSystem { specialArgs = { inherit username; }; pkgs = nixpkgs_x86_64; system = "x86_64-linux"; diff --git a/maddie/common/jetbrains.nix b/maddie/common/jetbrains.nix index e153807..6b350f8 100644 --- a/maddie/common/jetbrains.nix +++ b/maddie/common/jetbrains.nix @@ -6,5 +6,6 @@ jetbrains.goland jetbrains.webstorm jetbrains.pycharm-professional + android-studio ]; } diff --git a/maddie/common/media.nix b/maddie/common/media.nix index 9ce7a54..89952fb 100644 --- a/maddie/common/media.nix +++ b/maddie/common/media.nix @@ -2,6 +2,7 @@ { home.packages = with pkgs; [ + imagemagick # Manipulates images libheif # Manage .heif files from phones gcolor2 # Color viewer and eyedropper ffmpeg # Video manipulator diff --git a/maddie/nixos/audio.nix b/maddie/nixos/audio.nix index 846ae07..3af07d2 100644 --- a/maddie/nixos/audio.nix +++ b/maddie/nixos/audio.nix @@ -3,8 +3,9 @@ { home.packages = with pkgs; [ pulsemixer # TUI sound mixer - pamixer # CLI sound mixer playerctl # Manages media players + pamixer # CLI sound mixer + yt-dlp # Media downloader cava # Music visualiser ]; @@ -12,4 +13,9 @@ source = ./audio/ytdlp-music.sh; executable = true; }; + + home.file.".local/bin/volume" = { + source = ./audio/volume.sh; + executable = true; + }; } diff --git a/maddie/nixos/audio/volume.sh b/maddie/nixos/audio/volume.sh new file mode 100755 index 0000000..0ed16d6 --- /dev/null +++ b/maddie/nixos/audio/volume.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh + +COMMAND="$@" +[ -z $COMMAND ] && echo "usage: volume [up|down|mute]" && exit 1 + +if [ $COMMAND = "up" ]; then + pamixer --allow-boost -i 5 +elif [ $COMMAND = "down" ]; then + pamixer --allow-boost -d 5 +elif [ $COMMAND = "mute" ]; then + pamixer -t +else + echo "volume: command not found" && exit 1 +fi + +MUTED="$(pamixer --get-mute)" +if [ $MUTED = "true" ]; then + MUTE_CHAR="!" +else + MUTE_CHAR="" +fi + +VOLUME=$(pamixer --get-volume) +echo "$VOLUME""$MUTE_CHAR" > /tmp/volume.fifo diff --git a/maddie/nixos/bosskey/bosskey.sh b/maddie/nixos/bosskey/bosskey.sh index fb0f46c..3b16303 100755 --- a/maddie/nixos/bosskey/bosskey.sh +++ b/maddie/nixos/bosskey/bosskey.sh @@ -1,29 +1,29 @@ #!/bin/sh -# ____ _ -# | __ ) ___ ___ ___| | _____ _ _ -# | _ \ / _ \/ __/ __| |/ / _ \ | | | -# | |_) | (_) \__ \__ \ < __/ |_| | -# |____/ \___/|___/___/_|\_\___|\__, | -# |___/ v1.2 -# GitHub: https://github.com/SpyHoodle/bosskey - - -function refresh_statusbar() { - case $1 in - dwmblocks) - # Refresh dwmblocks as it only updates when told so - kill -35 $(pidof dwmblocks) - ;; - esac -} - - -while getopts "lmpur" options; do +while getopts "lrpm:u:" options; do case $options in m) - # Mute the volume - pamixer --mute + devices=$OPTARG + if echo "$devices" | grep "mic" &>/dev/null; then + # Mute the microphone + pamixer --default-source --mute + fi + if echo "$devices" | grep "vol" &>/dev/null; then + # Mute the volume + pamixer --mute + fi + ;; + + u) + devices=$OPTARG + if echo "$devices"| grep "mic" &>/dev/null; then + # Mute the microphone + pamixer --default-source --unmute + fi + if echo "$devices" | grep "vol" &>/dev/null; then + # Unmute the volume + pamixer --unmute + fi ;; p) @@ -35,16 +35,5 @@ while getopts "lmpur" options; do # Lock the screen using slock(1) slock ;; - - u) - # Unmute the audio - pamixer --unmute - ;; - - r) - # Refresh a dwmblocks status bar - refresh_statusbar "dwmblocks" - ;; - esac done diff --git a/maddie/nixos/kdeconnect.nix b/maddie/nixos/kdeconnect.nix index 51b90f5..2b2df12 100644 --- a/maddie/nixos/kdeconnect.nix +++ b/maddie/nixos/kdeconnect.nix @@ -5,6 +5,6 @@ home.file.".xinitrc".text = '' # Start kdeconnect when entering a graphical session - systemctl restart --user kdeconnect & + systemctl restart --user kdeconnect.service & ''; } diff --git a/maddie/nixos/openrgb.nix b/maddie/nixos/openrgb.nix index 9ef4ccb..e84aac9 100644 --- a/maddie/nixos/openrgb.nix +++ b/maddie/nixos/openrgb.nix @@ -2,7 +2,7 @@ { home.packages = with pkgs; [ - openrgb + openrgb-with-all-plugins ]; home.file.".xinitrc".text = '' diff --git a/maddie/nixos/popcorntime.nix b/maddie/nixos/popcorntime.nix new file mode 100644 index 0000000..2bac960 --- /dev/null +++ b/maddie/nixos/popcorntime.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + popcorntime + ]; +} diff --git a/maddie/nixos/secrets.nix b/maddie/nixos/secrets.nix index 6049af2..d83450d 100644 --- a/maddie/nixos/secrets.nix +++ b/maddie/nixos/secrets.nix @@ -5,4 +5,9 @@ enable = true; storePath = "${config.xdg.dataHome}/password-store"; }; + + home.file.".xinitrc".text = '' + # Restart pass-secret-service as it tends to start failed + systemctl restart --user pass-secret-service.service & + ''; } diff --git a/maddie/nixos/syncplay.nix b/maddie/nixos/syncplay.nix new file mode 100644 index 0000000..4ee5032 --- /dev/null +++ b/maddie/nixos/syncplay.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + syncplay + ]; +} diff --git a/maddie/nixos/xob.nix b/maddie/nixos/xob.nix new file mode 100644 index 0000000..dd97f3f --- /dev/null +++ b/maddie/nixos/xob.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + xob + ]; + + home.file.".xinitrc".text = '' + # Create FIFO for xob + rm -rf /tmp/volume.fifo + mkfifo /tmp/volume.fifo + + # Start xob + (tail -f /tmp/volume.fifo | xob) & + ''; + + xdg.configFile."xob" = { + source = ./xob; + }; +} diff --git a/maddie/nixos/xob/styles.cfg b/maddie/nixos/xob/styles.cfg new file mode 100644 index 0000000..5e5c5ca --- /dev/null +++ b/maddie/nixos/xob/styles.cfg @@ -0,0 +1,35 @@ +default = { + x = {relative = 1; offset = -48;}; + y = {relative = 0.5; offset = 0;}; + length = {relative = 0.3; offset = 0;}; + thickness = 24; + outline = 3; + border = 4; + padding = 3; + orientation = "vertical"; + + overflow = "proportional"; + + color = { + normal = { + fg = "#ffffff"; + bg = "#00000090"; + border = "#ffffff"; + }; + alt = { + fg = "#555555"; + bg = "#00000090"; + border = "#555555"; + }; + overflow = { + fg = "#ff0000"; + bg = "#00000090"; + border = "#ff0000"; + }; + altoverflow = { + fg = "#550000"; + bg = "#00000090"; + border = "#550000"; + }; + }; +}; diff --git a/overlays.nix b/overlays.nix index 736417e..e3c5ed7 100644 --- a/overlays.nix +++ b/overlays.nix @@ -5,8 +5,8 @@ src = final.fetchFromGitHub { owner = "SpyHoodle"; repo = "dwm"; - rev = "7dab824afc125afba150949f12f38def1ffd47a8"; - sha256 = "sha256-qINiKWz8+POCjOL5UA7Mrxw4ZZgJ5D1eGatN1RCeE9M="; + rev = "dca69fedae1e29d946ece4c8325907732015f83f"; + sha256 = "sha256-OezFDY2Gxu+qqT3hdGb+g+YyqV+8R8gSN3ux5+QvL4o="; }; }); st = prev.st.overrideAttrs (oldAttrs: { diff --git a/systems/mdesktop/networking.nix b/systems/mdesktop/networking.nix index 6c933bd..43364f7 100644 --- a/systems/mdesktop/networking.nix +++ b/systems/mdesktop/networking.nix @@ -5,7 +5,7 @@ networking.useDHCP = lib.mkDefault true; # Hostname - networking.hostName = "luna"; + networking.hostName = "MDesktop"; # Enable wireless support & configuration networking.wireless.enable = true; diff --git a/systems/mdesktop/noise-supression.nix b/systems/mdesktop/noise-supression.nix index 75df169..c101b60 100644 --- a/systems/mdesktop/noise-supression.nix +++ b/systems/mdesktop/noise-supression.nix @@ -36,6 +36,11 @@ let }; in { + environment.systemPackages = with pkgs; [ + rnnoise + rnnoise-plugin + ]; + environment.etc."pipewire/pipewire.conf.d/99-input-denoising.conf" = { source = json.generate "99-input-denoising.conf" pw_rnnoise_config; }; diff --git a/systems/mdesktop/openrazer.nix b/systems/mdesktop/openrazer.nix new file mode 100644 index 0000000..4175987 --- /dev/null +++ b/systems/mdesktop/openrazer.nix @@ -0,0 +1,9 @@ +{ config, username, ... }: + +{ + hardware.openrazer = { + enable = true; + users = [ "${username}" ]; + devicesOffOnScreensaver = false; + }; +} diff --git a/systems/mdesktop/openrgb.nix b/systems/mdesktop/openrgb.nix new file mode 100644 index 0000000..d112498 --- /dev/null +++ b/systems/mdesktop/openrgb.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + services.hardware.openrgb = { + enable = true; + package = pkgs.openrgb-with-all-plugins; + }; +}