GNU bug report logs - #60521
[PATCH] home: Add home-stow-migration-service.

Previous Next

Package: guix-patches;

Reported by: goodoldpaul <at> autistici.org

Date: Tue, 3 Jan 2023 16:53:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #124 received at 60521 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>, andrew <at> trop.in,
 60521 <at> debbugs.gnu.org
Subject: Re: [bug#60521] [PATCH] home: Add home-stow-migration-service.
Date: Sat, 27 Jan 2024 21:21:02 +0100
Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi!
>
> Giacomo Leidi <goodoldpaul <at> autistici.org> skribis:
>
>> * gnu/home/services.scm (dotfiles-for-app): New variable;
>> (home-stow-migration-configuration): new variable;
>> (home-stow-migration-service): new variable.
>> * doc/guix.texi: Document it.
>
> That looks very useful!
>
Does it really warrant a new service, when what's needed is a 
procedure which traverses a directory recursively and returns a 
list of file-likes?

I have this in my home.scm:

--8<---------------cut here---------------start------------->8---
(define (del-prefix p str)
 (if (string-prefix? p str)
     (substring/shared str (string-length p))
     str))

(define* (as-local-files dir #:optional (trim-prefix dir))
 (let ((absolute-dir (string-append (getcwd) "/" dir))
       (to-trim (string-append (getcwd) "/" trim-prefix "/")))
   (map (lambda (fn)
          (list
           (del-prefix to-trim fn)
           (local-file (canonicalize-path fn) (del-prefix "." 
           (basename fn)) #:recursive? #t)))
        (find-files absolute-dir))))

(simple-service 'configs
               home-files-service-type
               append!
               (with-directory-excursion 
               (current-source-directory)
               `(,@(as-local-files "../backup")
                 ,@(as-local-files "../android")
                 ,@(as-local-files "../email")
                 ,@(as-local-files "../xsession")
                 ,@(as-local-files "../git")
                 ,@(as-local-files "../qutebrowser")
                 ,@(as-local-files "../desktop"))))
--8<---------------cut here---------------end--------------->8---

And the only need for this snippet is because there are filenames 
starting with dot and they can't be put in store as is.




This bug report was last modified 1 year and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.