From 52cad660835c18f4b4c307d369f7e9680fd3a9bf Mon Sep 17 00:00:00 2001 From: didier amyot Date: Sun, 30 Apr 2023 08:50:24 -0400 Subject: [PATCH] Moved 2 functions from different repo to this util library --- flake.nix | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..12ad54f --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "A Collection Of Nix Utilities"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: { + writePythonApplication = {name, contentFile}: let + wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); + in + pkgs.writeShellApplication { + name = name; + runtimeInputs = [ + wrappedScript + pkgs.python311]; + text = '' + exec ${pkgs.python38}/bin/python ${wrappedScript} "$@" + ''; + }; + + writeBabashkaApplication = {name, contentFile}: let + wrappedScript = pkgs.writeText "wrappedScript" (builtins.readFile contentFile); + in + pkgs.writeShellApplication { + name = name; + runtimeInputs = [ + wrappedScript + pkgs.babashka]; + text = '' + exec ${pkgs.babashka}/bin/bb ${wrappedScript} "$@" + ''; + }; + }; +}