"error: executing 'git': No such file or directory" when updating flake

Hi! After untracking flake.lock in my git repo, when I try to update my flake I get this error:

[root@host-1:~]# nix flake update --flake /etc/nixos
warning: updating lock file '"/etc/nixos/flake.lock"':
• Added input 'cosmic-manager':
    'github:HeitorAugustoLN/cosmic-manager/52d3fdd080a9dd4639948687682a68282fbf0314?narHash=sha256-O39zTv7LdRgr4Hw38d%2BeQG2LYpP75rw2XKqTGV5qzgs%3D' (2025-04-11)
• Added input 'cosmic-manager/flake-parts':
    'github:hercules-ci/flake-parts/32ea77a06711b758da0ad9bd6a844c5740a87abd?narHash=sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm%2BzmZ7vxbJdo%3D' (2025-02-01)
• Added input 'cosmic-manager/flake-parts/nixpkgs-lib':
    follows 'cosmic-manager/nixpkgs'
• Added input 'cosmic-manager/home-manager':
    follows 'home-manager'
• Added input 'cosmic-manager/nixpkgs':
    follows 'nixpkgs-unstable'
• Added input 'home-manager':
    'github:nix-community/home-manager/faeab32528a9360e9577ff4082de2d35c6bbe1ce?narHash=sha256-QLilaHuhGxiwhgceDWESj9gFcKIdEp7%2B9lRqNGpN8S4%3D' (2025-06-11)
• Added input 'home-manager/nixpkgs':
    follows 'nixpkgs-unstable'
• Added input 'hyprland':
    'github:hyprwm/Hyprland/412c7dc7f79cb6b04af41692504e82d4417e6e13?narHash=sha256-3MiuAUQBo9Luk0lNzNSuomx1WMMBua2feVjXNfg9Dws%3D' (2025-06-11)
• Added input 'hyprland/aquamarine':
    'github:hyprwm/aquamarine/94981cf75a9f11da0b6dd6a1abbd7c50a36ab2d3?narHash=sha256-t0HfHg/1%2BTbSra5s6nNM0o4tnb3uqWedShSpZXsUMYY%3D' (2025-06-05)
• Added input 'hyprland/aquamarine/hyprutils':
    follows 'hyprland/hyprutils'
• Added input 'hyprland/aquamarine/hyprwayland-scanner':
    follows 'hyprland/hyprwayland-scanner'
• Added input 'hyprland/aquamarine/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/aquamarine/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprcursor':
    'github:hyprwm/hyprcursor/45fcc10b4c282746d93ec406a740c43b48b4ef80?narHash=sha256-XR9fsI0zwLiFWfqi/pdS/VD%2BYNorKb3XIykgTg4l1nA%3D' (2025-06-05)
• Added input 'hyprland/hyprcursor/hyprlang':
    follows 'hyprland/hyprlang'
• Added input 'hyprland/hyprcursor/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprcursor/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprgraphics':
    'github:hyprwm/hyprgraphics/c7225d73755a6c4c7c72f4d4f3925ea426e325a8?narHash=sha256-8qiKEWcxUrjpUpK%2BWyFNg/72C8rp70LUuyTD23T%2BSdQ%3D' (2025-06-06)
• Added input 'hyprland/hyprgraphics/hyprutils':
    follows 'hyprland/hyprutils'
• Added input 'hyprland/hyprgraphics/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprgraphics/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprland-protocols':
    'github:hyprwm/hyprland-protocols/613878cb6f459c5e323aaafe1e6f388ac8a36330?narHash=sha256-kymV5FMnddYGI%2BUjwIw8ceDjdeg7ToDVjbHCvUlhn14%3D' (2025-06-04)
• Added input 'hyprland/hyprland-protocols/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprland-protocols/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprland-qtutils':
    'github:hyprwm/hyprland-qtutils/396e8aa1c06274835b69da7f9a015fff9a9b7522?narHash=sha256-t1PM0wxQLQwv2F2AW23uA7pm5giwmcgYEWbNIRct9r4%3D' (2025-06-05)
• Added input 'hyprland/hyprland-qtutils/hyprland-qt-support':
    'github:hyprwm/hyprland-qt-support/4c8053c3c888138a30c3a6c45c2e45f5484f2074?narHash=sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE%3D' (2025-06-05)
• Added input 'hyprland/hyprland-qtutils/hyprland-qt-support/hyprlang':
    follows 'hyprland/hyprland-qtutils/hyprlang'
• Added input 'hyprland/hyprland-qtutils/hyprland-qt-support/nixpkgs':
    follows 'hyprland/hyprland-qtutils/nixpkgs'
• Added input 'hyprland/hyprland-qtutils/hyprland-qt-support/systems':
    follows 'hyprland/hyprland-qtutils/systems'
• Added input 'hyprland/hyprland-qtutils/hyprlang':
    follows 'hyprland/hyprlang'
• Added input 'hyprland/hyprland-qtutils/hyprutils':
    follows 'hyprland/hyprland-qtutils/hyprlang/hyprutils'
• Added input 'hyprland/hyprland-qtutils/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprland-qtutils/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprlang':
    'github:hyprwm/hyprlang/1bfb84f54d50c7ae6558c794d3cfd5f6a7e6e676?narHash=sha256-qr0KXeczF8Sma3Ae7%2BdR2NHhvG7YeLBJv19W4oMu6ZE%3D' (2025-06-05)
• Added input 'hyprland/hyprlang/hyprutils':
    follows 'hyprland/hyprutils'
• Added input 'hyprland/hyprlang/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprlang/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprutils':
    'github:hyprwm/hyprutils/e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb?narHash=sha256-Q8mAKMDsFbCEuq7zoSlcTuxgbIBVhfIYpX0RjE32PS0%3D' (2025-06-05)
• Added input 'hyprland/hyprutils/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprutils/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/hyprwayland-scanner':
    'github:hyprwm/hyprwayland-scanner/817918315ea016cc2d94004bfb3223b5fd9dfcc6?narHash=sha256-IHaGWpGrv7seFWdw/1A%2BwHtTsPlOGIKMrk1TUIYJEFI%3D' (2025-06-05)
• Added input 'hyprland/hyprwayland-scanner/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/hyprwayland-scanner/systems':
    follows 'hyprland/systems'
• Added input 'hyprland/nixpkgs':
    'github:NixOS/nixpkgs/d3d2d80a2191a73d1e86456a751b83aa13085d7d?narHash=sha256-QuUtALJpVrPnPeozlUG/y%2BoIMSLdptHxb3GK6cpSVhA%3D' (2025-06-05)
• Added input 'hyprland/pre-commit-hooks':
    'github:cachix/git-hooks.nix/80479b6ec16fefd9c1db3ea13aeb038c60530f46?narHash=sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo%2BbnXU9D9k%3D' (2025-05-16)
• Added input 'hyprland/pre-commit-hooks/flake-compat':
    'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04)
• Added input 'hyprland/pre-commit-hooks/gitignore':
    'github:hercules-ci/gitignore.nix/637db329424fd7e46cf4185293b9cc8c88c95394?narHash=sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs%3D' (2024-02-28)
• Added input 'hyprland/pre-commit-hooks/gitignore/nixpkgs':
    follows 'hyprland/pre-commit-hooks/nixpkgs'
• Added input 'hyprland/pre-commit-hooks/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/systems':
    'github:nix-systems/default-linux/31732fcf5e8fea42e59c2488ad31a0e651500f68?narHash=sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80%3D' (2023-07-14)
• Added input 'hyprland/xdph':
    'github:hyprwm/xdg-desktop-portal-hyprland/44bf29f1df45786098920c655af523535a9191ae?narHash=sha256-KIkJu3zF8MF3DuGwzAmo3Ww9wsWXolwV30SjJRTAxYE%3D' (2025-06-05)
• Added input 'hyprland/xdph/hyprland-protocols':
    follows 'hyprland/hyprland-protocols'
• Added input 'hyprland/xdph/hyprlang':
    follows 'hyprland/hyprlang'
• Added input 'hyprland/xdph/hyprutils':
    follows 'hyprland/hyprutils'
• Added input 'hyprland/xdph/hyprwayland-scanner':
    follows 'hyprland/hyprwayland-scanner'
• Added input 'hyprland/xdph/nixpkgs':
    follows 'hyprland/nixpkgs'
• Added input 'hyprland/xdph/systems':
    follows 'hyprland/systems'
• Added input 'nix-flatpak':
    'github:gmodena/nix-flatpak/5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177?narHash=sha256-iAVVHi7X3kWORftY%2BLVbRiStRnQEob2TULWyjMS6dWg%3D' (2025-02-13)
• Added input 'nix-index-db':
    'github:nix-community/nix-index-database/40a6e15e44b11fbf8f2b1df9d64dbfc117625e94?narHash=sha256-L17CdJMD%2B/FCBOHjREQLXbe2VUnc3rjffenBbu2Kwpc%3D' (2025-06-08)
• Added input 'nix-index-db/nixpkgs':
    follows 'nixpkgs-unstable'
• Added input 'nixos-cosmic':
    'github:lilyinstarlight/nixos-cosmic/8fb23a149c209046b8ad16874826756235e73fdd?narHash=sha256-fnQeXowOTEct5iZZ5oUKqsBQfdvdyaEtSAz1sFhO40I%3D' (2025-06-10)
• Added input 'nixos-cosmic/flake-compat':
    'github:nix-community/flake-compat/0f158086a2ecdbb138cd0429410e44994f1b7e4b?narHash=sha256-5SSSZ/oQkwfcAz/o/6TlejlVGqeK08wyREBQ5qFFPhM%3D' (2025-05-02)
• Added input 'nixos-cosmic/nixpkgs':
    'github:NixOS/nixpkgs/3e3afe5174c561dee0df6f2c2b2236990146329f?narHash=sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU%3D' (2025-06-07)
• Added input 'nixos-cosmic/nixpkgs-stable':
    'github:NixOS/nixpkgs/ed29f002b6d6e5e7e32590deb065c34a31dc3e91?narHash=sha256-ENY3y3v6S9ZmLDDLI3LUT8MXmfXg/fSt2eA4GCnMVCE%3D' (2025-06-06)
• Added input 'nixos-cosmic/rust-overlay':
    'github:oxalica/rust-overlay/d0727dbab79c5a28289f3c03e4fac7d5b95bafb3?narHash=sha256-lEhEK8qE8xto2Wnj4f7R%2BVRSg7M6tgTTkJVTZ2QxXOI%3D' (2025-06-10)
• Added input 'nixos-cosmic/rust-overlay/nixpkgs':
    follows 'nixos-cosmic/nixpkgs'
• Added input 'nixpkgs':
    'github:NixOS/nixpkgs/a12f3a99614894502e73eb816e9e076b0ab05730?narHash=sha256-DUVAe8E2X2QM0dAnTGlTiqemMqUMMyIeCH7UeNo0g64%3D' (2025-06-10)
• Added input 'nixpkgs-24-11':
    'github:nixos/nixpkgs/8fe3e32e7f210522377c3bcff80931a3284ace6a?narHash=sha256-b9GIWdF/8jKpCC5JIMgDLZgwe8cEbty2fyTyo1eDFfI%3D' (2025-06-09)
• Added input 'nixpkgs-25-05':
    'github:nixos/nixpkgs/88331c17ba434359491e8d5889cce872464052c2?narHash=sha256-FG4DEYBpROupu758beabUk9lhrblSf5hnv84v1TLqMc%3D' (2025-06-09)
• Added input 'nixpkgs-unstable':
    'github:nixos/nixpkgs/3e3afe5174c561dee0df6f2c2b2236990146329f?narHash=sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU%3D' (2025-06-07)
• Added input 'plasma-manager':
    'github:nix-community/plasma-manager/b7697abe89967839b273a863a3805345ea54ab56?narHash=sha256-1iHjsH6/5UOerJEoZKE%2BGx1BgAoge/YcnUsOA4wQ/BU%3D' (2025-05-25)
• Added input 'plasma-manager/home-manager':
    follows 'home-manager'
• Added input 'plasma-manager/nixpkgs':
    follows 'nixpkgs-unstable'
• Added input 'yazi':
    'github:sxyazi/yazi/0eec8fc80e60d27306f1ada0c72b0eac5a224000?narHash=sha256-KeOLMDSq/uFQ8RW5abRHqpWzezxBh7m7tlchw%2BgeAZ8%3D' (2025-06-11)
• Added input 'yazi/flake-utils':
    'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13)
• Added input 'yazi/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D' (2023-04-09)
• Added input 'yazi/nixpkgs':
    'github:NixOS/nixpkgs/b1bebd0fe266bbd1820019612ead889e96a8fa2d?narHash=sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo%3D' (2025-05-15)
• Added input 'yazi/rust-overlay':
    'github:oxalica/rust-overlay/0e624f2b1972a34be1a9b35290ed18ea4b419b6f?narHash=sha256-N4dwkRBmpOosa4gfFkFf/LTD8oOcNkAyvZ07JvRDEf0%3D' (2025-05-16)
• Added input 'yazi/rust-overlay/nixpkgs':
    follows 'yazi/nixpkgs'
error: executing 'git': No such file or directory
error: executing 'git': No such file or directory
error:
       … while updating the lock file of flake 'git+file:///etc/nixos?ref=refs/heads/main&rev=cab2310dde7225aa35999f8c214254aa40470d8a'

       error: program 'git' failed with exit code 1

[root@dell-1:~]# which git
which: no git in (/run/wrappers/bin:/root/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/root/.nix-profile/bin:/nix/profile/bin:/root/.local/state/nix/profile/bin:/etc/profiles/per-user/root/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)

[root@dell-1:~]# 

Is it because git is not installed for root user? I think so, for when I executed `nix-shell -p git --run ‘nix flake update --flake /etc/nixos’ it didn’t threw me any errors.
Can you guys help me out with this one?
Best,
Miro

That error means, that git wasn’t in PATH, yes.

Consider moving the files to a directory you have write permissions on (like your /home), so you don’t need to use sudo for updating your flake.

1 Like

By the way, this is bad practice; lockfiles are part of the code.

I am a member of nix group and nix group has write permissions on /etc/nixos directory.

Okay, thanks. But why it wasn’t? Just a minute ago it was…

We do not know your configuration. Nor how else you had the environment.

  1. Why are you logged in as root then?
  2. This will make a fine addition to my collection of “ugly hacks people keep coming up with to deal with /etc/nixos:grin:.
1 Like

My conf is a set of over a hundred files… And I don’t like sharing some personal info e. g. about usernames. If you could tell me what is important I will be glad to paste it here :slightly_smiling_face:

  1. I don’t like typing sudo and my password every time I rebuild when I test some stuff :grin:
  2. :joy:

how you think you install git for the system or root user. But in general, I do consider it a flaw to use git as root, similar to how I consider it a flaw to ever actually login as root or otherwise get into an interactive session “as root”.

sudo is the way to go. And if you hat to enter the password disable the prompt for wheel or increase the timeout as a balance between “remind me that I might doing something stupid” and “its convinient to not get reminded about my stupidity”

1 Like

Well, I didn’t install git for the root user. Anyway, when I started tracking flake.lock it works. Thank you for your help!