summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xbin/home-manager54
-rw-r--r--lib/default.nix2
2 files changed, 5 insertions, 51 deletions
diff --git a/bin/home-manager b/bin/home-manager
index de6f4edb..39ed1639 100755
--- a/bin/home-manager
+++ b/bin/home-manager
@@ -29,40 +29,9 @@ for i in 1
         echo "user home-manager configuration folder $hm_config_dir does not exist, creating it"
         mkdir -p $hm_config_dir
     end
-    if test ! -e $channel_root
-        if test -L $channel_root
-            # broken symlink
-            rm $channel_root
-        end
-        echo "channel root $channel_root does not exist, creating it"
-        mkdir -p $channel_root
-    else
-        if test ! -d $channel_root
-            echo "error: $channel_root is not a directory"
-        else if test -L $channel_root
-            echo "error: $channel_root is a symlink, please remove it"
-        else if path is --invert --perm write $channel_root
-            echo "error: $channel_root is not writable; might be a symlink"
-        else if path is --invert --type link $channel_root/*
-            for p in (path filter --invert --type link $channel_root/*)
-                # might be a broken symlink
-                if test -L $p -a ! -e $p
-                    rm $p
-                else
-                    echo "error: channel $p is not a broken symlink, don't know what to do with it"
-                end
-            end
-            # check again and fail if there are still unknown files
-            if path is --invert --type link $channel_root/*
-                echo "error: non-link(s) in $channel_root"
-                path filter --invert --type link $channel_root/*
-            else
-                continue
-            end
-        else
-            continue # with script
-        end
-        exit 1
+    if test -e $channel_root
+        rm $channel_root/* || exit 1
+        rmdir $channel_root
     end
 end
 
@@ -94,8 +63,6 @@ switch $current_script_name
         set --export HOME_MANAGER_CONFIG $hm_config_source
 end
 
-set --function old_channels (path basename $channel_root/*)
-
 function update_link --argument-names new_src target
     set --function current_src (path resolve $target)
     if test -e $current_src
@@ -110,25 +77,12 @@ function update_link --argument-names new_src target
 end
 
 for np in $NIX_PATH
-    echo $np | read --function --delimiter "=" channel new_src_rel
-    set --local new_src (path resolve $new_src_rel)
+    echo $np | read --function --delimiter "=" channel new_src
 
-    if test $channel = darwin-config
-        continue
-    end
     if test $channel = nixpkgs-overlays
         update_link $new_src $user_nixpkgs/overlays
         continue
     end
-    if set --local i (contains --index $channel $old_channels)
-        set --erase old_channels[$i]
-    end
-
-    update_link $new_src $channel_root/$channel
-end
-
-for old in $channel_root/$old_channels
-    rm $old
 end
 
 set --function i (contains --index (status dirname) $PATH)
diff --git a/lib/default.nix b/lib/default.nix
index 93f64059..023566e5 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -10,7 +10,7 @@ rec {
     if
       s.type == "local"
     then
-      lib.path.append ../. s.outPath
+      toString (lib.path.append ../. s.outPath)
     else
       toString s.outPath
   ;