summaryrefslogtreecommitdiff
path: root/pkgs/cscript
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-11-16 12:14:45 +0100
committerLinnnus <[email protected]>2024-11-16 12:14:45 +0100
commite89335c5f59963d902ac35df6ad9e3bac1040195 (patch)
treeff0d79f75ae9b96593580be7a69fff58cd927790 /pkgs/cscript
parente396c06c4c2b9f8d47162dcd20155ec09163cb3b (diff)
cscript: Add interpreter passthru attributes
Diffstat (limited to 'pkgs/cscript')
-rw-r--r--pkgs/cscript/default.nix53
1 files changed, 31 insertions, 22 deletions
diff --git a/pkgs/cscript/default.nix b/pkgs/cscript/default.nix
index 8c6faae..602bbe7 100644
--- a/pkgs/cscript/default.nix
+++ b/pkgs/cscript/default.nix
@@ -2,29 +2,38 @@
stdenv,
lib,
fetchFromGitHub,
-}:
-stdenv.mkDerivation rec {
- pname = "cscript";
- version = "16-11-2024"; # Date of latest commit.
+}: let
+ self = stdenv.mkDerivation rec {
+ pname = "cscript";
+ version = "16-11-2024"; # Date of latest commit.
- src = fetchFromGitHub {
- owner = "linnnus";
- repo = pname;
- rev = "855f35a4e6d5046000a1d9ff7b887ccd7c4a8c91";
- hash = "sha256-d722f3K3QXnPqDVNVGBK+mj6Bl1VNShmJ4WICj0p64s=";
- };
+ src = fetchFromGitHub {
+ owner = "linnnus";
+ repo = pname;
+ rev = "855f35a4e6d5046000a1d9ff7b887ccd7c4a8c91";
+ hash = "sha256-d722f3K3QXnPqDVNVGBK+mj6Bl1VNShmJ4WICj0p64s=";
+ };
+
+ preInstall = "mkdir -p $out/bin";
+ makeFlags = ["INSTALL=$(out)/bin"];
- preInstall = "mkdir -p $out/bin";
- makeFlags = ["INSTALL=$(out)/bin"];
+ passthru = rec {
+ # Mimic Python's interpreter attributes.
+ # See: https://nixos.org/manual/nixpkgs/stable/#attributes-on-interpreters-packages
+ executable = "cscript";
+ interpreter = "${self}/bin/${executable}";
+ };
- meta = with lib; {
- description = "My take on the native shebang programming task from Rosetta Code";
- longDescription = ''
- This package contains a C "interpreter". Behind the scenes it actually
- compiles the file and runs it immediately, so it's not really an
- interpreter. Point is, it allows you to use a shebang (just like
- `#!/bin/sh`) to write C programs that execute like a Bash scripts.
- '';
- license = licenses.unlicense;
+ meta = with lib; {
+ description = "My take on the native shebang programming task from Rosetta Code";
+ longDescription = ''
+ This package contains a C "interpreter". Behind the scenes it actually
+ compiles the file and runs it immediately, so it's not really an
+ interpreter. Point is, it allows you to use a shebang (just like
+ `#!/bin/sh`) to write C programs that execute like a Bash scripts.
+ '';
+ license = licenses.unlicense;
+ };
};
-}
+in
+ self