mirror of
https://github.com/nix-community/nixos-anywhere.git
synced 2024-10-05 20:27:20 +03:00
Use writeShellApplication for packaging
This commit is contained in:
parent
28ce0f04e5
commit
52e7ab3910
@ -24,7 +24,7 @@
|
||||
{
|
||||
default = self.packages.${system}.nixos-remote;
|
||||
docs = pkgs.callPackage ./docs { };
|
||||
nixos-remote = pkgs.callPackage ./nixos-remote.nix { };
|
||||
nixos-remote = pkgs.callPackage ./src { };
|
||||
});
|
||||
checks.x86_64-linux =
|
||||
let
|
||||
@ -32,6 +32,7 @@
|
||||
inputs = {
|
||||
inherit pkgs;
|
||||
inherit (disko.nixosModules) disko;
|
||||
nixos-remote = self.packages.x86_64-linux.nixos-remote;
|
||||
kexec-installer = "${nixos-images.packages.${pkgs.system}.kexec-installer-nixos-unstable}/nixos-kexec-installer-${pkgs.stdenv.hostPlatform.system}.tar.gz";
|
||||
};
|
||||
in
|
||||
|
@ -1,39 +0,0 @@
|
||||
{ stdenvNoCC
|
||||
, makeWrapper
|
||||
, lib
|
||||
, openssh
|
||||
, gitMinimal
|
||||
, nix
|
||||
, coreutils
|
||||
, shellcheck
|
||||
, rsync
|
||||
, curl
|
||||
}:
|
||||
let
|
||||
runtimeDeps = [
|
||||
openssh
|
||||
gitMinimal # for git flakes
|
||||
rsync
|
||||
nix
|
||||
coreutils
|
||||
curl # when uploading tarballs
|
||||
];
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nixos-remote";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
shellcheck
|
||||
];
|
||||
installPhase = ''
|
||||
install -D -m755 nixos-remote $out/bin/nixos-remote
|
||||
wrapProgram "$out/bin/nixos-remote" \
|
||||
--prefix PATH : "${lib.makeBinPath runtimeDeps}"
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = ''
|
||||
shellcheck ./nixos-remote
|
||||
'';
|
||||
}
|
20
src/default.nix
Normal file
20
src/default.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{ writeShellApplication
|
||||
, openssh
|
||||
, gitMinimal
|
||||
, rsync
|
||||
, nix
|
||||
, coreutils
|
||||
, curl
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "nixos-remote";
|
||||
text = builtins.readFile ./nixos-remote.sh;
|
||||
runtimeInputs = [
|
||||
openssh
|
||||
gitMinimal # for git flakes
|
||||
rsync
|
||||
nix
|
||||
coreutils
|
||||
curl # when uploading tarballs
|
||||
];
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eufo pipefail
|
||||
|
||||
showUsage() {
|
||||
cat <<USAGE
|
||||
Usage: nixos-remote [options] ssh-host
|
@ -8,7 +8,7 @@
|
||||
start_all()
|
||||
installer.succeed("echo super-secret > /tmp/disk-1.key")
|
||||
output = installer.succeed("""
|
||||
${../nixos-remote} \
|
||||
nixos-remote \
|
||||
--no-ssh-copy-id \
|
||||
--debug \
|
||||
--kexec /etc/nixos-remote/kexec-installer \
|
||||
|
@ -18,7 +18,7 @@
|
||||
installer.succeed("mkdir -p /tmp/extra-files/var/lib/secrets")
|
||||
installer.succeed("echo value > /tmp/extra-files/var/lib/secrets/key")
|
||||
installer.succeed("""
|
||||
${../nixos-remote} \
|
||||
nixos-remote \
|
||||
--no-ssh-copy-id \
|
||||
--debug \
|
||||
--kexec /etc/nixos-remote/kexec-installer \
|
||||
|
@ -12,6 +12,8 @@ in
|
||||
${pkgs.coreutils}/bin/install -D -m600 ${./ssh-keys/ssh} /root/.ssh/id_rsa
|
||||
'';
|
||||
|
||||
environment.systemPackages = [ inputs.nixos-remote ];
|
||||
|
||||
environment.etc = {
|
||||
"nixos-remote/disko".source = system-to-install.config.system.build.disko;
|
||||
"nixos-remote/system-to-install".source = system-to-install.config.system.build.toplevel;
|
||||
|
Loading…
Reference in New Issue
Block a user