mirror of
https://github.com/nadrad/h-m-m.git
synced 2026-03-13 20:25:45 +01:00
commit
a797656673
4 changed files with 163 additions and 0 deletions
34
default.nix
Normal file
34
default.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib, version ? null, ... }:
|
||||
let
|
||||
wl-copy = lib.getExe' pkgs.wl-clipboard "wl-copy";
|
||||
wl-paste = lib.getExe' pkgs.wl-clipboard "wl-paste";
|
||||
xclip = lib.getExe pkgs.xclip;
|
||||
php = lib.getExe pkgs.php;
|
||||
replaces = {
|
||||
"#!/usr/bin/env php" = "#!/usr/bin/env ${php}";
|
||||
"$tool = basename($result[0] ?? '');" = /* php */ ''
|
||||
if (getenv("XDG_SESSION_TYPE") == "wayland") {
|
||||
$tool = "wl-copy";
|
||||
} else {
|
||||
$tool = "xclip";
|
||||
}
|
||||
'';
|
||||
"= 'xclip" = "= '${xclip}";
|
||||
"= 'wl-copy" = "= '${wl-copy}";
|
||||
"= 'wl-paste" = "= '${wl-paste}";
|
||||
};
|
||||
script = pkgs.writeScriptBin "h-m-m" (let
|
||||
prevScript = lib.fileContents ./h-m-m;
|
||||
in if pkgs.stdenv.isDarwin then
|
||||
lib.replaceStrings [ "#!/usr/bin/env php" ] [ "#!/usr/bin/env ${php}" ] prevScript
|
||||
else
|
||||
lib.replaceStrings (lib.attrNames replaces) (lib.attrValues replaces) prevScript);
|
||||
in script // lib.optionals (!isNull version) {
|
||||
inherit version;
|
||||
} // {
|
||||
meta = script.meta // {
|
||||
description = "h-m-m is a keyboard-centric terminal-based tool for working with mind maps.";
|
||||
homepage = "https://github.com/nadrad/h-m-m";
|
||||
license = lib.licenses.gpl3;
|
||||
};
|
||||
}
|
||||
43
flake.lock
generated
Normal file
43
flake.lock
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1744502386,
|
||||
"narHash": "sha256-QAd1L37eU7ktL2WeLLLTmI6P9moz9+a/ONO8qNBYJgM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f6db44a8daa59c40ae41ba6e5823ec77fe0d2124",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
26
flake.nix
Normal file
26
flake.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
description = "A very basic flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, systems, ... }: let
|
||||
eachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
version = let
|
||||
rev = self.shortRev or self.dirtyShortRev or self.lastModified or null;
|
||||
in if isNull rev then null else "r${toString rev}";
|
||||
in {
|
||||
packages = eachSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
h-m-m = pkgs.callPackage ./. { inherit version; };
|
||||
default = self.packages.${system}.h-m-m;
|
||||
});
|
||||
overlays.h-m-m = self: super: {
|
||||
h-m-m = self.callPackage ./. { inherit version; };
|
||||
};
|
||||
overlays.default = self.overlays.h-m-m;
|
||||
};
|
||||
}
|
||||
60
readme.md
60
readme.md
|
|
@ -335,6 +335,66 @@ docker run --rm -it -v $(pwd):/app/ -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=
|
|||
alias hmm='docker run --rm -it -v $(pwd):/app/ -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY hmm'
|
||||
```
|
||||
|
||||
## 5. Installation with Nix/NixOS
|
||||
<details>
|
||||
<summary>with flakes (NixOS)</summary>
|
||||
|
||||
Below is a fragment of a NixOS configuration that add h-m-m to system packages.
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "Simple NixOS configurations";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
h-m-m = {
|
||||
url = "github:nadrad/h-m-m";
|
||||
# Optional but recommended to limit the size of your system closure.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { nixpkgs, h-m-m, ... }: {
|
||||
nixosConfigurations = {
|
||||
yourHost = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
# ...
|
||||
{
|
||||
nixpkgs.overlays = [ h-m-m.overlays.default ];
|
||||
}
|
||||
# add h-m-m to your system
|
||||
({ pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.h-m-m ];
|
||||
});
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>with <code>nix profile</code></summary>
|
||||
|
||||
You can also install it using the imperative method
|
||||
|
||||
```sh
|
||||
$ nix profile install github:nadrad/h-m-m
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>with <code>nix shell</code> / <code>nix run</code></summary>
|
||||
|
||||
If you don't want to install it on your system, you can try it with nix run or nix shell.
|
||||
|
||||
```sh
|
||||
$ nix run github:nadrad/h-m-m -- <args>
|
||||
# or
|
||||
$ nix shell github:nadrad/h-m-m
|
||||
$ h-m-m <args>
|
||||
```
|
||||
</details>
|
||||
|
||||
# Feedback
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue