From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eIjCBdioamEKgAEAgWs5BA (envelope-from ) for ; Sat, 16 Oct 2021 12:26:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MJtHAdioamEjFwAAbx9fmQ (envelope-from ) for ; Sat, 16 Oct 2021 10:26:32 +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 4780CA893 for ; Sat, 16 Oct 2021 12:26:31 +0200 (CEST) Received: from localhost ([::1]:40946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbgtZ-0003pD-LS for larch@yhetil.org; Sat, 16 Oct 2021 06:26:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbgtN-0003p2-7f for help-guix@gnu.org; Sat, 16 Oct 2021 06:26:17 -0400 Received: from sender4-op-o11.zoho.com ([136.143.188.11]:17152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbgtE-0007uT-LW for help-guix@gnu.org; Sat, 16 Oct 2021 06:26:16 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1634379962; cv=none; d=zohomail.com; s=zohoarc; b=mfI+/iR6ToKSEYVOMuttbAfWaAxZtzZMNtDoBWvysOkp2yyieYu2P8b2Lcu0GDaGRHFoTR6m8rs3RtBCXVFBIxGQRdLzyJ1Rho/gHotpctsxfPdzUo6IO23hTLQC1LPLryZ0stPy4Fa/XlhWGSaJ3TETQAeobvkWTm0Twh5Bwyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634379962; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=IBTzYeAaOmOFi1wcxuDLGtaT0KfyRjpYORvbD4tW1aI=; b=A2P/VCAzy5UD2K0ZYnoa/6FJRIV050+gbKkGL3afVP86MOejAEFsXr9/+0zglUi68qnqMDbu+ALJkwUw/oMhTNhh7ERE9cJzagvy+zYkul72VZe6wSkV75TZnGjuO2fG8q0V4/4sB1RRFFZO6zFFJPBv/pA0XN44d7+ZMRtSTbM= 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= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1634379962; s=zoho; d=rdklein.fr; i=edou@rdklein.fr; h=References:From:To:Cc:Subject:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=IBTzYeAaOmOFi1wcxuDLGtaT0KfyRjpYORvbD4tW1aI=; b=DR01BWSjneiS62bNZF6qCLsXLHPRmNVcj5YvfHOMeRaVHSBCydotnOx4noosqzU/ IM3DTBeVeDeAuSSto3HqWKJRWnqD88RhF5a+XF+/wWFidyU/pRp+vdTzXKFZk45yDXV cB5V2J2yQ4O7GWhZ2zJB86oST3cbtDoR6E10ZuQg= Received: from schwarzy (lfbn-idf3-1-600-168.w86-252.abo.wanadoo.fr [86.252.177.168]) by mx.zohomail.com with SMTPS id 16343799588350.1969080142519033; Sat, 16 Oct 2021 03:25:58 -0700 (PDT) References: <87r1clfxcp.fsf@posteo.net> User-agent: mu4e 1.6.5; emacs 27.2 From: Edouard Klein To: Fredrik Salomonsson Subject: Re: Question about scripts in guix-home Date: Sat, 16 Oct 2021 12:22:13 +0200 In-reply-to: <87r1clfxcp.fsf@posteo.net> Message-ID: <874k9hz2q3.fsf@rdklein.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.11; envelope-from=edou@rdklein.fr; helo=sender4-op-o11.zoho.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: , Cc: help-guix@gnu.org 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=1634379991; 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=IBTzYeAaOmOFi1wcxuDLGtaT0KfyRjpYORvbD4tW1aI=; b=OhTE7IDqP2qRreOf4jLilmaH5MoMGJjFYjUV7gqVcLEitLrT48ZOvmFbRTg/KT/5gbSW/N j7T3VA2bauo2kEFFXKTorj5vz6uXjqXZr5rAzr05eUGuxi3lSJVTqtY3MjsENaBPBw8vx8 DSdIOBDBGX11l287y/0k4Oyc34t0OiAhnJYX4K8dClzXV4OEpVCRCEIjH2byMlWdI3lTja saj28K7aj4Oth9ObSx91e/9GZf6+Did5VOdbXv1SZIkdgQXKUDrrv+cNsacDbOr9s8iKG/ KBxUsHU75tuWJlpTRlHbVcAvIwe+W3sx7ni7O47FIvVW4bfeI1NLJ4m4EycQ/g== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1634379991; a=rsa-sha256; cv=pass; b=tdMSMmidWeesrIDhTmQQHj+5cHBXPoFNN9NCWM/IY0SusCUEmnqzo265acaTCfGi63CAdE JRXhNomw5uCixpNNMfUjkfAQE5AdsdPjrf37LyWTR/F2YlqO1bvdi8TQrEkc7dyp3Wk9X7 EcUgANnkPmQc5VPQdKePBl0xBigLlvRrP9IfIkxNptu46m4nIiL5NvUwn2sodDuw/m0Vzr msWjk5itAhG92P7Bd4dy9JUNA31qS5JbLuGvu1OtY6LXpitifXcWs3PRXATusPxl/n2VS8 z+lrQX4Cfqq1nfH2gPwO0t6EAl+8c8tW7eKmypFovfjVr13HeXEKnj7Ha+YS8w== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=DR01BWSj; arc=pass ("zohomail.com:s=zohoarc:i=1"); 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: -3.42 Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=rdklein.fr header.s=zoho header.b=DR01BWSj; 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: 4780CA893 X-Spam-Score: -3.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: PZ2INN5ll6tP Hi, Sorry I can't be more precise due to lack of time, but maybe invoking chmod on the .sh files in a gexp would work ? https://www.gnu.org/software/guile/manual/html_node/File-System.html #+begin_quote Scheme Procedure: chmod object mode C Function: scm_chmod (object, mode) Changes the permissions of the file referred to by object. object can be a string containing a file name or a port or integer file descriptor which is open on a file (in which case fchmod is used as the underlying system call). mode specifies the new permissions as a decimal number, e.g., (chmod "foo" #o755). The return value is unspecified. #+end_quote. Fredrik Salomonsson writes: > Hi guix, > > I decided to try out guix home. But I hit a bit of a snag. I'm trying to > port my waybar config over to it, but cannot figure out how to set the > execution bit on my two custom scripts I have. > > This is what I currently have: > > #+begin_src scheme > (define-module (plt home waybar) > #:use-module (gnu services) > #:use-module (gnu home services) > #:use-module (gnu packages wm) > #:use-module (guix gexp) > #:use-module (guix utils) > #:use-module (ice-9 format)) > > (define-public packages > (list > waybar > )) > > (define %source-dir (current-source-directory)) > > (define-public (get-services host) > "Return services for HOST." > (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" > ,(local-file "files/waybar/modules-mic.sh")) > ("config/waybar/modules/storage.sh" > ,(local-file "files/waybar/modules-storage.sh")) > )))) > #+end_src > > > Which generates the config but the mic.sh and storage.sh bash scripts > are missing their execution bit. > > The bash scripts are really basic, for example here's the mic.sh: > > #+begin_src bash > #! /usr/bin/env bash > > mic_mute=3D$(pactl get-source-mute @DEFAULT_SOURCE@| cut -d" " -f2) > if [[ "$mic_mute" =3D=3D "yes" ]] > then > echo '{"text": "=EE=80=AB", "class": "muted", "percentage": 0 }' > else > echo '{"text": "=EE=80=A9", "class": "unmuted", "percentage": 100}' > fi > #+end_src > > > I played around with gexp but didn't get anything working. Closest I got > what by using program-file > > #+begin_src scheme > (define-public (get-services host) > "Return services for HOST." > (let ((mic-script (program-file > "mic.sh" > #~(execl #$(local-file "files/waybar/modules-mic.s= h") "mic.sh"))) > (storage-script (program-file > "storage.sh" > #~(execl #$(local-file "files/waybar/modules-s= torage.sh") "storage.sh")))) > (list > (simple-service 'plt-waybar-config > home-files-service-type > `( > ("config/waybar/config" > ,(local-file (format #f "~a/files/waybar/~a.con= f" %source-dir host))) > ("config/waybar/style.css" > ,(local-file (format #f "~a/files/waybar/~a-sty= le.css" %source-dir host))) > ("config/waybar/modules/mic.sh" > ,mic-script) > ("config/waybar/modules/storage.sh" > ,storage-script) > ))))) > #+end_src > > But it's still trying to execute the original scripts and fail due to > the execution bit. > > I'm probably missing something obvious, but I haven't used gexp before. > > How do you set the execution bit on a file-like object?=20 > > Or is there a better approach for dealing with these? Package them up > perhaps? As I just realized when writing this that I also need to patch > the shebang to point to the bash guix-home is using. > > Thanks