From 7d6d524b675a5d6308a62d31278567701c999ba8 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 4 Jan 2020 18:20:27 +0000 Subject: [PATCH] Add Nix package --- Makefile | 2 ++ default.nix | 37 ++++++++++++++++++++++++++ deps.nix | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 Makefile create mode 100644 default.nix create mode 100644 deps.nix diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..db31c50 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + nix-build -E '((import {}).callPackage (import ./default.nix) { })' --option sandbox true --no-out-link diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..3fee8fb --- /dev/null +++ b/default.nix @@ -0,0 +1,37 @@ +{ stdenv +, lib +, buildGoPackage +, fetchgit +, nix +, virt-viewer +, makeWrapper +}: + +buildGoPackage rec { + pname = "appvm"; + version = "0.3"; + + buildInputs = [ makeWrapper ]; + + goPackagePath = "code.dumpstack.io/tools/${pname}"; + + src = fetchgit { + rev = "refs/tags/v${version}"; + url = "https://code.dumpstack.io/tools/${pname}.git"; + sha256 = "1ji4g868xrv6kx6brdrqfv0ca12vjw0mcndffnnwpczh4yv81sd3"; + }; + + goDeps = ./deps.nix; + + postFixup = '' + wrapProgram $bin/bin/appvm \ + --prefix PATH : "${lib.makeBinPath [ nix virt-viewer ]}" + ''; + + meta = { + description = "Nix-based app VMs"; + homepage = "https://code.dumpstack.io/tools/${pname}"; + maintainers = [ lib.maintainers.dump_stack ]; + license = lib.licenses.gpl3; + }; +} diff --git a/deps.nix b/deps.nix new file mode 100644 index 0000000..3c0c6e8 --- /dev/null +++ b/deps.nix @@ -0,0 +1,75 @@ +# This file was generated by https://github.com/kamilchm/go2nix v1.3.0 +[ + { + goPackagePath = "github.com/alecthomas/template"; + fetch = { + type = "git"; + url = "https://github.com/alecthomas/template"; + rev = "fb15b899a75114aa79cc930e33c46b577cc664b1"; + sha256 = "1vlasv4dgycydh5wx6jdcvz40zdv90zz1h7836z7lhsi2ymvii26"; + }; + } + { + goPackagePath = "github.com/alecthomas/units"; + fetch = { + type = "git"; + url = "https://github.com/alecthomas/units"; + rev = "f65c72e2690dc4b403c8bd637baf4611cd4c069b"; + sha256 = "04jyqm7m3m01ppfy1f9xk4qvrwvs78q9zml6llyf2b3v5k6b2bbc"; + }; + } + { + goPackagePath = "github.com/digitalocean/go-libvirt"; + fetch = { + type = "git"; + url = "https://github.com/digitalocean/go-libvirt"; + rev = "08f982c676c687208cd701abd4565d40c374d45f"; + sha256 = "18wp5mnww95f36v26k0xywkmsi1p2k5lwbcdmn3j6a2krw1r5ki0"; + }; + } + { + goPackagePath = "github.com/go-cmd/cmd"; + fetch = { + type = "git"; + url = "https://github.com/go-cmd/cmd"; + rev = "4816cdeadc82a57cf8891131b2f6797489f65dff"; + sha256 = "0dnbvvcirivyig0j6ip1ybpnjqjiywbdv9srgm4783vhqj9q6g7y"; + }; + } + { + goPackagePath = "github.com/jollheef/go-system"; + fetch = { + type = "git"; + url = "https://github.com/jollheef/go-system"; + rev = "6ed6b1d2b8dbf44afb949ebae53b57690e6952ec"; + sha256 = "00i900bfq6d28sb9677w4ryyq1mq2z4sgwhjq9fi8ak18hc9hgbi"; + }; + } + { + goPackagePath = "github.com/mattn/go-runewidth"; + fetch = { + type = "git"; + url = "https://github.com/mattn/go-runewidth"; + rev = "703b5e6b11ae25aeb2af9ebb5d5fdf8fa2575211"; + sha256 = "0znpyz71gajx3g0j2zp63nhjj2c07g16885vxv4ykwnrfmzbgk4w"; + }; + } + { + goPackagePath = "github.com/olekukonko/tablewriter"; + fetch = { + type = "git"; + url = "https://github.com/olekukonko/tablewriter"; + rev = "e6d60cf7ba1f42d86d54cdf5508611c4aafb3970"; + sha256 = "0hh95glg7d2md185r03wn52j2r33jc4zil0qvcrs66ka7bdxi7vj"; + }; + } + { + goPackagePath = "gopkg.in/alecthomas/kingpin.v2"; + fetch = { + type = "git"; + url = "https://gopkg.in/alecthomas/kingpin.v2"; + rev = "947dcec5ba9c011838740e680966fd7087a71d0d"; + sha256 = "0mndnv3hdngr3bxp7yxfd47cas4prv98sqw534mx7vp38gd88n5r"; + }; + } +]