Files
adp-nix-utils/flake.nix
T

42 lines
1.2 KiB
Nix

{
description = "A Collection Of Nix Utilities";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system;};
in
{
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} "$@"
'';
};
});
}