Hello, Nikita Karetnikov <[email protected]> skribis:
>> things related to command-line tools, such as options documented and >> not implemented in ‘guix-package’; > > I'd like to implement '--roll-back' and '--search'. Cool! > Questions: > > scheme@(guile-user)> ,use (guix-package) > scheme@(guile-user)> %current-profile > $1 = "/nix/var/nix/profiles/per-user/root/guix-profile" > scheme@(guile-user)> %profile-directory > $2 = "/nix/var/nix/profiles/per-user/root" > scheme@(guile-user)> %user-environment-directory > $3 = "/root/.guix-profile" > > 'ls' doesn't list the above. Why? $1 gets created only once you’ve run ‘guix-package --install’. And $3 has to be created manually, currently. Probably ‘guix-package’ should create it automatically. It’s just a fixed symlink to $1. > How should '--roll-back' work? Just change /nix/var/nix/profiles/per-user/root/guix-profile to point to /nix/var/nix/profiles/per-user/root/guix-PREV-profile, where PREV is the previous generation number (see ‘latest-profile-number’ in guix-package.) > Does Guix support multiple profiles? Yes: see the --profile option of guix-package. Same as for nix-env. > Nix uses the following scheme. [1] > > # ls /nix/var/nix/profiles/ > default default-2-link default-5-link default-8-link > default-10-link default-3-link default-6-link default-9-link > default-1-link default-4-link default-7-link per-user > > What function should be used to access the pointee of 'guix-profile'? You could use (readlink %current-profile), and then the %PROFILE-RX regexp of ‘latest-profile-number’ to extract the profile number. > I assume that it should work like this: > > 1. Get the pointee of 'guix-profile'. > > 2. Parse the name of the pointee. > > 3. Decrement the number and save that as '%current-profile'. Yes, that’s the idea. And then (delete-file %current-profile) and (symlink new-profile %current-profile). > Should 'guix-package' also support '--switch-generation', Likewise: delete %current-profile and make it point elsewhere. > '--list-generations', List the files in %PROFILE-DIRECTORY matching %PROFILE-RX. > and '--switch-profile'? [1] Not sure about this one, but it’s basically changing a symlink’s target again. > How to implement '--search'? User would provide a regexp, and you would use ‘fold-packages’ to traverse all the packages and pattern-match each synopsis and description, and return the matching packages. How does that sound? Thanks! Ludo’.
