summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.lock42
-rw-r--r--hosts/laptop/cfg.nix6
-rw-r--r--hosts/vps/cfg.nix17
-rw-r--r--mixins/cli.nix22
-rw-r--r--mixins/multimedia.nix19
-rw-r--r--mixins/sway.nix59
-rw-r--r--mixins/youtube-quality.nix51
7 files changed, 155 insertions, 61 deletions
diff --git a/flake.lock b/flake.lock
index a9ea28f..fc88d9b 100644
--- a/flake.lock
+++ b/flake.lock
@@ -7,11 +7,11 @@
         "nixpkgs": "nixpkgs"
       },
       "locked": {
-        "lastModified": 1684153753,
-        "narHash": "sha256-PVbWt3qrjYAK+T5KplFcO+h7aZWfEj1UtyoKlvcDxh0=",
+        "lastModified": 1689334118,
+        "narHash": "sha256-djk5AZv1yU84xlKFaVHqFWvH73U7kIRstXwUAnDJPsk=",
         "owner": "ryantm",
         "repo": "agenix",
-        "rev": "db5637d10f797bb251b94ef9040b237f4702cde3",
+        "rev": "0d8c5325fc81daf00532e3e26c6752f7bcde1143",
         "type": "github"
       },
       "original": {
@@ -44,11 +44,11 @@
     },
     "hardware": {
       "locked": {
-        "lastModified": 1684899633,
-        "narHash": "sha256-NtwerXX8UFsoNy6k+DukJMriWtEjQtMU/Urbff2O2Dg=",
+        "lastModified": 1689320556,
+        "narHash": "sha256-vODUkZLWFVCvo1KPK3dC2CbXjxa9antEn5ozwlcTr48=",
         "owner": "nixos",
         "repo": "nixos-hardware",
-        "rev": "4cc688ee711159b9bcb5a367be44007934e1a49d",
+        "rev": "d4ea64f2063820120c05f6ba93ee02e6d4671d6b",
         "type": "github"
       },
       "original": {
@@ -85,11 +85,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1685573051,
-        "narHash": "sha256-zrpbdQVJFpNVFK3SlA6mE0le8qnKjUjcuY4OzL+wSHw=",
+        "lastModified": 1689414552,
+        "narHash": "sha256-FS47yV7VbI2EZ5nDHHuFCH1KFrA8Zh8bnEUUi77VUCU=",
         "owner": "nix-community",
         "repo": "home-manager",
-        "rev": "3876cc613ac3983078964ffb5a0c01d00028139e",
+        "rev": "559856748982588a9eda6bfb668450ebcf006ccd",
         "type": "github"
       },
       "original": {
@@ -120,11 +120,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1671116920,
-        "narHash": "sha256-QmDGsUUmAGn77UTR7eQJmebl8f3IIUCtmbbAdJqKA3s=",
+        "lastModified": 1688141737,
+        "narHash": "sha256-qHrNMYWukOKmKVf6wXOGKj1xxUnOGjvTRbt/PLLXuBE=",
         "owner": "matthewcroughan",
         "repo": "nixinate",
-        "rev": "b4d17b8e2a4abc47e93e1a1c466e0286a63640d8",
+        "rev": "7902ae845e6cc5bd450e510cdf5e009a6e4a44d9",
         "type": "github"
       },
       "original": {
@@ -151,11 +151,11 @@
     },
     "nixpkgs_2": {
       "locked": {
-        "lastModified": 1685383865,
-        "narHash": "sha256-3uQytfnotO6QJv3r04ajSXbEFMII0dUtw0uqYlZ4dbk=",
+        "lastModified": 1689282004,
+        "narHash": "sha256-VNhuyb10c9SV+3hZOlxwJwzEGytZ31gN9w4nPCnNvdI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "5e871d8aa6f57cc8e0dc087d1c5013f6e212b4ce",
+        "rev": "e74e68449c385db82de3170288a28cd0f608544f",
         "type": "github"
       },
       "original": {
@@ -173,11 +173,11 @@
         "utils": "utils"
       },
       "locked": {
-        "lastModified": 1685600155,
-        "narHash": "sha256-od1ax3UUft+NJzXzP1tODRb0ZmFV0X4AyBgsuXMOCgk=",
+        "lastModified": 1689425368,
+        "narHash": "sha256-YvQI/RnJfhu/JaSio4IglcSB+TDm18BBZCTx0x/DyB4=",
         "owner": "wamserma",
         "repo": "flake-programs-sqlite",
-        "rev": "5cca303fa112c76a800aa3c5c6b4311996a9bd37",
+        "rev": "4962ebd49c53ae49b77425e4c1e6a4f4d9e22894",
         "type": "github"
       },
       "original": {
@@ -220,11 +220,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1685606169,
-        "narHash": "sha256-J0nL9OsXPq8scNC5TCMxP2tiQ4n9zYCYMEMOxKd2vDk=",
+        "lastModified": 1688020048,
+        "narHash": "sha256-8LhRluyWvjtc94i3If8B3fEI8IXS+5MAcltZhfpyvW8=",
         "owner": "viperML",
         "repo": "nix-common",
-        "rev": "dbb67bae3ac5578e41e8cc2f5ed2c511f30c5400",
+        "rev": "4b1950080dfffe478d6a200b1d602584f513eb40",
         "type": "github"
       },
       "original": {
diff --git a/hosts/laptop/cfg.nix b/hosts/laptop/cfg.nix
index 4e2f843..ab372c2 100644
--- a/hosts/laptop/cfg.nix
+++ b/hosts/laptop/cfg.nix
@@ -108,6 +108,12 @@
         group = "users";
       }
       {
+        directory = "/home/tzlil/.local/share/Terraria";
+        user = "tzlil";
+        group = "users";
+      }
+
+      {
         directory = "/home/tzlil/.local/share/Steam";
         user = "tzlil";
         group = "users";
diff --git a/hosts/vps/cfg.nix b/hosts/vps/cfg.nix
index 2ec6cd4..7fc5f86 100644
--- a/hosts/vps/cfg.nix
+++ b/hosts/vps/cfg.nix
@@ -70,5 +70,22 @@
     };
 
     networking.networkmanager.enable = lib.mkForce false;
+
+
+    nixpkgs.config.allowUnfree = true;
+    environment.persistence."/nix/persist".directories = [
+      {
+        directory = config.services.terraria.dataDir;
+        user = "terraria";
+        group = "terraria";
+      }
+    ];
+
+    services.terraria = {
+      enable = true;
+      worldPath = "${config.services.terraria.dataDir}/14.wld";
+      password = "???";
+      openFirewall = true;
+    };
   };
 }
diff --git a/mixins/cli.nix b/mixins/cli.nix
index 5ef2cfe..c9a214f 100644
--- a/mixins/cli.nix
+++ b/mixins/cli.nix
@@ -51,9 +51,9 @@
               ''
           )
         ];
-        sessionVariables = {
-          EDITOR = "nvim";
-        };
+        #sessionVariables = {
+        #EDITOR = "nvim";
+        #};
       };
       programs = {
         git = {
@@ -79,18 +79,22 @@
           functions = {
             fish_greeting = "";
             ns = ''
-	    set -l p
-	    for a in $argv
-	    	set p $p "nixpkgs#$a"
-	    end
-	    nix shell $p
-	    '';
+              set -l p
+              for a in $argv
+              	set p $p "nixpkgs#$a"
+              end
+              nix shell $p
+            '';
           };
         };
         neovim = {
           enable = true;
           viAlias = true;
           vimAlias = true;
+          defaultEditor = true;
+          extraConfig = ''
+            set clipboard+=unnamedplus
+          '';
         };
         # gpg = {
         #   enable = true;
diff --git a/mixins/multimedia.nix b/mixins/multimedia.nix
index 8186b87..9b82a4f 100644
--- a/mixins/multimedia.nix
+++ b/mixins/multimedia.nix
@@ -22,6 +22,8 @@
           enable = true;
           defaultApplications = {
             "application/pdf" = ["${pkgs.zathura}/share/applications/org.pwmt.zathura.desktop"];
+            "image/png" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"];
+            "image/jpeg" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"];
           };
         };
         userDirs = {
@@ -29,14 +31,27 @@
           desktop = "${config.home.homeDirectory}/desktop";
           download = "${config.home.homeDirectory}/downloads";
         };
+        #portal = {
+        #  enable = true;
+        #  extraPortals = with pkgs; [
+        #    xdg-desktop-portal-wlr
+        #    xdg-desktop-portal-gtk
+        #  ];
+        #};
       };
 
       programs = {
         mpv = {
           enable = true;
-          scripts = [
-            pkgs.mpvScripts.mpris
+          scripts = with pkgs.mpvScripts; [
+            mpris
+            #youtube-quality
+            (pkgs.callPackage ./youtube-quality.nix {})
           ];
+          config = {
+            sub-auto = "fuzzy";
+            ytdl-raw-options = "write-auto-sub=,sub-lang=en";
+          };
         };
         zathura = {
           enable = true;
diff --git a/mixins/sway.nix b/mixins/sway.nix
index 84a8cc9..678206d 100644
--- a/mixins/sway.nix
+++ b/mixins/sway.nix
@@ -16,8 +16,8 @@
       trap "rm -f $in_pipe $out_pipe" EXIT
 
       app_id=menu
-      chooser="${pkgs.fzf}/bin/fzf <$in_pipe >$out_pipe"
-      ${pkgs.foot}/bin/foot -W40x40 --app-id "$app_id" -- sh -c "$chooser" &
+      chooser="${lib.getExe pkgs.fzf} <$in_pipe >$out_pipe"
+      ${lib.getExe pkgs.foot} -W40x40 --app-id "$app_id" -- sh -c "$chooser" &
       cat >"$in_pipe"
       cat <"$out_pipe"
     '';
@@ -62,7 +62,7 @@ in {
         block = "sound"
         headphones_indicator=true
         [[block.click]]
-        cmd = "${pkgs.pavucontrol}/bin/pavucontrol"
+        cmd = "${lib.getExe pkgs.pavucontrol}"
         button = "left"
 
         [[block]]
@@ -102,7 +102,7 @@ in {
       };
 
       services.swayidle = let
-        pgrep = "${pkgs.procps}/bin/pgrep";
+        pgrep = "${lib.getExe pkgs.procps}";
         dpms_check = s:
           pkgs.writeShellScript "dpms_check_${s}" ''
             set -x
@@ -115,7 +115,7 @@ in {
           '';
         fadelock = pkgs.writeShellScript "fadelock.sh" ''
           set -x
-          exec "${pkgs.swaylock}/bin/swaylock"
+          exec "${lib.getExe pkgs.swaylock}"
         '';
       in {
         enable = false;
@@ -235,12 +235,13 @@ in {
             "${modifier}+shift+a" = "focus child";
             "${modifier}+Shift+minus" = "move scratchpad";
             "${modifier}+minus" = "scratchpad show";
-            "${modifier}+m" = "mode notifications";
+            #"${modifier}+m" = "mode notifications";
+            "${modifier}+m" = "exec ${pkgs.wl-clipboard}/bin/wl-paste | xargs mpv";
 
-            "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -c 070D0D";
-            "Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
-            "Shift+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy active";
-            "Ctrl+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy output";
+            "${modifier}+l" = "exec ${lib.getExe pkgs.swaylock} -c 070D0D";
+            "Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy area";
+            "Shift+Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy active";
+            "Ctrl+Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy output";
           };
           input = {
             "type:keyboard" = {
@@ -255,11 +256,11 @@ in {
         };
         extraConfig = ''
           exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
-          # exec ${pkgs.swayidle}/bin/swayidle -w \
-          # 	timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \
+          # exec ${lib.getExe pkgs.swayidle} -w \
+          # 	timeout 300 '${lib.getExe pkgs.swaylock} -f -c 000000' \
           # 	timeout 600 'swaymsg "output * dpms off"' \
           # 	resume 'swaymsg "output * dpms on"' \
-          # 	before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'
+          # 	before-sleep '${lib.getExe pkgs.swaylock} -f -c 000000'
           # exec ${pkgs.polkit_gnome}/polkit-gnome/polkit-gnome-authentication-agent-1
 
           #set $mod Alt
@@ -268,7 +269,7 @@ in {
           set $down n
           set $up e
           set $right i
-          set $term ${pkgs.foot}/bin/foot
+          set $term ${lib.getExe pkgs.foot}
 
           default_border pixel
           hide_edge_borders smart
@@ -282,24 +283,24 @@ in {
           floating_modifier $mod normal
           mode notifications {
             bindsym Escape mode default
-            bindsym Return exec ${pkgs.mako}/bin/makoctl invoke; exec ${pkgs.mako}/bin/makoctl dismiss; mode default
-            bindsym d exec ${pkgs.mako}/bin/makoctl dismiss; mode default
-            bindsym Shift+d exec ${pkgs.mako}/bin/makoctl dismiss -a; mode default
+            bindsym Return exec ${lib.getExe pkgs.mako} invoke; exec ${lib.getExe pkgs.mako} dismiss; mode default
+            bindsym d exec ${lib.getExe pkgs.mako} dismiss; mode default
+            bindsym Shift+d exec ${lib.getExe pkgs.mako} dismiss -a; mode default
           }
 
 
           font Iosevka 10
 
           bindsym $mod+p exec passmenu $menu_args
-          bindsym --locked XF86AudioMute exec ${pkgs.pulseaudio}/bin/playerctl set-sink-mute @DEFAULT_SINK@ toggle
-          bindsym --locked XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/playerctl set-sink-volume @DEFAULT_SINK@ -5%
-          bindsym --locked XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/playerctl set-sink-volume @DEFAULT_SINK@ +5%
-          bindsym --locked XF86AudioMicMute exec ${pkgs.pulseaudio}/bin/playerctl set-source-mute @DEFAULT_SOURCE@ toggle
+          bindsym --locked XF86AudioMute exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle
+          bindsym --locked XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%
+          bindsym --locked XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%
+          bindsym --locked XF86AudioMicMute exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle
 
-          bindsym --locked XF86AudioNext exec ${pkgs.playerctl}/bin/playerctl next
-          bindsym --locked XF86AudioPlay exec ${pkgs.playerctl}/bin/playerctl play-pause
-          bindsym --locked XF86AudioPrev exec ${pkgs.playerctl}/bin/playerctl previous
-          bindsym --locked XF86AudioStop exec ${pkgs.playerctl}/bin/playerctl stop
+          bindsym --locked XF86AudioNext exec ${lib.getExe pkgs.playerctl} next
+          bindsym --locked XF86AudioPlay exec ${lib.getExe pkgs.playerctl} play-pause
+          bindsym --locked XF86AudioPrev exec ${lib.getExe pkgs.playerctl} previous
+          bindsym --locked XF86AudioStop exec ${lib.getExe pkgs.playerctl} stop
 
           for_window [app_id="^menu$"] floating enable, border none
           #for_window [app_id="mpv"] sticky enable
@@ -309,11 +310,11 @@ in {
           #for_window [app_id="imv"] floating enable
           #for_window [class="PacketTracer"] floating enable
 
-          bindsym XF86MonBrightnessUp exec ${pkgs.brightnessctl}/bin/brightnessctl s +5%
-          bindsym XF86MonBrightnessDown exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-
+          bindsym XF86MonBrightnessUp exec ${lib.getExe pkgs.brightnessctl} s +5%
+          bindsym XF86MonBrightnessDown exec ${lib.getExe pkgs.brightnessctl} s 5%-
 
-          exec ${pkgs.mako}/bin/mako >/tmp/mako.log 2>&1
-          exec_always ${pkgs.kanshi}/bin/kanshi >/tmp/kanshi.log 2>&1
+          exec ${lib.getExe pkgs.mako} >/tmp/mako.log 2>&1
+          exec_always ${lib.getExe pkgs.kanshi} >/tmp/kanshi.log 2>&1
 
 
           default_border pixel 2
diff --git a/mixins/youtube-quality.nix b/mixins/youtube-quality.nix
new file mode 100644
index 0000000..e6143ac
--- /dev/null
+++ b/mixins/youtube-quality.nix
@@ -0,0 +1,51 @@
+{
+  lib,
+  stdenvNoCC,
+  fetchFromGitHub,
+  oscSupport ? false,
+  fetchpatch,
+}:
+stdenvNoCC.mkDerivation rec {
+  pname = "mpv-youtube-quality";
+  version = "unstable-2020-02-11";
+
+  src = fetchFromGitHub {
+    owner = "jgreco";
+    repo = "mpv-youtube-quality";
+    rev = "1f8c31457459ffc28cd1c3f3c2235a53efad7148";
+    sha256 = "voNP8tCwCv8QnAZOPC9gqHRV/7jgCAE63VKBd/1s5ic=";
+  };
+
+  patches = [
+    (fetchpatch {
+      # Add support for using yt-dlp.
+      url = "https://github.com/jgreco/mpv-youtube-quality/commit/80a8540c449c8ba63a8e0361e6f17ffe7ef7aaf2.patch";
+      hash = "sha256-wbjGF007jUa2rFsbdlRE3JerQkKBy70LKbjp+IwHzKg=";
+    })
+  ];
+
+  dontBuild = true;
+
+  installPhase =
+    ''
+      runHook preInstall
+      mkdir -p $out/share/mpv/scripts
+      cp youtube-quality.lua $out/share/mpv/scripts
+    ''
+    + lib.optionalString oscSupport ''
+      cp youtube-quality-osc.lua $out/share/mpv/scripts
+    ''
+    + ''
+      runHook postInstall
+    '';
+
+  passthru.scriptName = "youtube-quality.lua";
+
+  meta = with lib; {
+    description = "A userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly";
+    homepage = "https://github.com/jgreco/mpv-youtube-quality";
+    license = licenses.unfree;
+    platforms = platforms.all;
+    maintainers = with maintainers; [lunik1];
+  };
+}