Code Monkey home page Code Monkey logo

Comments (4)

Gerschtli avatar Gerschtli commented on July 30, 2024 7

I would like to give my point of view to this issue:

It would be a nice feature if lorri could show an overview of all current used gc roots with the ability to select one or more and remove these gc roots.

For example:

$ lorri gc-roots --show
  1: /home/user/projects/example1
  2: /tmp/test-lorri1
  3: /home/user/projects/deprecated-project

$ lorri gc-roots --delete 3

My use case is that I want to remove gc roots of testing environments or deprecated projects I used, so an "overview" command is definitely necessary in my opinion.

I would love to help with this kind of feature, once the cli design is set.

BTW: Very nice work with this project!

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

Since we’ve removed the .lorri directory from the project and are moving to hashed project paths as gcroot names, the disconnect is gonna be even bigger.

How about adding a plumbing command for now, lorri rm-gc-roots_ [--for <nix file>] (defaulting to .) until we get a better overview of what users need in practice?

from lorri.

Profpatsch avatar Profpatsch commented on July 30, 2024

This is a good candidate for contribution. Implementing the plumbing command I mentioned above should be fairly easy.

Any takers? :)

from lorri.

hmenke avatar hmenke commented on July 30, 2024

For me personally it would be sufficient if lorri just kept a reference to the source next to the gcroot. Then I can use a normal bash script to produce a list of used and unused gcroots.

For that I guess adding something like this would be the way to go? (No idea whether that compiles, I don't really speak Rust)

--- a/src/project.rs
+++ b/src/project.rs
@@ -34,14 +34,20 @@ impl Project {
         gc_root_dir: &Path,
         cas: ContentAddressable,
     ) -> std::io::Result<Project> {
+        let nix_file_path = nix_file.as_path().as_os_str().as_bytes();
+
         let hash = format!(
             "{:x}",
-            md5::compute(nix_file.as_path().as_os_str().as_bytes())
+            md5::compute(nix_file_path)
         );
-        let project_gc_root = gc_root_dir.join(&hash).join("gc_root");
+        let project_dir = gc_root_dir.join(&hash);
+        let project_gc_root = project_dir.join("gc_root");
 
         std::fs::create_dir_all(&project_gc_root)?;
 
+        let mut file = File::create(project_dir.join("ref"))?;
+        file.write_all(nix_file_path)?;
+
         Ok(Project {
             nix_file,
             gc_root_path: project_gc_root,

For each new gcroot this would create a file which contains the path to the shell.nix that it was created with

$ cat ~/.cache/lorri/gc_roots/<hash>/gc_root/ref
/path/to/shell.nix

In principle ref could also be a symlink to shell.nix but I don't know whether there are any adversary interactions with being a gcroot.

from lorri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.