From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timothy Sample Subject: Re: Help defining a trivial package. Date: Wed, 04 Sep 2019 13:34:15 -0400 Message-ID: <875zm8ynhk.fsf@ngyro.com> References: <87sgppfnha.fsf@ngyro.com> <87v9ug2dsu.fsf@ngyro.com> <87woeqywbx.fsf@ngyro.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5ZAj-0004lR-5s for help-guix@gnu.org; Wed, 04 Sep 2019 13:34:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5ZAh-00021z-OG for help-guix@gnu.org; Wed, 04 Sep 2019 13:34:21 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:55347) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5ZAh-00020r-HU for help-guix@gnu.org; Wed, 04 Sep 2019 13:34:19 -0400 In-Reply-To: (Pierre-Henry F.'s message of "Wed, 04 Sep 2019 11:21:41 +0000") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: "Pierre-Henry F." Cc: "help-guix@gnu.org" Hello! I=E2=80=99m glad the Python code was helpful. :) I=E2=80=99ve commented o= n some of your other points below. "Pierre-Henry F." writes: > Development: > > $ guix environment --manifest=3D./guix/manifest.scm --pure --container > $ # Develop things. Add dependencies at will in manifest.scm > > > Build release: > > $ ./deployment/make_release > Built release: release_4.tar.lz > > > Deployment: > > $ guix build --keep-failed --verbosity=3D2 --file=3D./blog.scm > =E2=80=A6 > /gnu/store/=E2=80=A6-blog-4 > > > Test: > > $ /gnu/store/=E2=80=A6-blog-4/bin/program > Hello world! > > > What would be very helpful: > > - Define blog.scm such that ~$ guix environment blog~ has the same ef= fect as > ~$ guix environment --manifest=3D./guix/manifest.scm --pure --conta= iner~ This really depends on what=E2=80=99s in =E2=80=9Cmanifest.scm=E2=80=9D. I= f it contains tools for building the blog, it would be same, but I take it that =E2=80=9Cmanifest.scm=E2=80=9D has tools for hacking on the blog, too (like= editors or whatever). In this case, it=E2=80=99s actually a feature that they=E2=80= =99re separate. It keeps the build and runtime time dependencies apart from the development dependencies. You can always combine the two, so that =E2=80=9Cmanifest.scm=E2=80=9D only has to contain the extra stuff: guix environment --pure --container \ -l blog.scm --ad-hoc -m manifest.scm This will pull in all the build and runtime dependencies of the package defined in =E2=80=9Cblog.scm=E2=80=9D plus all the extra tools from =E2=80= =9Cmanifest.scm=E2=80=9D. > - Define a package ~blog_executable.scm~ derived from ~blog.scm~ such= that > ~$ guix package -i blog_executable~ has the same effect has > ~$ guix build --file=3D./blog_v2.scm~, but actually install the thi= ng. > > ~blog_executable.scm~ is essentially ~blog.scm~ but stripped down t= o the bare > minimum to get the executable working. This is definitely possible. All you need to do is make sure that the package defined in =E2=80=9Cblog_executable.scm=E2=80=9D has its source fie= ld set properly. What I=E2=80=99ve done in the past is use Guile-Git to use all o= f the files that Git knows about as the source of the package. This makes sure transient build artifacts are not included (since they are likely ignored by Git). If you like, take a look at this file: https://git.savannah.nongnu.org/cgit/gash.git/tree/guix.scm It is the main Guix package definition that I use when developing Gash (a shell written in Guile that I maintain). If you clone the repo, you can run =E2=80=9Cguix package -f guix.scm=E2=80=9D to build and install Gas= h from the latest Git sources (the ones you just cloned). There are two things to note, though. First, if you use it for testing the build, it can get confusing as to which files are included: is it files in the working tree, files in the index, or files from the latest commit? I honestly get confused and miss things all the time! The second thing is that since I wrote that package definition, Guix got a procedure called =E2=80=9Cgit-predicate=E2=80=9D in =E2=80=9C(guix git-download)=E2=80=9D th= at does basically the same thing as my =E2=80=9Cmake-select=E2=80=9D. I recommend using the Guix proc= edure if possible, I just haven=E2=80=99t looked into it yet. :) > If all the above is true then I hope that we (multiple devs) can have the= guarantee > to have the same dev environment and a simple deployment build that's jus= t the > development environment minus dev dependencies. > > With these things in place, a deployment should be deterministic and as s= imple as a: > > $ guix package -i blog_executable > > > To sum up, here are the questions I try to answer: > > - How to define ~blog.scm~ such that ~$ guix environment blog~ works? > - How to define ~blog_executable.scm~ such that ~$ guix package -i bl= og_executable~ works? I hope what I wrote above helps answer these questions! -- Tim