about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/oh-my-posh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/oh-my-posh')
-rw-r--r--nixpkgs/pkgs/development/tools/oh-my-posh/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/oh-my-posh/default.nix b/nixpkgs/pkgs/development/tools/oh-my-posh/default.nix
new file mode 100644
index 000000000000..4e3b56624ccf
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/oh-my-posh/default.nix
@@ -0,0 +1,61 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, installShellFiles
+}:
+
+buildGoModule rec {
+  pname = "oh-my-posh";
+  version = "18.3.3";
+
+  src = fetchFromGitHub {
+    owner = "jandedobbeleer";
+    repo = pname;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-AJw+NNTbksYSW2VqUzxLwxwd3OjM9uK/ou2CVS2zNvw=";
+  };
+
+  vendorHash = "sha256-xkguBWk2Nh8w7C7tKbvaP0tRgZO4z08AEsdjNlJYC6Q=";
+
+  sourceRoot = "${src.name}/src";
+
+  nativeBuildInputs = [
+    installShellFiles
+  ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X github.com/jandedobbeleer/oh-my-posh/src/build.Version=${version}"
+    "-X github.com/jandedobbeleer/oh-my-posh/src/build.Date=1970-01-01T00:00:00Z"
+  ];
+
+  tags = [
+    "netgo"
+    "osusergo"
+    "static_build"
+  ];
+
+  postPatch = ''
+    # these tests requires internet access
+    rm engine/image_test.go engine/migrate_glyphs_test.go
+  '';
+
+  postInstall = ''
+    mv $out/bin/{src,oh-my-posh}
+    mkdir -p $out/share/oh-my-posh
+    cp -r ${src}/themes $out/share/oh-my-posh/
+    installShellCompletion --cmd oh-my-posh \
+      --bash <($out/bin/oh-my-posh completion bash) \
+      --fish <($out/bin/oh-my-posh completion fish) \
+      --zsh <($out/bin/oh-my-posh completion zsh)
+  '';
+
+  meta = with lib; {
+    description = "A prompt theme engine for any shell";
+    homepage = "https://ohmyposh.dev";
+    changelog = "https://github.com/JanDeDobbeleer/oh-my-posh/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ lucperkins urandom ];
+  };
+}