Subject: [PATCH v1 0/2] Add perp support in guix-install.sh for Dragora.

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Wed, 7 Aug 2024 17:00:02 +0200

Hi,

When installing guix through guix-install.sh in Dragora the init system is not
detected, so this serie fixes that.

I also included a package for perp itself in case that can help getting
familiar with it to review the patch for guix-install.sh. I've not tested if
it works on top of Guix though, but it's handy as the manuals are present for
instance.

Also note that for the perp service for guix-install.sh, I took inspiration
from the perp services inside the examples directory in perp source code.

As for the guix-install.sh I've tested various pieces separately but not
together as doing that would require the patch to be in Guix in the fist
place:

* I've tested that the guix daemon is started and stopped correctly by
  guix-install.sh once the files are in the right place.

* I've tested that the logs are produced. They end up in
  /var/log/guix-daemon/current.

* I've also tested (without guix-install.sh) that 'perpctl A guix-daemon'
  really starts the service and that then at the next boot the service is
  running too. I also tested 'perpctl X guix-daemon' in the same way.

* I've tested that /etc/perp/guix-daemon/{rc.main,rc.log} are in the right
  place.

* I've tested that the variables are passed to the guix-daemon by replacing it
  with very simple C code below that prints variables, and by also exporting
  TESTGNUTOO (and assigining it some value) to make sure that the variable is
  really passed by /etc/perp/rc.main and not by something else like bashrc.

  /*
  * Copyright © 2024 Denis 'GNUtoo' Carikli <[email-masked]>
  *
  * This file is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or (at
  * your option) any later version.
  *
  * This file is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this file.  If not, see <http://www.gnu.org/licenses/>.
  */
  
  #include <stdio.h>
  #include <string.h>
  #include <unistd.h>
  
  extern char **environ;
  
  int print_entry(char *var1, char *var2)
  {
  	int i;
  	char *curr;
  
  	for (i=0; ; i++) {
  		curr = environ[i];
  		if (curr == NULL)
  			break;
  
  		if (!strncmp(var1, curr, strlen(var1)))
  			printf("%s: [%s]\n", var1, curr);
  		else if (!strncmp(var2, curr, strlen(var2)))
  			printf("%s: [%s]\n", var2, curr);
  	}  
  }
  
  int main()
  {
  	while(1) {
  		print_entry("GUIX_LOCPATH", "TESTGNUTOO");
  		sleep(1);
  	}
  }

Denis 'GNUtoo' Carikli (2):
  gnu: Add perp.
  guix-install.sh: Support perp.

 .gitignore             |  2 ++
 etc/guix-install.sh    | 25 +++++++++++++++++++++++
 etc/perp/rc.log.in     | 24 ++++++++++++++++++++++
 etc/perp/rc.main.in    | 45 ++++++++++++++++++++++++++++++++++++++++++
 gnu/packages/admin.scm | 33 +++++++++++++++++++++++++++++++
 nix/local.mk           | 17 +++++++++++++++-
 6 files changed, 145 insertions(+), 1 deletion(-)
 create mode 100644 etc/perp/rc.log.in
 create mode 100644 etc/perp/rc.main.in

base-commit: 5e567587dd4abf51f9a6fa44f5a852dde1115ce9
-- 
2.45.2