snowfallorg / nix-software-center

A simple gtk4/libadwaita software center to easily install and manage nix packages
GNU General Public License v3.0
572 stars 16 forks source link

Error when installing to configuration.nix #52

Open iopq opened 1 year ago

iopq commented 1 year ago

When I tried to install mission-center I got this error

path '/etc/nixos/flake.nix' does not contain a 'flake.nix', searching up
error:
       … while fetching the input 'git+file:///etc/nixos'

       error: getting the HEAD of the Git tree '/etc/nixos' failed with exit code 1:
       error: executing 'git': No such file or directory

nixos-rebuild failed with exit code 1
nixos-rebuild failed
FatalError93 commented 10 months ago

I'm getting same error, any progress on your side?

iopq commented 9 months ago

Yes,

https://github.com/iopq/nixos-conf/blob/desktop/configuration.nix https://github.com/iopq/nixos-conf/blob/desktop/flake.nix

this is the flakes way of installing it

iopq commented 6 months ago

Even though I did it the flakes way, I get this error when trying to install software to configuration.nix (not when installing to profile, which works fine)

Virtual-Java commented 5 months ago

I am getting the same error. Since I changed to NixOS with flakes enabled I am getting this error every time my NixOS configuration has changed by the SoftwareCenter itself. This means when I want to install a new application via SoftwareCenter and select system wide installation it fails. I opened a terminal tracking [user@hostname:/etc/nixos]$ to see what happens to my NixOS configuration files which are tracked by a git repository. The selected configuration file (I tested with host independent "configuration.nix" and host dependent "default.nix" containing all host-dependent data and "appcenter.nix" containing only the packages input) is being edited by SoftwareCenter and only a few moments later on it fails with above error "path '/etc/nixos/flake.nix' does not contain a 'flake.nix', searching up error:" and a second error "git tree is dirty". At the same time it changes back the line inserted to the packages array in the selected nix-configuration. When I wait for the short moment, add the configuration file just edited by SoftwareCenter and commit the file with inserted content e.g. "gnome.gnome-sudoku" using git manually in my terminal, SoftwareCenter was able to build the next time i pressed the install button.

So I think this issue at least for me is related to SoftwareCenter changes files in nixOS configuration directory /etc/nixos which is tracked by git, but itself does not add these changes to a new commit!!!

Please add a option for ApplicationCenter being able to create git commits with massages like "Install ' to global configuration 'just-selected-configuration-file' by SoftwareCenter". This may resolve issues caused by missing use of git.

Another issue related to this is #59. All the time I tried to check which file was used as my configuration by SoftwareCenter the file was not set in the box of the graphical preferences interface anymore. The option for flakes was not displayed and the box only folded out after toggling the option to enable flakes several times. Therefore I had to enter the files several times again to grant to get reproducible failures when installing the same application.