From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 25 05:56:50 2021 Received: (at 48974) by debbugs.gnu.org; 25 Jun 2021 09:56:50 +0000 Received: from localhost ([127.0.0.1]:44896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwiZu-0002m9-5w for submit@debbugs.gnu.org; Fri, 25 Jun 2021 05:56:50 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:17082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwiZo-0002lv-EG for 48974@debbugs.gnu.org; Fri, 25 Jun 2021 05:56:48 -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 4GBC890w1xz3xCP; Fri, 25 Jun 2021 11:56:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1624615001; bh=M2CeKDUNePxoFwUcd0WPo7bS7hlmp7S/gmfV/ZotY/w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PlV9YGDR9ivrT+56PmDghLodOyoRnNb6wEVHBedF+Y88vTs000+cu/t8FTjm9X+sG CmbHFWop1xjqJK8QfcM4N5fc0ulDJEerBtGos/Ey+fq+AjdH2qjj3lDncTL0B1bi2l EM9NeMoUKfl6l2zBH0JlCWfir/26U13aSFyw+v6E= Message-ID: <6254e4d32697986bd61986e10399f341930c5c2e.camel@student.tugraz.at> Subject: Re: bug#48974: A possible shepherd bug (it's very minor) From: Leo Prikler To: Joshua Branson Date: Fri, 25 Jun 2021 11:56:40 +0200 In-Reply-To: <87mtre5lzy.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> 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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 48974 Cc: 48974@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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! > > I'm pretty sure that the actual bug also exists, just not sure > > whether > > that's on your config or on shepherd. Using TTY1 for graphical > > stuff > > is also somewhat rare in Guix land, I presume. (Or rather, I can't > > think of it as anything but a container for debug output spam :D) > > > > As for getting this to work only on TTY1, you do get the config > > object, > > so you can do stuff like > > (if (is-tty1? config) (inherit+autologin config) config) > > Note of course, that is-tty1? is not a procedure that's ready-made, > > but > > one that you'd need to build from primitives such as record > > accessors. > > > > 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. Try the following: #+BEGIN_SRC scheme (define (auto-login-to-tty tty user) ;; TODO: you might want to implement this as match-lambda instead (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 > #+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. > (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). > #+END_SRC Regards, Leo