about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-01-17 03:35:18 +0300
committerAzat Bahawi <azat@bahawi.net>2024-01-17 03:35:18 +0300
commit251ce90e1bc99a9a05a2ebfe548f696c839e7a2a (patch)
treede87890d246882ff4d156ae9cd5bf12b99665c35
parent2024-01-15 (diff)
2024-01-17
-rw-r--r--modules/common/curl.nix2
-rw-r--r--modules/common/mpv.nix2
-rw-r--r--modules/common/profiles/dev/default.nix77
-rw-r--r--nixosConfigurations/eonwe/default.nix97
4 files changed, 134 insertions, 44 deletions
diff --git a/modules/common/curl.nix b/modules/common/curl.nix
index 97b4b55..1514a09 100644
--- a/modules/common/curl.nix
+++ b/modules/common/curl.nix
@@ -10,7 +10,7 @@ in {
   options.nixfiles.modules.curl.enable = mkEnableOption "cURL";
 
   config = mkIf cfg.enable {
-    hm.home.file.".curlrc".text = ''
+    hm.xdg.configFile.".curlrc".text = ''
       connect-timeout = 60
       progress-bar
       remote-time
diff --git a/modules/common/mpv.nix b/modules/common/mpv.nix
index 596d163..6f45304 100644
--- a/modules/common/mpv.nix
+++ b/modules/common/mpv.nix
@@ -109,7 +109,7 @@ in {
         osd-level = 1;
         osd-shadow-color = "#33000000";
 
-        osc = false;
+        # osc = false;
 
         blend-subtitles = true;
         embeddedfonts = false;
diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix
index 8c9e400..f7c313f 100644
--- a/modules/common/profiles/dev/default.nix
+++ b/modules/common/profiles/dev/default.nix
@@ -28,55 +28,56 @@ in {
       wget.enable = true;
     };
 
-    hm.home = {
-      file = {
-        ".gdbinit".source = ./gdbinit;
+    hm = {
+      home = {
+        sessionVariables = rec {
+          CABAL_DIR = "${config.dirs.data}/cabal";
+          CABAL_CONFIG = pkgs.writeText "cabal-config" ''
+            repository hackage.haskell.org
+              url: https://hackage.haskell.org/
+              secure: True
 
-        ".ghc/ghci.conf".source = ./ghci.conf;
-      };
-
-      sessionVariables = rec {
-        CABAL_DIR = "${config.my.home}/.cabal";
-        CABAL_CONFIG = pkgs.writeText "cabal-config" ''
-          repository hackage.haskell.org
-            url: https://hackage.haskell.org/
-            secure: True
+            jobs: $ncpus
 
-          jobs: $ncpus
+            remote-repo-cache: ${CABAL_DIR}/packages
 
-          remote-repo-cache: ${CABAL_DIR}/packages
+            world-file: ${CABAL_DIR}/world
 
-          world-file: ${CABAL_DIR}/world
+            logs-dir: ${CABAL_DIR}/logs
+            build-summary: ${CABAL_DIR}/logs/build.log
 
-          logs-dir: ${CABAL_DIR}/logs
-          build-summary: ${CABAL_DIR}/logs/build.log
+            installdir: ${CABAL_DIR}/bin
+            extra-prog-path: ${CABAL_DIR}/bin
+          '';
+          STACK_ROOT = "${config.dirs.data}/stack";
 
-          installdir: ${CABAL_DIR}/bin
-          extra-prog-path: ${CABAL_DIR}/bin
-        '';
+          RUSTUP_HOME = "${config.dirs.data}/rustup";
+          CARGO_HOME = "${config.dirs.data}/cargo";
 
-        STACK_ROOT = "${config.my.home}/.stack";
+          GOPATH = "${config.dirs.data}/go";
+          GORE_HOME = "${config.dirs.data}/gore";
 
-        CARGO_HOME = "${config.my.home}/.cargo";
+          PYTHONSTARTUP = ./pystartup.py;
+        };
 
-        GOPATH = "${config.my.home}/.go";
-        GORE_HOME = "${config.my.home}/.gore";
-
-        PYTHONSTARTUP = ./pystartup.py;
+        packages = with pkgs; [
+          nix-index
+          nix-update
+          nixpkgs-review
+          hydra-check
+          jq
+          yq
+          htmlq
+          sops
+          httpie
+          logcli
+        ];
       };
 
-      packages = with pkgs; [
-        nix-index
-        nix-update
-        nixpkgs-review
-        hydra-check
-        jq
-        yq
-        htmlq
-        sops
-        httpie
-        logcli
-      ];
+      xdg.configFile = {
+        "gdb/gdbinit".source = ./gdbinit;
+        "ghc/ghci.conf".source = ./ghci.conf;
+      };
     };
   };
 }
diff --git a/nixosConfigurations/eonwe/default.nix b/nixosConfigurations/eonwe/default.nix
index 387c51a..9afaf2c 100644
--- a/nixosConfigurations/eonwe/default.nix
+++ b/nixosConfigurations/eonwe/default.nix
@@ -51,10 +51,99 @@ with lib; {
     programs = {
       beets.settings.directory = mkForce "/mnt/udata/music";
 
-      mpv.config = {
-        gpu-api = "vulkan";
-        profile = "gpu-hq";
-        vo = "gpu-next";
+      mpv = {
+        profiles = let
+          mapShaders = shaders: map (args: toString (pkgs.fetchurl args)) shaders;
+          cfl-prediction = mapShaders [
+            {
+              url = "https://raw.githubusercontent.com/Artoriuz/glsl-chroma-from-luma-prediction/471c65dd3915d39e7ef69957ab63e006125fbb88/CfL_Prediction.glsl";
+              sha256 = "sha256-Mgb1KqF1EPPzR3SCVr9S4XzVmZkYEEFIHSp59RZ9wq8=";
+            }
+          ];
+          ravu-lite-ar-r4 = mapShaders [
+            {
+              url = "https://raw.githubusercontent.com/bjin/mpv-prescalers/b3f0a59d68f33b7162051ea5970a5169558f0ea2/compute/ravu-lite-ar-r4.hook";
+              sha256 = "sha256-gyBAv/Sf75CobVUugeTOhy54B9z8iIoJSJgnLopfMsY=";
+            }
+          ];
+          ssimdownscaler = mapShaders [
+            {
+              url = "https://gist.githubusercontent.com/igv/36508af3ffc84410fe39761d6969be10/raw/575d13567bbe3caa778310bd3b2a4c516c445039/SSimDownscaler.glsl";
+              sha256 = "sha256-AEq2wv/Nxo9g6Y5e4I9aIin0plTcMqBG43FuOxbnR1w=";
+            }
+          ];
+        in {
+          # TODO Profile conditionals on width are not working.
+          "qhd-downscale" = {
+            dscale = "lanczos";
+            linear-downscaling = false;
+            glsl-shaders-append = ssimdownscaler;
+          };
+
+          "qhd-upscale" = {
+            glsl-shaders-append = cfl-prediction ++ ravu-lite-ar-r4;
+          };
+        };
+
+        config = {
+          profile = "gpu-hq";
+          vo = "gpu-next";
+          gpu-api = "vulkan";
+          hwdec = "auto";
+
+          deband = true;
+          deband-iterations = 4;
+          deband-threshold = 35;
+          deband-range = 16;
+          deband-grain = 5;
+
+          temporal-dither = true;
+          dither-depth = "auto";
+          dither = "fruit";
+
+          interpolation = true;
+          video-sync = "display-resample";
+          tscale = "oversample";
+
+          target-prim = "auto";
+          target-trc = "auto";
+          vf = "format=colorlevels=full:colormatrix=auto";
+          video-output-levels = "full";
+
+          glsl-shaders-append = map (text: toString (pkgs.writeText "shader.hook" text)) [
+            ''
+              //!HOOK LUMA
+              //!BIND HOOKED
+              #define STRENGTH 48.0
+              float mod289(float x)  { return x - floor(x / 289.0) * 289.0; }
+              float permute(float x) { return mod289((34.0*x + 1.0) * x); }
+              float rand(float x)    { return fract(x / 41.0); }
+              vec4 hook()  {
+                  vec3 _m = vec3(HOOKED_pos, 1.0) + vec3(1.0);
+                  float h = permute(permute(permute(_m.x)+_m.y)+_m.z);
+                  vec4 noise;
+                  noise.x = rand(h);
+                  return HOOKED_tex(HOOKED_pos) + vec4(STRENGTH/8192.0) * (noise - 0.5);
+              }
+            ''
+            ''
+              //!HOOK CHROMA
+              //!BIND HOOKED
+              #define STRENGTH 48.0
+              float mod289(float x)  { return x - floor(x / 289.0) * 289.0; }
+              float permute(float x) { return mod289((34.0*x + 1.0) * x); }
+              float rand(float x)    { return fract(x / 41.0); }
+              vec4 hook()  {
+                  vec3 _m = vec3(HOOKED_pos, 0.5) + vec3(1.0);
+                  float h = permute(permute(permute(_m.x)+_m.y)+_m.z);
+                  vec4 noise;
+                  noise.x = rand(h); h = permute(h);
+                  noise.y = rand(h);
+                  return HOOKED_tex(HOOKED_pos) + vec4(STRENGTH/8192.0) * (noise - 0.5);
+              }
+            ''
+          ];
+        };
       };
     };
 

Consider giving Nix/NixOS a try! <3