From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iJjmESsPYWKr8wAAbAwnHQ (envelope-from ) for ; Thu, 21 Apr 2022 10:00:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QJ/SESsPYWJjlwAAauVa8A (envelope-from ) for ; Thu, 21 Apr 2022 10:00:43 +0200 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 8C44528084 for ; Thu, 21 Apr 2022 10:00:42 +0200 (CEST) Received: from localhost ([::1]:40152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhRjt-0001TZ-GW for larch@yhetil.org; Thu, 21 Apr 2022 04:00:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhRU2-0007aZ-Vm for guix-devel@gnu.org; Thu, 21 Apr 2022 03:44:11 -0400 Received: from jpoiret.xyz ([206.189.101.64]:56112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhRU1-0000LJ-At for guix-devel@gnu.org; Thu, 21 Apr 2022 03:44:10 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id E9ACE1851E0; Thu, 21 Apr 2022 07:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1650527046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/yc/NypVrnoq0fFTapBWb/lQWG0saue7/PgjfJprPqM=; b=Tiwd3qNbwaYK87/HscpJFpKukXEktKjKiLC1rqFnJEcddmzRiUyDybpCPoKJ7zlMvJtrTN beb/N82Jk8cqA7LwrZv4Nw7RJ7Y4NSuVIloL9wG/jbV8EHmVHR/mv8LZMFgI48GKZfDSFY v8e+Rct1vGWqmFUIPV2pgqpCDxt1LmvlEZUWsNgb3TuqLllu/aMaP5ioa3Go3m/ENL+00H /MLnJKu1DrGzOqghzDVK9TtyTFhgpFXlpmMNq0C+PppxdcgcSqTPCNkYx+UtPW4wWQ3G1p ZRqPe4n6fiW6No7vvsmw3j7wVm8/YHG9wr6omNYeflIMAiibnQ2I1Ne/RT94QA== From: Josselin Poiret To: Maxime Devos , Brian Cully , guix-devel@gnu.org Subject: Re: Viewing derivation output in the store In-Reply-To: <40e59c1a7b3cd1bb4333b912739688a5146336cb.camel@telenet.be> References: <87ee1rn1ph.fsf@ditto.jhoto.spork.org> <40e59c1a7b3cd1bb4333b912739688a5146336cb.camel@telenet.be> Date: Thu, 21 Apr 2022 09:44:05 +0200 Message-ID: <87v8v2g9tm.fsf@jpoiret.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / Received-SPF: pass client-ip=206.189.101.64; envelope-from=dev@jpoiret.xyz; helo=jpoiret.xyz X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.997, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650528042; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=/yc/NypVrnoq0fFTapBWb/lQWG0saue7/PgjfJprPqM=; b=A0BRL01GwyR/ddr5UIa6Pgd2OrYXRAvRC0hxYu3fH+yFNQdyxU0SPe/3dyPlJpyRkC/l95 kluwK1or2I5LBzArc7jtPxgT72ERHlEOcPXva3CiIVAuwWixv9A1CFn0L28/AuBkxDvFb0 5SjvqvtHwn6k8CGboty37fvKeKbRCXtuP/qmnl1ftShIhOK86DMGrfhtXhWR3wQSBzsyao Of/PTlKms1SP3H4gCfJMgyDYYx0zQp2JlfZpsHsSFYtevLTPPbN646FfAz727gCbBd1PJ5 zogYLv1Tay6bX5UF0Gp3wbtgfaIyxym9+BvK+oUbtx4+ATfQIXXz36izLkilvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650528042; a=rsa-sha256; cv=none; b=B3KCOoJxgLZOye00tTQKAzZhKcnCXyGZLlxc/ah2BozIMoWlws8xQhedmoI+LQszDw5YVC zp69ohtzzQSiewHT09B7hrm9W2zckuCCS4V7D7AiwcdypEcenVXeK8TghyWe6DM/ziAOzR 11TwHQRhRNsDQMAOIxYIDy/vRZesArsffuOXQq6TS1CPo6ZLfh/EUj/y2IgD9VPCZGeKt2 wKbceE4Q6icJvxIIAyes1oddQotXNuvjxtH9f3nTK+CBKtHx7t+GR8Rdo0VtwC5zDkVfap 2wSGY3DyZiljC7f6UHny+MAFbmAoehNagShF4tbMk5e3W5iiTbUCAqabN89gFg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=jpoiret.xyz header.s=dkim header.b=Tiwd3qNb; dmarc=pass (policy=reject) header.from=jpoiret.xyz; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.54 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=jpoiret.xyz header.s=dkim header.b=Tiwd3qNb; dmarc=pass (policy=reject) header.from=jpoiret.xyz; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8C44528084 X-Spam-Score: -2.54 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3cuXIz8GWTOm Hello everyone, Just for completeness' sake, here's my take on it from yesterday while we were talking about it with Brian: --8<---------------cut here---------------start------------->8--- (define-module (test) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (guix derivations) #:use-module (guix store)) (define test-gexp #~(begin (copy-file #$(plain-file "helloes.txt" "contents") #$output) (format #t "Helloes~%"))) (with-store store (run-with-store store (mlet* %store-monad ((drv (gexp->derivation "myderivation" test-gexp)) (output -> (derivation->output-path drv))) (mbegin %store-monad (built-derivations (list drv)) (return (format #t "~a~%" output)))))) --8<---------------cut here---------------end--------------->8--- I tried to use the most monadic approach here to demonstrate its usefulness, however, it seems to me that derivation->output-path is not documented, along with built-derivations (which is just (store-lift build-derivations)). Lesson learned: don't shadow gexp (hence `test-gexp`)! As an aside: is there anything preventing us from having do notation =C3=A0 la Haskell? This could help bridge mlet and mbegin with >>=3D, which in its current form is impractical. Here's what it could look like: --8<---------------cut here---------------start------------->8--- (mdo %store-monad (drv <- (gexp-derivation "myderivation" test-gexp)) (output <- (return (derivation->output-path drv))) (built-derivations (list drv)) (return (format #t "~a~%" output))) --8<---------------cut here---------------end--------------->8--- We could even have some more sugar for (x <- (return y)), Haskell has `let x =3D y`, but we could instead have something like `(x :=3D y)`? If it's okay I could whip up a quick implementation for it, shouldn't be too hard. Best, --=20 Josselin Poiret