LnL7 / nix-darwin

nix modules for darwin
MIT License
2.82k stars 431 forks source link

(re)install fails with nonexistent path in nix-store #946

Closed ahihi closed 4 months ago

ahihi commented 4 months ago

i have been running a flake-based nix-darwin setup for about half a year on Sonoma, but it seems a recent update broke my PATH. at this point i was not aware of https://github.com/LnL7/nix-darwin/wiki/Upgrading-macOS and decided to start from a clean slate, so i uninstalled Nix. however i did make the mistake of not uninstalling nix-darwin first, so i followed https://github.com/LnL7/nix-darwin/issues/542#issuecomment-1270691308 to do it manually.

now, i have reinstalled Nix successfully, but when i try to do nix run nix-darwin --show-trace -- switch --flake . in my flake directory, i get:

error (ignored): error: end of string reached
error:
       … from call site
         at /nix/store/a21fcz0fgrixwrcxw63xccrzjhb6xnym-source/flake.nix:6:21:
            5|   outputs = { self, nixpkgs }: let
            6|     forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-darwin" ];
             |                     ^
            7|   in {

       … while calling anonymous lambda
         at «nix-internal»/call-flake.nix:57:25:
           56|           inputs = builtins.mapAttrs
           57|             (inputName: inputSpec: allNodes.${resolveInput inputSpec})
             |                         ^
           58|             (node.inputs or {});

       … from call site
         at «nix-internal»/call-flake.nix:57:36:
           56|           inputs = builtins.mapAttrs
           57|             (inputName: inputSpec: allNodes.${resolveInput inputSpec})
             |                                    ^
           58|             (node.inputs or {});

       … while calling anonymous lambda
         at «nix-internal»/call-flake.nix:39:13:
           38|     builtins.mapAttrs
           39|       (key: node:
             |             ^
           40|         let

       … in the condition of the assert statement
         at «nix-internal»/call-flake.nix:79:13:
           78|           if node.flake or true then
           79|             assert builtins.isFunction flake.outputs;
             |             ^
           80|             result

       … while calling the 'isFunction' builtin
         at «nix-internal»/call-flake.nix:79:20:
           78|           if node.flake or true then
           79|             assert builtins.isFunction flake.outputs;
             |                    ^
           80|             result

       … while calling the 'import' builtin
         at «nix-internal»/call-flake.nix:54:19:
           53|
           54|           flake = import (outPath + "/flake.nix");
             |                   ^
           55|

       … while realising the context of a path

       … while calling the 'fetchTree' builtin
         at «nix-internal»/call-flake.nix:48:15:
           47|               # FIXME: remove obsolete node.info.
           48|               fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);
             |               ^
           49|

       … while fetching the input 'path:/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source?lastModified=1687274257&narHash=sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF%2B/SUBNnAOE%3D&rev=2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5'

       error: path '/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source' does not exist

i dont know where this path is coming from, but i assume i missed something in my manual uninstallation attempt. any idea what might cause this?

ahihi commented 4 months ago

ok, i expected i could skip the first step https://github.com/LnL7/nix-darwin#step-1-creating-flakenix since i already have a flake.nix, but actually first setting up with this barebones flake.nix and then switching to my own makes it work :)