{ 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"; }; } ); }