add dnote

This commit is contained in:
Joakim Repomaa
2025-02-13 16:03:10 +02:00
parent ddc6e6d575
commit 1cf3c7d8dd
10 changed files with 211 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
{ config, lib, pkgs, inputs, ... }:
{
nixpkgs.config.allowUnfree = true;
imports = [ ../gnome ../custom-programs ./neovim ];
imports = [ ../gnome ../custom-programs ./neovim ./dnote.nix ];
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
@@ -72,6 +72,7 @@
enable = true;
flake = "/etc/nixos";
};
dnote.enable = true;
home-manager.enable = true;
bat = {
enable = true;

35
home/common/dnote.nix Normal file
View File

@@ -0,0 +1,35 @@
{ inputs, lib, pkgs, config, ... }:
let
completion = pkgs.stdenv.mkDerivation {
name = "dnote-completion";
phases = [ "unpackPhase" "installPhase" ];
src = inputs.dnote;
installPhase = ''
mkdir -p $out/lib/dnote/zsh-completion/completions
cp pkg/cli/dnote-completion.zsh $out/lib/dnote/zsh-completion/completions/_dnote
'';
};
client = pkgs.stdenv.mkDerivation {
name = "dnote-client";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp ${unstablePkgs.dnote}/bin/dnote-cli $out/bin/dnote
'';
};
cfg = config.programs.dnote;
unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system};
in
{
options.programs.dnote = {
enable = pkgs.lib.mkEnableOption "Enable dnote";
};
config = lib.mkIf cfg.enable {
home.packages = [ client ];
home.shellAliases.dn = "dnote";
programs.zsh.initExtra = ''
fpath=(${completion}/lib/dnote/zsh-completion/completions $fpath)
'';
};
}