package: align with nixpkgs version

This is the format we have to use when upstreaming
This commit is contained in:
Jörg Thalheim 2023-09-14 23:00:01 +02:00 committed by mergify[bot]
parent 0ead7a7d6b
commit db969b669d

View File

@ -1,8 +1,9 @@
{ writeShellApplication { stdenv
, openssh , openssh
, gitMinimal , gitMinimal
, rsync , rsync
, nixVersions , nixVersions
, nix
, coreutils , coreutils
, curl , curl
, gnugrep , gnugrep
@ -10,14 +11,15 @@
, findutils , findutils
, gnused , gnused
, lib , lib
, makeWrapper
, mkShellNoCC , mkShellNoCC
}: }:
let let
runtimeInputs = [ runtimeDeps = [
gitMinimal # for git flakes gitMinimal # for git flakes
rsync rsync
# pinned because nix-copy-closure hangs if ControlPath provided for SSH: https://github.com/NixOS/nix/issues/8480 # pinned because nix-copy-closure hangs if ControlPath provided for SSH: https://github.com/NixOS/nix/issues/8480
nixVersions.nix_2_16 (if lib.versionAtLeast nix.version "2.16" then nix else nixVersions.nix_2_16)
coreutils coreutils
curl # when uploading tarballs curl # when uploading tarballs
gnugrep gnugrep
@ -26,18 +28,29 @@ let
gnused # needed by ssh-copy-id gnused # needed by ssh-copy-id
]; ];
in in
(writeShellApplication { stdenv.mkDerivation {
name = "nixos-anywhere"; pname = "nixos-anywhere";
# We prefer the system's openssh over our own, since it might come with features not present in ours: version = "1.0.0";
# https://github.com/numtide/nixos-anywhere/issues/62 src = ./..;
text = '' nativeBuildInputs = [ makeWrapper ];
export PATH=$PATH:${lib.getBin openssh} installPhase = ''
${builtins.readFile ./nixos-anywhere.sh} install -D -m 0755 src/nixos-anywhere.sh $out/bin/nixos-anywhere
# We prefer the system's openssh over our own, since it might come with features not present in ours:
# https://github.com/numtide/nixos-anywhere/issues/62
wrapProgram $out/bin/nixos-anywhere \
--prefix PATH : ${lib.makeBinPath runtimeDeps} --suffix PATH : ${lib.makeBinPath [ openssh ]}
''; '';
inherit runtimeInputs;
}) // {
# Dependencies for our devshell # Dependencies for our devshell
devShell = mkShellNoCC { passthru.devShell = mkShellNoCC {
packages = runtimeInputs ++ [ openssh ]; packages = runtimeDeps ++ [ openssh ];
};
meta = with lib; {
description = "Install nixos everywhere via ssh";
homepage = "https://github.com/numtide/nixos-anywhere";
license = licenses.mit;
platforms = platforms.all;
}; };
} }