about summary refs log tree commit diff
path: root/pkgs/tools/wayland
diff options
context:
space:
mode:
authorVladimir Serov <me@cab404.ru>2021-03-22 10:08:26 +0300
committerVladimir Serov <me@cab404.ru>2021-03-24 14:55:46 +0300
commited94d899672e43177404a340888cda39b4efdea7 (patch)
tree10e617902d95761c0f6f42d2da3846dfd5af4e0e /pkgs/tools/wayland
parent5bc2358f4b7fbc619169f59264ae69d10c162699 (diff)
swaycwd: init at 0.0.1
Co-authored-by: zseri <zseri.devel@ytrizja.de>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/tools/wayland')
-rw-r--r--pkgs/tools/wayland/swaycwd/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/pkgs/tools/wayland/swaycwd/default.nix b/pkgs/tools/wayland/swaycwd/default.nix
new file mode 100644
index 0000000000000..36e223f8d4ca6
--- /dev/null
+++ b/pkgs/tools/wayland/swaycwd/default.nix
@@ -0,0 +1,45 @@
+{ lib, nim, stdenv, fetchFromGitLab
+, enableShells ? [ "bash" "zsh" "fish" "sh" "posh" ]
+}:
+
+stdenv.mkDerivation {
+    name = "swaycwd";
+    version = "0.0.1";
+
+    src = fetchFromGitLab {
+      owner = "cab404";
+      repo = "swaycwd";
+      rev = "aca81695ec2102b9bca6f5bae364f69a8b9d399f";
+      hash = "sha256-MkyY3wWByQo0l0J28xKDfGtxfazVPRyZHCObl9Fszh4=";
+    };
+
+    configurePhase = ''
+      runHook preConfigure
+      {
+        echo 'let enabledShells: seq[string] = @${builtins.toJSON enableShells}'
+        echo 'export enabledShells'
+      } > shells.nim
+      runHook postConfigure
+    '';
+
+    nativeBuildInputs = [ nim ];
+
+    buildPhase = ''
+      export HOME=$TMPDIR
+      nim c --opt:speed -d:release swaycwd.nim
+    '';
+
+    installPhase = ''
+      runHook preInstall
+      install -D -m555 -t $out/bin swaycwd
+      runHook postInstall
+    '';
+
+    meta = with lib; {
+      homepage = "https://gitlab.com/cab404/swaycwd";
+      description = "Returns cwd for shell in currently focused sway window, or home directory if cannot find shell";
+      maintainers = with maintainers; [ cab404 ];
+      platforms = platforms.linux;
+      license = licenses.gpl3Only;
+    };
+}