This commit is contained in:
Dominic Grimm 2025-07-15 00:07:59 +02:00
commit 53a27e9502
Signed by: dergrimm
SSH key fingerprint: SHA256:0uoWpcqOtkyvQ+ZqBjNYiDqIZY+9s8VeZkkJ/4ryB4E
6 changed files with 179 additions and 0 deletions

14
.editorconfig Normal file
View file

@ -0,0 +1,14 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
[*.nix]
indent_style = space
indent_size = 2
[*.{diff,patch}]
trim_trailing_whitespace = false

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
.envrc
.direnv
result

61
flake.lock generated Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1752308619,
"narHash": "sha256-pzrVLKRQNPrii06Rm09Q0i0dq3wt2t2pciT/GNq5EZQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "650e572363c091045cdbc5b36b0f4c1f614d3058",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"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
}

36
flake.nix Normal file
View file

@ -0,0 +1,36 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
flake-utils = {
url = "github:/numtide/flake-utils";
};
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ ];
pkgs = import nixpkgs {
inherit system overlays;
};
packages = import ./pkgs {
inherit pkgs;
};
in
with pkgs;
{
inherit packages;
devShells.default = mkShell {
buildInputs = [ ];
};
}
);
}

11
pkgs/default.nix Normal file
View file

@ -0,0 +1,11 @@
{
pkgs,
...
}:
let
callPackage = pkgs.callPackage;
in
rec {
kindletool = callPackage ./kindletool.nix { };
default = kindletool;
}

53
pkgs/kindletool.nix Normal file
View file

@ -0,0 +1,53 @@
{
lib,
stdenv,
fetchFromGitHub,
pkgs,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "kindletool";
version = "2.6.5-unstable-2025-07-14";
src = fetchFromGitHub {
owner = "NiLuJe";
repo = "KindleTool";
rev = "828bf45bd6010c01fe91bb863bac97ef20cafb44";
hash = "sha256-WWb2N/CRXIiFYG6ZRmcfBowiaSLA7jr9x8Zr13MlY2U=";
};
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
nettle
libarchive
zlib
];
dontConfigure = true;
postPatch = ''
substituteInPlace KindleTool/Makefile \
--replace 'DESTDIR?=/usr/local' "DESTDIR?=$out"
substituteInPlace KindleTool/version.sh \
--replace 'COMPILE_BY="$(whoami | sed 's/\\/\\\\/')"' 'COMPILE_BY="???"' \
--replace 'COMPILE_HOST="$(hostname -s)"' 'COMPILE_HOST="???"' \
--replace 'COMPILE_HOST="$(hostname -s)"' 'COMPILE_HOST="???"'
'';
# installPhase = ''
# mkdir -p $out/bin
# ls -la ./
# touch $out/bin/xx
# '';
meta = with lib; {
description = "A tool for creating & extracting Kindle updates and more";
mainProgram = "kindletool";
license = licenses.gpl3Only;
platforms = platforms.linux;
homepage = "https://github.com/NiLuJe/KindleTool";
};
})