From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YLRVHUv7dWAMSAAAgWs5BA (envelope-from ) for ; Tue, 13 Apr 2021 22:12:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WAVKF0v7dWDXWgAA1q6Kng (envelope-from ) for ; Tue, 13 Apr 2021 20:12:59 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CD5621A880 for ; Tue, 13 Apr 2021 22:12:58 +0200 (CEST) Received: from localhost ([::1]:51234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWPP7-0003ex-N2 for larch@yhetil.org; Tue, 13 Apr 2021 16:12:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWPOo-0003e6-PP for help-guix@gnu.org; Tue, 13 Apr 2021 16:12:38 -0400 Received: from sender4-op-o10.zoho.com ([136.143.188.10]:17065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWPOm-00069Q-MR for help-guix@gnu.org; Tue, 13 Apr 2021 16:12:38 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1618344752; cv=none; d=zohomail.com; s=zohoarc; b=BnpWm46nPMa560Riy2KRjo93Df1UICgiTNUsVcaL6VJ7s4BeMKWdULKQU2UkNqIxZXmV4Av605j4TiEMGsoyZmDw91MI9PTSpvHQysTg0dwXUQoM55O22BxGeCNYNXnH7QXuO3n7mEwQbiKBtBnmNEO6dmIyM/BKzpTLqkY21uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618344752; h=Content-Type:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=46xs7fWpDlBwEQJcF2X+nZEryHHcok9rtF+/pzn+ECQ=; b=AuKisxd7iEdQ+qg4b2FMO3omzd+p7OFCFzA+Nch2BJxan67I2pccXFh/XcTS0iEjnH3uvniLWQiXE6PkodZpWVErokPbk2Cf42oYNdjo3WOdOKrSyYYIAwckQo3B0rlNj688EPeZy0k4mGsdctbd2RkT7HcdWb4E1k7uaXgm/U4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rdklein.fr; spf=pass smtp.mailfrom=edou@rdklein.fr; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1618344752; s=zoho; d=rdklein.fr; i=edou@rdklein.fr; h=References:From:To:Subject:In-reply-to:Message-ID:Date:MIME-Version:Content-Type; bh=46xs7fWpDlBwEQJcF2X+nZEryHHcok9rtF+/pzn+ECQ=; b=NruVJZ+uTFODvJ8+aXrAPOoAI2oD+oe0Aq7JL594nr9D2UChNeluk0diOavoQkEP CP2k0hISPr3+ct7uzoVL2H8Ya3NH9cenhfeXoTNAScK409Qzvg8s9lgnBqpjnVjjJNs RxRJvVKCWjUQNV2URsoJ3CGhMJ/UuXgwUyMJxFv4= Received: from Rasoir (lfbn-idf3-1-808-29.w90-3.abo.wanadoo.fr [90.3.133.29]) by mx.zohomail.com with SMTPS id 1618344748501220.32874065915712; Tue, 13 Apr 2021 13:12:28 -0700 (PDT) References: <87r1jgsjme.fsf@rdklein.fr> User-agent: mu4e 1.4.15; emacs 27.1 From: Edouard Klein To: help-guix@gnu.org Subject: Re: Environment of a shepherd service In-reply-to: <87r1jgsjme.fsf@rdklein.fr> Message-ID: <87lf9mosf4.fsf@rdklein.fr> Date: Tue, 13 Apr 2021 22:12:15 +0200 MIME-Version: 1.0 Content-Type: text/plain X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.10; envelope-from=edou@rdklein.fr; helo=sender4-op-o10.zoho.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618344779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=46xs7fWpDlBwEQJcF2X+nZEryHHcok9rtF+/pzn+ECQ=; b=n4W9yUKi5dQ+6ix/YlaM+i9IhJRtGvRgylXSdssMjao5P5wigEEI3GiP5UAndH3GtwdPcl 0HucNWS2Ke/eysID+CbGI9DrwDr55i4HwJO65VP9r3EuBqjXqlzpSS8xancGjhfgMaG4Jd wylL+mi3qoHVw0mun/n0t++nyjN5VbrNDK3T8r4VPC2yJZdKIVFVnWmiecdia4NNq6kGQq 0wV8YSm3j6r3o60m584HPugOYwsf46BOvr6kkBAMq8hV0F/LXg7ROrNq0Vxdy3Zewhl/ZT VV2j/YRRsCUvIG9YMmK/Ap0uOy6L/2bfvIJCcHbcGK4uzOlJGvgpOqGgijNJoQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1618344779; a=rsa-sha256; cv=pass; b=aHNq+Ka6Gw7+F5z4Sw9PUtAsWl314XQkbo0j47LL2USlWvdDeFUwfVQ1Szs8Y9Hhpc+eZn DgjivfIqXugKtT/djOI4DEUPHIQ6gaq07rdqDeyRDPkEUi0cBZxsITruX75VFI/lNlUpa2 +nQbWaeqZIJeyfSziEv3piRye6NzFIvpP8wMMuykKdjwmy5QC5a+j5HXN5oyuRCkEo1bTo 60kRyWXHckNOQA2rFsLsUCntO23c+3YXT+0Lk4cVxHWQd0VlxnB+EjZuLegxnYdfiEwzM4 4SLyd80m6drNjGOIfmimKw10aNGuPOg8hU6n92St9LQy4tqlVLFLgI2vTgJDVw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=NruVJZ+u; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Spam-Score: -1.94 Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=NruVJZ+u; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: CD5621A880 X-Spam-Score: -1.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: 23pu3p4sohWv Hi, So I looked at the source and I understand that there's no way around having only PATH=/run/current-system/profile/bin as the sole environment of a service (which makes me wonder how anyone is running any service in GuixSD, don't you need any env variables ?). I tried to define a trivial package that would use wrap-program to create a script that would set the environment variables to all the search-paths of my requisomatic package, but I don't know how to access those ! In the code that is executed by the daemon, all references to the package are lost, it is not in the same strata as the package. I can get the store path to the package but that does not help me. I really could use some guidance here. Cheers, Edouard. edk@beaver-labs.com writes: > Dear fellow Guixers, > > I'm trying to create an operating system declaration, so that I can run > a piece of software of mine in a container with =guix system container=. > > I wrote a package for the software. The package works: the tests pass > and when the package is installed I can run the software. > > I wrote a shepherd service for the software (it's called requisomatic). > I copied the relevant part at the end of the email. > > When I run the container script created by =guix system container=, and > get a shell in the container, I can run the software (I added the software's > package to the globally installed packages in the operating-system definition). > > But, when I try to run it with shepherd, it fails because it can't find > flask (a dependency of the software, which I've put as a > propagated-input, and is indeed installed in the container). > > I replaced the software invocation in the shepherd service with just > "env", and saw that the whole env in the service is: > > PATH=/run/current-system/profile/bin > > whereas in the shell I get when I connect to the container, the env > contains many other variables, including a correctly set PYTHONPATH, > which allows the finding of flask. > > So I now know why my software is not starting, but my question is: > > Why is the PYTHONPATH (and the other env vars, for that matter) not > propagated from the package to the shepherd service by default ? And how > can I make it so ? I would have expected the shepherd service to run > with the global profile active. > > Follow up question, can shepherd services be specified to run in a > specific profile ? So that I can have two services with incompatible > dependencies running at the same time in the same operating-system ? > > Thanks in advance, > > Cheers, > > Edouard. > > > > -----extract from my operating-system declaration file------- > (define requisomatic-shepherd-service > (match-lambda > (($ user group db-file) > (list (shepherd-service > (provision '(requisomatic)) > (requirement '(user-processes networking)) > (documentation "Run the requisomatic server") > (start #~((make-forkexec-constructor > ;; (append > ;; (if db-file > ;; `("env" > ;; ,(string-append "REQUISOMATIC_DB_FILE=" db-file)) > ;; '()) > '("gunicorn" "requisomatic:app") > ;; '("env") > ;;) > #:directory (string-append #$requisomatic "/bin/requisomatic/") > #:log-file "/var/log/requisomatic.log"))) > (stop #~(make-kill-destructor)))))))