From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EBRYHwtPa2EONAEAgWs5BA (envelope-from ) for ; Sun, 17 Oct 2021 00:15:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WDEBGwtPa2HcJwAAB5/wlQ (envelope-from ) for ; Sat, 16 Oct 2021 22:15:39 +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 CE8D89791 for ; Sun, 17 Oct 2021 00:15:38 +0200 (CEST) Received: from localhost ([::1]:51660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbrxo-000482-HX for larch@yhetil.org; Sat, 16 Oct 2021 18:15:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbrxM-00047G-TE for help-guix@gnu.org; Sat, 16 Oct 2021 18:15:08 -0400 Received: from mout01.posteo.de ([185.67.36.65]:45851) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbrxK-0005w7-49 for help-guix@gnu.org; Sat, 16 Oct 2021 18:15:08 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 6F740240029 for ; Sun, 17 Oct 2021 00:15:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1634422502; bh=vV2uVhvM1kbiKSOll9bStfLTblKzJ+3TTFGxEK/dv8Y=; h=From:To:Cc:Subject:Date:From; b=qeCMZHU7BXmqgJyPq6CAgsr63NEmDsQJvr9eDXgChzqDbrymH5czub24uqwnCDnbt h1769xcka7o1mtToVtM9MoUTdwrxkHr7A/M9anB5a3mlfUdwJ/A4mUiSK0+qN0EXLH F9iTMgF2/mGeubhGkRAfQwXA3s2nK00fCrD5zfN3hFF3CW1CvkFsN4LIohNu1ePFdi XVdIEF/lwXUVageB8uF8rrgPj5yztpA4JZYadxfpx0jk13CSA7s4GMKcvHHe96mcD/ W4hdjQVdnyoPFGMZSBpkKDJJJdfA/uk9NCbz+MuAI/9dNTISb++BlZFEHaUpzOUwAK Q0mOAID9G60Dg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HWy9x3zmVz9rxL; Sun, 17 Oct 2021 00:15:01 +0200 (CEST) From: Fredrik Salomonsson To: Oleg Pykhalov Subject: Re: Question about scripts in guix-home In-Reply-To: <87ilxx87n0.fsf@gmail.com> References: <87r1clfxcp.fsf@posteo.net> <87ilxx87n0.fsf@gmail.com> Date: Sat, 16 Oct 2021 22:14:59 +0000 Message-ID: <87wnmc8vmk.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=plattfot@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Cc: help-guix Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634422539; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=9WbsO5bwj8vlQUh4aGDnsW7V1Oke00d9SbOVO01A638=; b=tbXy4mtR6VAVOP3S1jIaFJA3OQvXDrX5TcrjLL54KTEJeFiQGoN1KHB4Rr2wSOVJbr2Ca/ UtT+1xlnvzTTm9cQIDLvJcQF+E9zXOzwTq8QhgOeqx3rretP4yY9HUtVE6I57/RxnuR7JW qZmbw/q4m/HEqvJ9m2dCjpBDJsXzs3nruNBHQzEFt3JcAKaE4iR5PSmJFp8u+/h40DX3k1 oB3AN54GtF7HZe3qxh1/GEIrRkabOk8yCt4A1umhysxBPK0pDqqAIL6xiR5VyFJKnGvM/z nyqze7NsVTZhwAnBuMvBAy9C4Zh4hRaROBQoOV+57OmUN/leBUA648oLYdtayQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634422539; a=rsa-sha256; cv=none; b=MGRCTftcL2A6XHDcotNtHMAhlgXz+XoQlIGagBoTFbzQquqJMYP1zrzNsVVpRvRsh1JZOb uZMeySo9V+yke3ztGODAjlCmEhxO+iz9YIYVg5G/CM+IsfmE6XuM9lOXHOetH0ENxKJB6s xng2zN3XtCEld5auNtxjrSWXrsBl934wsyIsCDCzfpUtxO6F9baYqbhMFEYDAeq7x3STEK AtDXfWK/XL/Kl1ZcexnZYXDmbrJ6FWJ1AgzPxjaH9pPYk+9QquiSsvhC+XlgVe49myVd2u H+wGCI6lUCAttk7eqQpzR3eLjXJSunsFnerFZMnxxtAcXK3clV0WKbpoT3Fvcg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qeCMZHU7; dmarc=pass (policy=none) header.from=posteo.net; 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: -4.22 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qeCMZHU7; dmarc=pass (policy=none) header.from=posteo.net; 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: CE8D89791 X-Spam-Score: -4.22 X-Migadu-Scanner: scn1.migadu.com X-TUID: 6Tkl3bOde41a Hi, Oleg Pykhalov writes: > I use the following, which creates ~/.local/bin/shellcheck executable fil= e: > --8<---------------cut here---------------start------------->8--- > (home-environment > ;; ... > (services > (list > (simple-service 'shellcheck-wrapper > home-files-service-type > (list `("local/bin/shellcheck" > ,(computed-file > "shellcheck-wrapper" > #~(begin > (with-output-to-file #$output > (lambda () > (format #t "\ > #!/bin/sh > exec -a \"$0\" ~a/bin/shellcheck --shell=3Dbash \"$@\"\n" > #$shellcheck))) > (chmod #$output #o555))))))))) > --8<---------------cut here---------------end--------------->8--- Thanks, still issue with the execution bit though=E2=80=A6 This is what I tried. Note that I only tested this on my mic.sh script to see if it worked. #+begin_src scheme (define-public (get-services host) "Return services for HOST." (let ((storage-script (program-file "storage.sh" #~(execl #$(local-file "files/waybar/modules-sto= rage.sh") "storage.sh")))) (list (simple-service 'plt-waybar-config home-files-service-type `( ("config/waybar/config" ,(local-file (format #f "~a/files/waybar/~a.conf"= %source-dir host))) ("config/waybar/style.css" ,(local-file (format #f "~a/files/waybar/~a-style= .css" %source-dir host))) ("config/waybar/modules/mic.sh" ,(computed-file "mic-wrapper" #~(begin (let ((script #$(local-file "files/waybar/m= odules-mic.sh"))) (with-output-to-file #$output (lambda () (format #t "\ #!/bin/sh exec -a \"$0\" ~a --shell=3Dbash \"$@\"\n" script))) (chmod script #o555)) ;; <-- trying to ch= mod the script (chmod #$output #o555)))) ("config/waybar/modules/storage.sh" ,storage-script) ))))) #+end_src Without the (chmod script #o555), it builds but when I try and run it I get:=20 #+begin_src bash $ ~/.config/waybar/modules/mic.sh /home/plattfot/.config/waybar/modules/mic.sh: line 2: /gnu/store/kbarnh2z= 2zaljwy6bwfhni2h3jjihzyj-modules-mic.sh: Permission denied /home/plattfot/.config/waybar/modules/mic.sh: line 2: exec: /gnu/store/kb= arnh2z2zaljwy6bwfhni2h3jjihzyj-modules-mic.sh: cannot execute: Permission d= enied #+end_src If I try and chmod the script, as shown in the example above, guix home fails with: #+begin_src bash $ guix home reconfigure -L ~/.files ~/.files/plt/home/configs/surt.scm = 1 substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0% substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... = 100.0% The following derivations will be built: /gnu/store/mn3ii78ri2bsi47rjc5qwnjc7hrd0znn-home.drv /gnu/store/3fwk9l6xjgkac702figgn4ppfmlli5xh-files.drv /gnu/store/jydir36k5b53n6wqnjzbkgkjz7wjw1g8-mic-wrapper.drv building /gnu/store/jydir36k5b53n6wqnjzbkgkjz7wjw1g8-mic-wrapper.drv... Backtrace: 2 (primitive-load "/gnu/store/w399i13mijh528x6ymlijh0k5fz?") In ice-9/eval.scm: 619:8 1 (_ #f) In unknown file: 0 (chmod "/gnu/store/kbarnh2z2zaljwy6bwfhni2h3jjihzyj-mo?" ?) ERROR: In procedure chmod: In procedure chmod: Operation not permitted builder for `/gnu/store/jydir36k5b53n6wqnjzbkgkjz7wjw1g8-mic-wrapper.drv'= failed with exit code 1 build of /gnu/store/jydir36k5b53n6wqnjzbkgkjz7wjw1g8-mic-wrapper.drv fail= ed View build log at '/var/log/guix/drvs/jy/dir36k5b53n6wqnjzbkgkjz7wjw1g8-m= ic-wrapper.drv.bz2'. cannot build derivation `/gnu/store/3fwk9l6xjgkac702figgn4ppfmlli5xh-file= s.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/mn3ii78ri2bsi47rjc5qwnjc7hrd0znn-home= .drv': 1 dependencies couldn't be built guix home: error: build of `/gnu/store/mn3ii78ri2bsi47rjc5qwnjc7hrd0znn-h= ome.drv' failed #+end_src I ended up just package them up and that seems to be working #+begin_src scheme (define-module (plt home waybar) #:use-module (gnu home services) #:use-module (gnu packages bash) #:use-module (gnu packages wm) #:use-module (gnu services) #:use-module (guix build-system copy) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) #:use-module (ice-9 format)) (define %source-dir (current-source-directory)) (define plt-waybar-custom-script (package (name "plt-waybar-custom-script") (version "1.0.0") (source (local-file (string-append %source-dir "/files/waybar") #:recursive? #t #:select? (lambda (file stat) (string-suffix? ".sh" file)))) (build-system copy-build-system) (arguments `(#:install-plan '(("modules-storage.sh" "bin/waybar-custom-storage") ("modules-mic.sh" "bin/waybar-custom-mic")))) (native-inputs `()) (inputs `(("bash" ,bash))) ;; needs pactl (propagated-inputs `()) (synopsis "Simple script to check the mic status") (description "Uses @code{pactl} to fetch the microphone status and return the sta= tus in a form @code{waybar} understands.") (home-page "") (license license:gpl3+))) (define-public packages (list waybar plt-waybar-custom-script )) (define-public (get-services host) "Return services for HOST." (let ((storage-script (program-file "storage.sh" #~(execl #$(local-file "files/waybar/modules-sto= rage.sh") "storage.sh")))) (list (simple-service 'plt-waybar-config home-files-service-type `( ("config/waybar/config" ,(local-file (format #f "~a/files/waybar/~a.conf"= %source-dir host))) ("config/waybar/style.css" ,(local-file (format #f "~a/files/waybar/~a-style= .css" %source-dir host))) ("config/waybar/modules/storage.sh" ,storage-script) ))))) #+end_src --=20 s/Fred[re]+i[ck]+/Fredrik/g