Skip to content

Commit

Permalink
google-compute-configs: init at 20211128.00
Browse files Browse the repository at this point in the history
  • Loading branch information
picnoir committed Nov 5, 2021
1 parent 2128f17 commit 60d8f39
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
57 changes: 57 additions & 0 deletions pkgs/tools/virtualization/google-compute-guest-configs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{ stdenv, lib, util-linux, fetchFromGitHub, bash, coreutils, ethtool, gnugrep, makeWrapper }:
let
version = "20211028.00";
in stdenv.mkDerivation {
inherit version;
pname = "guest-configs";

src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = "guest-configs";
rev = version;
sha256 = "sha256-0SRu6p/DsHNNI20mkXJitt/Ee5S2ooiy5hNmD+ndecM=";
};

nativeBuildInputs = [ makeWrapper ];

dontConfigure = true;
dontBuild = true;

installPhase = ''
runHook preInstall
mkdir -p $out/lib/udev $out/bin
# allows to install the package in `services.udev.packages` in NixOS
cp -r "src/lib/udev/rules.d" $out/lib/udev
cp "src/lib/udev/google_nvme_id" $out/bin
cp "src/usr/bin/google_set_multiqueue" $out/bin
# sysctl snippets will be used by google-compute-config.nix
cp -r "src/etc/sysctl.d" $out
runHook postInstall
'';

preFixup = ''
wrapProgram $out/bin/google_set_multiqueue \
--prefix "PATH" ":" "${lib.makeBinPath [ coreutils ethtool gnugrep ]}"
for rules in $out/lib/udev/*.rules; do
substituteInPlace "$rules" \
--replace /bin/sh "${bash}/bin/bash" \
--replace /bin/umount "${util-linux}/bin/umount" \
--replace /usr/bin/logger "${util-linux}/bin/logger"
done
patchShebangs $out/bin/*
'';

meta = with lib; {
description = "Linux Guest Environment for Google Compute Engine";
homepage = "https://github.com/GoogleCloudPlatform/guest-configs";
license = licenses.asl20;
maintainers = with maintainers; [ mrkkrp ];
platforms = platforms.linux;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5831,6 +5831,8 @@ with pkgs;

google-compute-guest-agent = callPackage ../tools/virtualization/google-compute-guest-agent { };

google-compute-guest-configs = callPackage ../tools/virtualization/google-compute-guest-configs { };

google-fonts = callPackage ../data/fonts/google-fonts { };

google-clasp = callPackage ../development/misc/google-clasp { };
Expand Down

0 comments on commit 60d8f39

Please sign in to comment.