From b471cb403776844f5a07eef46b7b93f1b90c837a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 23 Oct 2024 08:51:04 +0200 Subject: [PATCH] sh-import-id: modernize --- pkgs/by-name/ss/ssh-import-id/package.nix | 63 ++++++++++++++++++++++ pkgs/tools/admin/ssh-import-id/default.nix | 44 --------------- pkgs/top-level/all-packages.nix | 2 - 3 files changed, 63 insertions(+), 46 deletions(-) create mode 100644 pkgs/by-name/ss/ssh-import-id/package.nix delete mode 100644 pkgs/tools/admin/ssh-import-id/default.nix diff --git a/pkgs/by-name/ss/ssh-import-id/package.nix b/pkgs/by-name/ss/ssh-import-id/package.nix new file mode 100644 index 0000000000000..5f2c2531774da --- /dev/null +++ b/pkgs/by-name/ss/ssh-import-id/package.nix @@ -0,0 +1,63 @@ +{ + lib, + extraHandlers ? [ ], + fetchgit, + installShellFiles, + makeWrapper, + python3Packages, +}: + +python3Packages.buildPythonApplication rec { + pname = "ssh-import-id"; + version = "5.11"; + pyproject = true; + + src = fetchgit { + url = "https://git.launchpad.net/ssh-import-id"; + rev = "refs/tags/${version}"; + hash = "sha256-tYbaJGH59qyvjp4kwo3ZFVs0EaE0Lsd2CQ6iraFkAdI="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "long_description_content_type='markdown'" "long_description_content_type='text/markdown'" + ''; + + build-system = with python3Packages; [ setuptools ]; + + nativeBuildInputs = [ + makeWrapper + installShellFiles + ]; + + dependencies = + with python3Packages; + [ + requests + distro + ] + ++ extraHandlers; + + postInstall = '' + installManPage $src/usr/share/man/man1/ssh-import-id.1 + ''; + + # Handlers require main bin, main bin requires handlers + makeWrapperArgs = [ + "--prefix" + ":" + "$out/bin" + ]; + + meta = with lib; { + description = "Retrieves an SSH public key and installs it locally"; + homepage = "https://launchpad.net/ssh-import-id"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ + mkg20001 + viraptor + ]; + mainProgram = "ssh-import-id"; + platforms = platforms.unix; + }; +} diff --git a/pkgs/tools/admin/ssh-import-id/default.nix b/pkgs/tools/admin/ssh-import-id/default.nix deleted file mode 100644 index e4202033b99cb..0000000000000 --- a/pkgs/tools/admin/ssh-import-id/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ buildPythonPackage -, lib -, fetchgit -, requests -, distro -, makeWrapper -, installShellFiles -, extraHandlers ? [] -}: - -buildPythonPackage rec { - pname = "ssh-import-id"; - version = "5.11"; - - src = fetchgit { - url = "https://git.launchpad.net/ssh-import-id"; - rev = version; - sha256 = "sha256-tYbaJGH59qyvjp4kwo3ZFVs0EaE0Lsd2CQ6iraFkAdI="; - }; - - propagatedBuildInputs = [ - requests - distro - ] ++ extraHandlers; - - nativeBuildInputs = [ - makeWrapper - installShellFiles - ]; - - postInstall = '' - installManPage $src/usr/share/man/man1/ssh-import-id.1 - ''; - - # handlers require main bin, main bin requires handlers - makeWrapperArgs = [ "--prefix" ":" "$out/bin" ]; - - meta = with lib; { - description = "Retrieves an SSH public key and installs it locally"; - license = licenses.gpl3; - maintainers = with maintainers; [ mkg20001 viraptor ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 68d3c47aac5e6..5c3586cf7f750 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3836,8 +3836,6 @@ with pkgs; ssh-agents = callPackage ../tools/networking/ssh-agents { }; - ssh-import-id = python3Packages.callPackage ../tools/admin/ssh-import-id { }; - ssh-key-confirmer = callPackage ../tools/networking/ssh-key-confirmer { }; ssh-mitm = callPackage ../tools/security/ssh-mitm { };