about summary refs log tree commit diff
path: root/packages
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
committerAzat Bahawi <azat@bahawi.net>2023-11-19 21:58:34 +0300
commitedf7cc355cb1f55a9301283ebec15e01dc4ffe62 (patch)
treebf7745040efadac618168b7a9a764acb482acb07 /packages
parent2023-11-16 (diff)
2023-11-19
Diffstat (limited to 'packages')
-rw-r--r--packages/bruh.nix1
-rw-r--r--packages/emacsql-sqlite.nix35
-rw-r--r--packages/mpv-autosub.nix46
-rw-r--r--packages/myip.nix1
-rw-r--r--packages/nixfiles.nix9
5 files changed, 42 insertions, 50 deletions
diff --git a/packages/bruh.nix b/packages/bruh.nix
index bad8aa0..b41ecdb 100644
--- a/packages/bruh.nix
+++ b/packages/bruh.nix
@@ -29,5 +29,6 @@ stdenv.mkDerivation (finalAttrs: {
     license = licenses.gpl3Only;
     platforms = platforms.linux;
     maintainers = with maintainers; [azahi];
+    mainProgram = "bruh";
   };
 })
diff --git a/packages/emacsql-sqlite.nix b/packages/emacsql-sqlite.nix
new file mode 100644
index 0000000..3329e08
--- /dev/null
+++ b/packages/emacsql-sqlite.nix
@@ -0,0 +1,35 @@
+{
+  fetchFromGitHub,
+  lib,
+  stdenv,
+}:
+stdenv.mkDerivation (finalAttrs: {
+  pname = "emacsql-sqlite";
+  version = "3.1.1";
+
+  src = fetchFromGitHub {
+    owner = "magit";
+    repo = "emacsql";
+    rev = finalAttrs.version;
+    hash = "sha256-b/QEpWMTyVOdkOEhPNJ0x8ukUy9Gc9gYGjnlh0WU9fY=";
+  };
+
+  sourceRoot = "source/sqlite";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 -t $out/bin ${finalAttrs.meta.mainProgram}
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "SQLite interop binary for emacsql-sqlite";
+    inherit (finalAttrs.src.meta) homepage;
+    license = licenses.unlicense;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [azahi];
+    mainProgram = "emacsql-sqlite";
+  };
+})
diff --git a/packages/mpv-autosub.nix b/packages/mpv-autosub.nix
deleted file mode 100644
index e3fc221..0000000
--- a/packages/mpv-autosub.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-  fetchFromGitHub,
-  lib,
-  mpv-unwrapped,
-  python3Packages,
-  stdenvNoCC,
-}:
-stdenvNoCC.mkDerivation (finalAttrs: {
-  pname = "mpv-autosub";
-  version = "unstable-2021-06-29";
-
-  src = fetchFromGitHub {
-    owner = "davidde";
-    repo = finalAttrs.pname;
-    rev = "35115355bd339681f97d067538356c29e5b14afa";
-    hash = "sha256-BKT/Tzwl5ZA4fbdc/cxz0+CYc1zyY/KOXc58x5GYow0=";
-  };
-
-  postPatch = ''
-    substituteInPlace autosub.lua \
-      --replace '/home/david/.local/bin/subliminal' '${python3Packages.subliminal}/bin/subliminal' \
-      --replace "'Dutch', 'nl', 'dut'" "'Russian', 'ru', 'rus'" \
-      --replace "'tta'" "'tta', 'webm'" \
-      --replace "disabled for audio files" "disabled for this filetype"
-
-    sed -iE '/.*add_key_binding.*/d' autosub.lua
-  '';
-
-  installPhase = ''
-    runHook preInstall
-
-    install -Dm644 autosub.lua $out/share/mpv/scripts/autosub.lua
-
-    runHook postInstall
-  '';
-
-  passthru.scriptName = "autosub.lua";
-
-  meta = with lib; {
-    description = "Automatic downloading of subtitles for MPV";
-    inherit (finalAttrs.src.meta) homepage;
-    license = licenses.mit;
-    inherit (mpv-unwrapped.meta) platforms;
-    maintainers = with maintainers; [azahi];
-  };
-})
diff --git a/packages/myip.nix b/packages/myip.nix
index f91872b..59a02ee 100644
--- a/packages/myip.nix
+++ b/packages/myip.nix
@@ -19,5 +19,6 @@ writeShellApplication {
     license = licenses.wtfpl;
     platforms = platforms.unix;
     maintainers = with maintainers; [azahi];
+    mainProgram = "myip";
   };
 }
diff --git a/packages/nixfiles.nix b/packages/nixfiles.nix
index 782a193..02e89f2 100644
--- a/packages/nixfiles.nix
+++ b/packages/nixfiles.nix
@@ -25,7 +25,7 @@
     # Shamelessly appropriated from https://github.com/ncfavier/config.
     # Hopefully Naïm will not sue me for copyright infrigment.
     text = ''
-      nixfiles="''${NIXFILES:-$HOME/src/nixfiles}"
+      nixfiles="''${NIXFILES:-.}"
       cmd=$1
       shift
       case $cmd in
@@ -108,10 +108,10 @@
               # Assumes that hosts are configured in the OpenSSH configuration.
               host=''${cmd#@}
               hostname=$(ssh -q "$host" 'echo "$HOSTNAME"')
-              exec nixos-rebuild -v --flake ".#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@"
+              exec nixos-rebuild -v --flake "$nixfiles#$hostname" --target-host "$host" --use-remote-sudo --show-trace "$@"
               ;;
           *)
-              exec nixos-rebuild -v --fast --flake "." --use-remote-sudo --show-trace "$cmd" "$@"
+              exec nixos-rebuild -v --fast --flake "$nixfiles" --use-remote-sudo --show-trace "$cmd" "$@"
               ;;
       esac
     '';
@@ -134,7 +134,7 @@
     }
     _nixfiles() {
         local cur prev words cword
-        local nixfiles="''${NIXFILES:-$HOME/src/nixfiles}"
+        local nixfiles="''${NIXFILES:-.}"
         _init_completion -n ':=&'
         if [[ "$cword" == 1 ]] || [[ "$cword" == 2 && "$prev" == @* ]]; then
             if [[ $cur == @* ]]; then
@@ -180,5 +180,6 @@ in
       license = licenses.wtfpl;
       platforms = platforms.unix;
       maintainers = with maintainers; [azahi];
+      mainProgram = "nixfiles";
     };
   }

Consider giving Nix/NixOS a try! <3