nix-software-center icon indicating copy to clipboard operation
nix-software-center copied to clipboard

FR: support for multi-files configuration.nix

Open Zahrun opened this issue 2 years ago • 2 comments

My main configuration file is /etc/nixox/configuration.nix, however, I keep my environment.systemPackages in aroun.nix and have import in configuration.nix via

imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ./aroun.nix
    ];

If the sofware-center parser could open the files under imports, parse them, and find the location of environment.systemPackages, that would be great

cf. https://github.com/vlinkz/nixos-conf-editor/issues/7

Zahrun avatar Mar 06 '23 21:03 Zahrun

May not be exactly what you're looking for, but if you have a specific file containing environment.systemPackages that you want the software center to use, selecting that instead of configuration.nix in the preferences should work. But parsing imports is definitely something that would greatly expand configuration flexibility using this program!

vlinkz avatar Mar 14 '23 02:03 vlinkz

Yes, for now I just point to the file where I have most of my systemPackages, and that works fine for me. As per the NixOS manual, it is possible to have multiple definitions of the same option, see https://nixos.org/manual/nixos/stable/index.html#sec-modularity.

Note that both configuration.nix and kde.nix define the option environment.systemPackages. When multiple modules define an option, NixOS will try to merge the definitions. In the case of environment.systemPackages, that’s easy: the lists of packages can simply be concatenated. The value in configuration.nix is merged last, so for list-type options, it will appear at the end of the merged list. If you want it to appear first, you can use mkBefore.

Zahrun avatar Apr 07 '23 04:04 Zahrun