diff options
| author | ยท๐๐ด๐๐๐ฉ๐ค | 2026-01-02 18:15:34 +0000 |
|---|---|---|
| committer | ยท๐๐ด๐๐๐ฉ๐ค | 2026-01-02 18:15:34 +0000 |
| commit | 034a4c5c3be5ffe5f15633214746b05ed69bf548 (patch) | |
| tree | 4cfe6c80e28e109af59db630c0475f3ff67e76d6 /lib/input_foreman.ml | |
| parent | 939ebcc0ff3414083bb6d1bbd366aca64dfd4f6b (diff) | |
| download | nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar.gz nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar.bz2 nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar.lz nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar.xz nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.tar.zst nixtaml-034a4c5c3be5ffe5f15633214746b05ed69bf548.zip | |
Silo: make names a folder for the future
Diffstat (limited to 'lib/input_foreman.ml')
| -rw-r--r-- | lib/input_foreman.ml | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/input_foreman.ml b/lib/input_foreman.ml index 4c38dcb..dec3f32 100644 --- a/lib/input_foreman.ml +++ b/lib/input_foreman.ml @@ -190,6 +190,15 @@ let unlink_or_rm_silo ~(at : [`Path of _ Eio.Path.t | `Name of Name.t]) = | _ -> () +(* TODO: make + .silo/{name}/elotl + .silo/{name}/milpa + .silo/{name}/by-hash + + Where elotl (ear of maize) refers to the one using now & milpa + (maizefield) refers to the generation. This is similar to profiles & + could allow rollbacks & such. +*) let make_silo_gc_root ~proc_mgr ~name ~store_path = let name = Name.take name in let silo_path = Eio.Path.(Working_directory.(get () / silo_dir)) in @@ -200,12 +209,20 @@ let make_silo_gc_root ~proc_mgr ~name ~store_path = | _ -> failwith (Fmt.str "%a not a directory" Eio.Path.pp silo_path) end; let path = Eio.Path.(silo_path / name) in - Logs.info (fun m -> m "Silo: filling with %s โฆ %s โฆ" name store_path); - unlink_or_rm_silo ~at: (`Path path); + begin + match Eio.Path.kind ~follow: false path with + | `Directory -> () + | `Symbolic_link -> Eio.Path.unlink path; + | `Regular_file | `Socket -> Eio.Path.rmtree path; + | _ -> () + end; + Logs.info (fun m -> m "Silo: elotl now %s โฆ %s โฆ" name store_path); + let elotl_path = Eio.Path.(path / "elotl") in + unlink_or_rm_silo ~at: (`Path elotl_path); Eio.Process.run proc_mgr [ "nix-store"; "--add-root"; - Eio.Path.native_exn path; + Eio.Path.native_exn elotl_path; "--realize"; store_path ] |
