From d1589acd8a8765e498f43f0e027d4a9e2057b472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Kurucz?= Date: Sat, 30 Nov 2024 21:15:14 +0100 Subject: [PATCH] lsb-release: rewrite with `replaceVars`, and use `@runtimeShell@` --- pkgs/by-name/ls/lsb-release/lsb_release.sh | 2 +- pkgs/by-name/ls/lsb-release/package.nix | 44 ++++++++++++---------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/ls/lsb-release/lsb_release.sh b/pkgs/by-name/ls/lsb-release/lsb_release.sh index ae524181e88a6..2031efc8b654d 100644 --- a/pkgs/by-name/ls/lsb-release/lsb_release.sh +++ b/pkgs/by-name/ls/lsb-release/lsb_release.sh @@ -1,4 +1,4 @@ -#! @shell@ +#! @runtimeShell@ set -o errexit set -o nounset diff --git a/pkgs/by-name/ls/lsb-release/package.nix b/pkgs/by-name/ls/lsb-release/package.nix index f79c6527539ab..6973d50e99aa9 100644 --- a/pkgs/by-name/ls/lsb-release/package.nix +++ b/pkgs/by-name/ls/lsb-release/package.nix @@ -1,22 +1,26 @@ -{ substituteAll, lib -, coreutils, getopt +{ + replaceVars, + runCommand, + lib, + runtimeShell, + coreutils, + getopt, }: -substituteAll { - name = "lsb_release"; - - src = ./lsb_release.sh; - - dir = "bin"; - isExecutable = true; - - inherit coreutils getopt; - - meta = with lib; { - description = "Prints certain LSB (Linux Standard Base) and Distribution information"; - mainProgram = "lsb_release"; - license = [ licenses.mit ]; - maintainers = with maintainers; [ primeos ]; - platforms = platforms.linux; - }; -} +runCommand "lsb_release" + { + meta = with lib; { + description = "Prints certain LSB (Linux Standard Base) and Distribution information"; + mainProgram = "lsb_release"; + license = [ licenses.mit ]; + maintainers = with maintainers; [ primeos ]; + platforms = platforms.linux; + }; + } + '' + install -Dm 555 ${ + replaceVars ./lsb_release.sh { + inherit runtimeShell coreutils getopt; + } + } $out/bin/lsb_release + ''