From b06ca2b82878b54eb0ce88de928089dbd0496f76 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 7 Jul 2024 21:13:31 +0100 Subject: [PATCH 1/5] Update zsh usage --- config/packages/alacritty/alacritty.yml | 4 ---- system/shared.nix | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/config/packages/alacritty/alacritty.yml b/config/packages/alacritty/alacritty.yml index 009d20e..7b82870 100644 --- a/config/packages/alacritty/alacritty.yml +++ b/config/packages/alacritty/alacritty.yml @@ -53,7 +53,3 @@ key_bindings: - { key: PageDown, mods: Shift, action: ScrollPageDown } - { key: Home, mods: Shift, action: ScrollToTop } - { key: End, mods: Shift, action: ScrollToBottom } - -shell: - program: /bin/zsh - diff --git a/system/shared.nix b/system/shared.nix index e3a44e6..e29f957 100644 --- a/system/shared.nix +++ b/system/shared.nix @@ -66,12 +66,15 @@ "flatpak" "wheel" ]; + shell = pkgs.zsh }; programs.steam = { enable = true; remotePlay.openFirewall = true; }; + + programs.zsh.enable = true; fonts = { packages = with pkgs; [ From e160aca31bd050be24942887e2381808beb7f274 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 7 Jul 2024 21:19:08 +0100 Subject: [PATCH 2/5] Add sink script --- config/home.nix | 4 ++++ config/home/scripts/audio/get-sink-name.sh | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 config/home/scripts/audio/get-sink-name.sh diff --git a/config/home.nix b/config/home.nix index 81a2d14..7a04f11 100644 --- a/config/home.nix +++ b/config/home.nix @@ -20,6 +20,10 @@ in { homeDirectory = "/home/${username}"; stateVersion = "24.05"; + file = { + `/home/${username}/.scripts/audio/get-sink-name.sh`.source = ./home/scripts/audio/get-sink-name.sh; + }; + packages = with pkgs; [ alacritty cups diff --git a/config/home/scripts/audio/get-sink-name.sh b/config/home/scripts/audio/get-sink-name.sh new file mode 100644 index 0000000..66671d8 --- /dev/null +++ b/config/home/scripts/audio/get-sink-name.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +SINK=$(pactl get-default-sink) + +if [ $SINK = "alsa_output.pci-0000_1f_00.3.analog-stereo" ]; then + echo "Speakers" +elif [ $SINK = "alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo" ]; then + echo "Headphones" +else + echo "-" +fi + From c4708a6fbcb5806ee54c93506e2cf9f35c1553f5 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 7 Jul 2024 21:22:44 +0100 Subject: [PATCH 3/5] Enable pulseaudio --- config/home.nix | 1 - system/shared.nix | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/home.nix b/config/home.nix index 7a04f11..a0aaa4d 100644 --- a/config/home.nix +++ b/config/home.nix @@ -63,7 +63,6 @@ in { pm2 plexamp polybar - pulseaudio rofi rofi-emoji steam diff --git a/system/shared.nix b/system/shared.nix index e29f957..0e59e25 100644 --- a/system/shared.nix +++ b/system/shared.nix @@ -75,6 +75,7 @@ }; programs.zsh.enable = true; + programs.neovim.defaultEditor = true; fonts = { packages = with pkgs; [ @@ -96,15 +97,18 @@ environment.systemPackages = with pkgs; [ docker + pulseaudio ]; virtualisation.docker.enable = true; - xdg.portal = { - enable = true; - config.common.default = "*"; - extraPortals = [pkgs.xdg-desktop-portal-gtk]; - }; + xdg.portal = { + enable = true; + config.common.default = "*"; + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + }; + + hardware.pulseaudio.enable = true; system.stateVersion = "24.05"; } From 74dfa6ebcc838b398fb5747756f0493e4e4c36d9 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 7 Jul 2024 21:27:47 +0100 Subject: [PATCH 4/5] Create zsh aliases --- config/home.nix | 1 + system/shared.nix | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/home.nix b/config/home.nix index a0aaa4d..635fdcc 100644 --- a/config/home.nix +++ b/config/home.nix @@ -74,6 +74,7 @@ in { wget xclip yarn + yt-dlp zip zsh zsh-powerlevel10k diff --git a/system/shared.nix b/system/shared.nix index 0e59e25..4d6821e 100644 --- a/system/shared.nix +++ b/system/shared.nix @@ -73,8 +73,24 @@ enable = true; remotePlay.openFirewall = true; }; + + programs.zsh = { + enable = true; + + shellAliases = { + lss = "ls -lah"; + + gss = "git status -s"; + gaa = "git add -A"; + gcm = "git commit -m"; + gco = "git checkout"; + + yt-mp3 = "yt-mp3 -xi --audio-format mp3"; + yt-mp3-meta = "yt-mp3 -xi --audio-format mp3 --parse-metadata \"playlist_index:%(track_number)s\" --add-metadata"; + yt-mp3-meta-cookies = "yt-mp3 -xi --audio-format mp3 --parse-metadata \"playlist_index:%(track_number)s\" --add-metadata --cookies-from-browser firefox"; + }; + }; - programs.zsh.enable = true; programs.neovim.defaultEditor = true; fonts = { From f2ef0a4ce41828e297925f1b2d3cb1cc41bb42b3 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sun, 7 Jul 2024 21:29:10 +0100 Subject: [PATCH 5/5] Setup powerlevel10k --- system/shared.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/shared.nix b/system/shared.nix index 4d6821e..8390665 100644 --- a/system/shared.nix +++ b/system/shared.nix @@ -76,6 +76,7 @@ programs.zsh = { enable = true; + programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; shellAliases = { lss = "ls -lah";