From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CHq7OoAg1mAGLAEAgWs5BA (envelope-from ) for ; Fri, 25 Jun 2021 20:29:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yJR2NoAg1mB1HwAAB5/wlQ (envelope-from ) for ; Fri, 25 Jun 2021 18:29:20 +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 CAEC424EC3 for ; Fri, 25 Jun 2021 20:29:19 +0200 (CEST) Received: from localhost ([::1]:49554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwqZp-0004MC-Ow for larch@yhetil.org; Fri, 25 Jun 2021 14:29:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwqZa-0004Hn-QI for bug-guix@gnu.org; Fri, 25 Jun 2021 14:29:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwqZa-0002Ka-Hn for bug-guix@gnu.org; Fri, 25 Jun 2021 14:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwqZa-00046Q-DD for bug-guix@gnu.org; Fri, 25 Jun 2021 14:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#48974: A possible shepherd bug (it's very minor) Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 25 Jun 2021 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48974 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Joshua Branson Received: via spool by 48974-submit@debbugs.gnu.org id=B48974.162464570515724 (code B ref 48974); Fri, 25 Jun 2021 18:29:02 +0000 Received: (at 48974) by debbugs.gnu.org; 25 Jun 2021 18:28:25 +0000 Received: from localhost ([127.0.0.1]:46786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwqYz-00045Y-1H for submit@debbugs.gnu.org; Fri, 25 Jun 2021 14:28:25 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:47557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwqYt-00045L-90 for 48974@debbugs.gnu.org; Fri, 25 Jun 2021 14:28:23 -0400 Received: from nijino.local (62-116-34-49.adsl.highway.telekom.at [62.116.34.49]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4GBQVR3X6Gz1DH90; Fri, 25 Jun 2021 20:28:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4GBQVR3X6Gz1DH90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1624645695; bh=Xt5R9EoMc122Yc6ZRzK56fOGK38POzSCZ1dHSFghgeM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hZNN26x1z3tVTwHgj2R1FP659Caw0xTzKDFcnWCYhlG4RBPgg7UKlrzCVs7D3YU+O e2nQBEBKwAbQdV24qDXaS0e67O8L7oshUaDPTcgf4apg1Q1bo1ApvEl8z0uIwYx6g9 ckgnlZdst0EmSkoY3puwlFifh1nuCz+TvfrUuwSY= Message-ID: <595245e54b3199173b9e47992d770caa4f807312.camel@student.tugraz.at> From: Leo Prikler Date: Fri, 25 Jun 2021 20:28:14 +0200 In-Reply-To: <875yy1vmy7.fsf@dismail.de> References: <9d5c5334eacfae92ace38329e55bc4a91929e206.camel@student.tugraz.at> <87wnqz43k0.fsf@dismail.de> <3192d62ef790c16fb2dfb894d9ccb160@dismail.de> <13bff20e418f1cec97cdda49ffed51544c5c9402.camel@student.tugraz.at> <87mtre5lzy.fsf@dismail.de> <6254e4d32697986bd61986e10399f341930c5c2e.camel@student.tugraz.at> <875yy1vmy7.fsf@dismail.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 48974@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624645760; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Xt5R9EoMc122Yc6ZRzK56fOGK38POzSCZ1dHSFghgeM=; b=QCB+zZY3vv77Qz6FysnJj2UFIa9y7cyk0YJ742aOgkqItye/iSVCwBkluIVkwgxk0cvLcO UNIdts4ReACZzCsMh+qxHk7D3Me0OiYkiMSr+G534ma/nfxk6peAommJNQ8EZipsNgfxMF TlMu6O2mm+S2NcwUlc5gUprVIX3fGr1obuyoLpeRQyu7FAQVNPPQ6+RO12/50Uv/jK5916 B2H+gJKfTFIF3YScf3GLAVbQUs9EUeX5DOFygwUQLCN08IAbgt90yDzBEpTHu+UZfy5xTl vxh7XuURV3gHfoq5SWdZoKEvh22gviuLUZ7lHua0UzS71MaRcv4l2ZTuuR4quw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624645760; a=rsa-sha256; cv=none; b=PczGhXhqXBCQq93w/xkoFz4tSnHVTn4jJ2j4wvpPiHgDSpWEA/5F72+zCrLMedGdEKhUuu isreffd1Apn1BDypq5VgRQRCETgnQ5k5s5HpQcbCWeAI8WTXxBk1YlFKJ4hRJbyIoaukFl LO4hz5zVFwUA50BOacDhljOYGO1uF5w/5xG74zpp58MuJjV/7rOLeuoy4apRCR0FK3gdNU VBj1CJrJOQ5FpSRBupi9TTWqdBOHd6GX4oBkLPcnbmmn5gzkUv4W+Z8fuh3se2HgXFuIRh Vh6g+VhmPPWgYH+12HWzLQhFwSNUqBMUPzv77jnNRtY28sCnwvb0VX6SnTzAYA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=hZNN26x1; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=hZNN26x1; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: CAEC424EC3 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1sU7tUvUKhIx Am Freitag, den 25.06.2021, 14:06 -0400 schrieb Joshua Branson: > Leo Prikler writes: > > > Hi, > > > > Am Freitag, den 25.06.2021, 05:31 -0400 schrieb Joshua Branson: > > > Leo Prikler writes: > > > > > > > Hi, > > > > > > > > Am Samstag, den 12.06.2021, 20:09 +0000 schrieb > > > > jbranso@dismail.de: > > > > > June 12, 2021 3:39 PM, "Leo Prikler" < > > > > > leo.prikler@student.tugraz.at> > > > > > wrote: > > > > > > > > > > > Am Samstag, den 12.06.2021, 09:26 -0400 schrieb Joshua > > > > > > Branson: > > > > > > > > > > > > > Hello! > > > > > > > > > > > > I'll tell you what, why don't we leave this "bug" open for a > > > > > week...I'll try to write > > > > > the code that does what I want, and I'll email the answer. > > > > > > > > > > Then I'll edit the manual to provide an example! > > > Well, it's been about a week. Here is my current code that > > > doesn't > > > work. > > > haha. > > > > > > #+BEGIN_SRC scheme > > > (define %my-desktop-services > > > (modify-services %desktop-services ;;end of remove services > > > (mingetty-service-type config => > > > (mingetty-configuration > > > (inherit config) > > > ;; ERROR at the NEXT LINE > > > (auto-login-to-tty-3 config) > > > )))) > > > > > > (define (auto-login-to-tty-3 config) > > > (if (string=? "3" (mingetty-configuration-tty config)) > > > '(auto-login "joshua") > > > '(auto-login #f))) > > > #+END_SRC > > > > > > It obviously doesn't work because I am treating modify-services > > > as if > > > it were a procedure. In fact, it is a macro. :) > > That's not the issue here, the issue is that you're treating > > mingetty- > > configuration as… I'm not really sure what exactly, when it is in > > fact > > a record constructor. > > Oh!!!! Light bulb! I knew that! I've made quite a few record > constructors for endlessh and my almost complete sway service: > > http://issues.guix.gnu.org/39136 > https://notabug.org/jbranso/guix-config/src/master/sway-service.scm > > > Try the following: > > > > #+BEGIN_SRC scheme > > (define (auto-login-to-tty tty user) > > ;; TODO: you might want to implement this as match-lambda instead > > I will try that! > > > (lambda (config) > > (if (string=? tty (mingetty-configuration-tty mingetty-config)) > > (mingetty-configuration > > (inherit config) > > (auto-login user)) > > config))) > > > > (define %my-desktop-services > > (modify-services %desktop-services > > > > (mingetty-service-type config => > > (auto-login- > > to-tty "3" "joshua")))) > > #+END_SRC > > > > Hmmm. Is that (define (auto-login-to-tty tty user) ...) a > closure? I > wonder why you need that lambda inside of it...Probably to pass the > config variable into the function...hmmm. I still don't understand > why > it is necessary. I'll think about that a bit later on. Yes, I've made it a bit more generic, so that you could also add let's say (auto-login-to-tty "4" "nsa-backdoor") if you wanted ;) You need a single-argument procedure in the config => proc part. So you generate a closure to do everything else. You could do the same with let-bindings inside the scope of modify-services, but I found it more useful to extract that. > > > #+BEGIN_SRC scheme > > > (define (auto-login-to-tty-3 mingetty-service) > > > (if (string=? "3" (mingetty-configuration-tty config)) > > > '(mingetty-configuration > > > (auto-login "joshua") > > > (tty "3")) > > > mingetty-service)) > > Don't quote mingetty-configuration et al. They're first-class > > syntax, > > not just weird lists. > > Yeah that's true. I do actually like (guix records)! I feel like > that file should be upstreamed into guile! Haha, yes, guixy records are a charm, but they're subject to quicker iteration than guile's. > > > (define (my-modify-%desktop-services-to-auto-login-on-tty-3 > > > %desktop- > > > services) > > > ;; to be written > > > ;; though I think fold, or map, may be useful functions here. > > > > > > ;;somehow I will use this function... > > > (auto-login-to-tty-3 mingetty-service) > > > ) > > > > > > (define %my-desktop-services > > > (my-modify-%desktop-services-to-auto-login-on-tty-3 > > > %desktop- > > > services)) > > I don't think you need to implement modify-services on your own, > > rather > > just use the existing thing in the "correct" way – i.e. adhering to > > the > > expectations given by the already existing procedure (or macro). > > Thanks again! The current code doesn't quite work for me yet. I'll > try using match-lambda to define it. I'll post again when I have a > free moment. When i get it working, I'll send a patch to the manual > via guix-patches and CC you. Is that ok? Or would you rather that > documentation be in the cookbook? Did I make a mistake or does it do the job only in a somewhat inelegant way? I'm perfectly fine with the latter as I'm not the one using the code :P I think the cookbook is a better destination for stuff like this. Regards, Leo