nixpkgs/pkgs/servers/cloud-print-connector/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

64 lines
2.2 KiB
Nix

{ lib, stdenv, buildGoPackage, fetchFromGitHub, avahi, cups, fetchpatch }:
# TODO: Add a service for gcp-cups-connector and perhaps some other
# kind of configuration for the same thing that gcp-connector-util
# provides.
# Mic92 has an example module:
# - https://github.com/Mic92/dotfiles/blob/ba2a01144cfdc71c829d872a3fc816c64663ad7f/nixos/vms/matchbox/modules/cloud-print-connector.nix
buildGoPackage rec {
pname = "cloud-print-connector-unstable";
version = "1.16";
rev = "481ad139cc023a3ba65e769f08f277368fa8a5de";
goPackagePath = "github.com/google/cloud-print-connector";
subPackages = [
"gcp-connector-util"
"gcp-cups-connector"
];
patches = [
(fetchpatch {
# https://github.com/google/cloud-print-connector/pull/475
url = "https://github.com/google/cloud-print-connector/commit/6a77c7c283b83cbcc9cbfab59710023cd09da3ed.patch";
sha256 = "054pi9nz402va95z5k6wq3dalnv5rcya078wa99p1kdwb7cqmrcq";
})
];
src = fetchFromGitHub {
owner = "google";
repo = "cloud-print-connector";
sha256 = "0z2xad4wsv962rc1rspghfcfkz4nj2j5l5cm7xyn6qmsag0m8y2x";
rev = "v${version}";
};
# To compute a new go2nix deps.go file,
# change to the gcp-connector-util directory and create a nix-shell with avahi and
# cups in it.
# manually mirrored from launchpad because cloning failed due insecure http protocol
# {
# goPackagePath = "launchpad.net/go-xdg/v0";
# fetch = {
# type = "git";
# url = "https://github.com/Mic92/go-xdg";
# rev = "b3fc6b3106d78701853b0caf62ebedae42769af2";
# sha256 = "0fd68kkxzxjanpgannpys962bxzqdf8c1qvzk687hv504a3dp76f";
# };
# }
goDeps = ./deps.nix;
buildInputs = [ avahi cups ];
meta = with lib; {
description = "Share printers from your Windows, Linux, FreeBSD or macOS computer with ChromeOS and Android devices, using the Cloud Print Connector";
homepage = "https://github.com/google/cloud-print-connector";
license = licenses.bsd3;
maintainers = with maintainers; [ hodapp ];
# TODO: Fix broken build on macOS. The GitHub presently lists the
# FreeBSD build as broken too, but this may change in the future.
platforms = platforms.unix;
};
}