added flake

This commit is contained in:
2026-06-26 19:06:55 +01:00
parent e67cb14580
commit bff05b9ecf
2 changed files with 101 additions and 0 deletions

40
flake.nix Normal file
View File

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