Skip to content

Commit

Permalink
feat(nix): command completions + flakes support
Browse files Browse the repository at this point in the history
  • Loading branch information
luisnquin committed Sep 2, 2023
1 parent c0f45f1 commit c193b55
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 14 deletions.
52 changes: 38 additions & 14 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
{}: let
pkgs = import <nixpkgs> {};
in
pkgs.buildGoModule rec {
pname = "nao";
version = "3.0.0";
src = ./.;
buildTarget = "./cmd/nao";

vendorSha256 = "sha256-sDLbIHeY2Jdos8pgRaR6vbjwRPunAukasKz0m7sMIek=";

doCheck = false;
ldflags = ["-X main.version=${version}"];
}
{
installShellFiles,
buildGoModule,
lib,
}:
buildGoModule rec {
pname = "nao";
version = "3.2.2";

src = builtins.path {
name = "nao";
path = ./.;
};

vendorSha256 = "sha256-MTVJWksGWva+Xet+T2aIOXzkxB7w9raJVwa/p1bwkOo=";
doCheck = false;

buildTarget = "./cmd/nao";
ldflags = ["-X main.version=${version}"];

nativeBuildInputs = [
installShellFiles
];

postInstall = ''
installShellCompletion --cmd nao \
--bash <($out/bin/nao --debug completion bash) \
--fish <($out/bin/nao --debug completion fish) \
--zsh <($out/bin/nao --debug completion zsh)
'';

meta = with lib; {
description = "A CLI tool to take notes without worrying about the path where the file is";
homepage = "https://github.com/luisnquin/nao";
license = licenses.mit;
maintainers = with maintainers; [luisnquin];
};
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
description = "A CLI tool to take notes without worrying about the path where the file is";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = inputs:
with inputs;
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
};

defaultPackage = pkgs.callPackage ./default.nix {};
in {
inherit defaultPackage;

defaultApp = flake-utils.lib.mkApp {
drv = defaultPackage;
};

devShell = pkgs.mkShell {
buildInputs = [defaultPackage];
};
}
);
}

0 comments on commit c193b55

Please sign in to comment.