nixpkgs/pkgs/tools/virtualization/google-compute-engine-oslogin/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

57 lines
1.4 KiB
Nix

{ stdenv
, lib
, bashInteractive
, curl
, fetchFromGitHub
, json_c
, nixosTests
, pam
}:
stdenv.mkDerivation rec {
pname = "google-compute-engine-oslogin";
version = "20200507.00";
src = fetchFromGitHub {
owner = "GoogleCloudPlatform";
repo = "guest-oslogin";
rev = version;
sha256 = "1np8c96sm29pwnxykc0id8kkgalhw576g43fgi1y936sr2hfvx3v";
};
postPatch = ''
# change sudoers dir from /var/google-sudoers.d to /run/google-sudoers.d (managed through systemd-tmpfiles)
substituteInPlace src/pam/pam_oslogin_admin.cc --replace /var/google-sudoers.d /run/google-sudoers.d
# fix "User foo not allowed because shell /bin/bash does not exist"
substituteInPlace src/include/compat.h --replace /bin/bash ${bashInteractive}/bin/bash
'';
buildInputs = [ curl.dev pam ];
NIX_CFLAGS_COMPILE="-I${json_c.dev}/include/json-c";
NIX_CFLAGS_LINK="-L${json_c}/lib";
makeFlags = [
"VERSION=${version}"
"DESTDIR=${placeholder "out"}"
"PREFIX=/"
"BINDIR=/bin"
"LIBDIR=/lib"
"PAMDIR=/lib"
"MANDIR=/share/man"
];
enableParallelBuilding = true;
passthru.tests = {
inherit (nixosTests) google-oslogin;
};
meta = with lib; {
homepage = "https://github.com/GoogleCloudPlatform/compute-image-packages";
description = "OS Login Guest Environment for Google Compute Engine";
license = licenses.asl20;
maintainers = with maintainers; [ flokli ];
};
}