mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
nix: patch tokei with hledger support
This commit is contained in:
parent
35f5abe654
commit
482252d6a0
3 changed files with 46 additions and 1 deletions
43
nix/custom/tokei/default.nix
Normal file
43
nix/custom/tokei/default.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
rustPlatform,
|
||||
libiconv,
|
||||
darwin,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "tokei";
|
||||
version = "13.0.0-alpha.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "XAMPPRocky";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
hash = "sha256-oKgTBfwOAP4fJzgN8NBR0KcuVD0caa9Qf3dkCb0zUR8=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-NE6hw6rgSDOsmSD6JpOfBLgGKGPfPmHjpMIsqLOkH7M=";
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "typst.patch";
|
||||
url = "https://github.com/XAMPPRocky/tokei/commit/bb911d457d18309c88786ab722d057eeebc5522d.patch";
|
||||
hash = "sha256-gBqOOp3zZcL0SosiVtjnyWJwwLgi/ECiiyelp0rL7+g=";
|
||||
})
|
||||
./hledger.patch
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals stdenv.isDarwin [
|
||||
libiconv
|
||||
darwin.Security
|
||||
];
|
||||
|
||||
checkInputs = lib.optionals stdenv.isDarwin [ zlib ];
|
||||
|
||||
# enable all output formats
|
||||
buildFeatures = [ "all" ];
|
||||
}
|
||||
42
nix/custom/tokei/hledger.patch
Normal file
42
nix/custom/tokei/hledger.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
diff --git a/languages.json b/languages.json
|
||||
index ac548b9..b2899f1 100644
|
||||
--- a/languages.json
|
||||
+++ b/languages.json
|
||||
@@ -846,6 +846,13 @@
|
||||
"nested": true,
|
||||
"extensions": ["lean", "hlean"]
|
||||
},
|
||||
+ "Hledger": {
|
||||
+ "name": "hledger",
|
||||
+ "line_comment": [";", "#"],
|
||||
+ "multi_line_comments": [["comment", "end comment"]],
|
||||
+ "nested": false,
|
||||
+ "extensions": ["hledger"]
|
||||
+ },
|
||||
"Less": {
|
||||
"name": "LESS",
|
||||
"line_comment": ["//"],
|
||||
diff --git a/tests/data/hledger.hledger b/tests/data/hledger.hledger
|
||||
new file mode 100644
|
||||
index 0000000..df7259d
|
||||
--- /dev/null
|
||||
+++ b/tests/data/hledger.hledger
|
||||
@@ -0,0 +1,18 @@
|
||||
+# 18 lines 6 code 10 comments 2 blanks
|
||||
+# a comment
|
||||
+; another comment
|
||||
+
|
||||
+; ^ a blank line
|
||||
+comment
|
||||
+account assets ; Declare valid account names and display order.
|
||||
+a block comment
|
||||
+end comment
|
||||
+
|
||||
+account assets:savings ; A subaccount. This one represents a bank account.
|
||||
+account assets:checking ; Another. Note, 2+ spaces after the account name.
|
||||
+account assets:receivable ; Accounting type is inferred from english names,
|
||||
+account passifs ; or declared with a "type" tag, type:L
|
||||
+account expenses ; type:X
|
||||
+ ; A follow-on comment line, indented.
|
||||
+account expenses:rent ; Expense and revenue categories are also accounts.
|
||||
+ ; Subaccounts inherit their parent's type.
|
||||
Loading…
Add table
Add a link
Reference in a new issue