/golang-developer-nix

Nix flake for Go (language) tooling

Primary LanguageNix

Nix Flake: Go Tooling

A Nix Flake that contains software packages for developing applications in the Go language.

Packages included:

Usage

With Flakes

Add this repo to your flake.nix inputs like:

{
  # ...
  inputs.golang-developer.url = "github:thelonelyghost/golang-developer-nix";
  # ...

  outputs = { self, nixpkgs, flake-utils, golang-developer, ...}@attrs:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {
        inherit system;
      };
      godev = golang-developer.packages."${system}";
    in {
      devShell = pkgs.mkShell {
        nativeBuildInputs = [
          pkgs.bashInteractive
          godev.cobra-cli
        ];
      };
    });
}

Updating: Anytime you want to update what workstation-deps offers, run nix flake lock --update-input golang-developer and rebuild your Nix expression acccordingly.

Without Flakes

If you're not yet using Nix Flakes, such as with home-manager, here's how you can include it:

  1. Install niv and run niv init
  2. Run niv add thelonelyghost/golang-developer-nix --name golang-developer
  3. Include the following in your code:
{ lib, config, ... }:

let
  sources = import ./nix/sources.nix {};
  pkgs = import sources.nixpkgs {};

  godev = (import (pkgs.fetchFromGitHub { inherit (sources.golang-developer) owner repo rev sha256; })).outputs.packages."${builtins.currentSystem}";
in
{
  home.packages = [
    godev.cobra-cli
  ];
}

Updating: Anytime you want to update what golang-developer-nix offers, run niv update golang-developer and rebuild your Nix expression acccordingly.