commit 53a27e95026ef9f712ec0b047145582d707d8fd4 Author: Dominic Grimm Date: Tue Jul 15 00:07:59 2025 +0200 Init diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0c89fb3 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99be45d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.envrc +.direnv + +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..230ce18 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2c048ab --- /dev/null +++ b/flake.nix @@ -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 = [ ]; + }; + } + ); +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..85813a8 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,11 @@ +{ + pkgs, + ... +}: +let + callPackage = pkgs.callPackage; +in +rec { + kindletool = callPackage ./kindletool.nix { }; + default = kindletool; +} diff --git a/pkgs/kindletool.nix b/pkgs/kindletool.nix new file mode 100644 index 0000000..c182a57 --- /dev/null +++ b/pkgs/kindletool.nix @@ -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"; + }; +})