From bff05b9ecf304596318adb23716a3ea75044dfe9 Mon Sep 17 00:00:00 2001 From: voidarc Date: Fri, 26 Jun 2026 19:06:55 +0100 Subject: [PATCH] added flake --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a972dc4 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1782467914, + "narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e73de5be04e0eff4190a1432b946d469c794e7b4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1959d4f --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "A Nix flake to run a Python script with exiftool"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + utils, + }: + utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + + # 1. Define Python with the required pyexiftool library + myPython = pkgs.python3.withPackages (ps: [ + ps.pyexiftool + ]); + + # 2. Create a wrapper script that runs your python file with the correct PATH + runScript = pkgs.writeShellScriptBin "run-python-script" '' + export PATH="${pkgs.exiftool}/bin:$PATH" + exec ${myPython}/bin/python ./translate.py "$@" + ''; + in + { + # This allows you to run: nix run + apps.default = { + type = "app"; + program = "${runScript}/bin/run-python-script"; + }; + + } + ); +}