Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/wpa_supplicant: add configFile option #94473



Copy link

lopsided98 commented Aug 1, 2020

Motivation for this change

This PR adds the networking.wireless.configFile option, which allows users to specify the location for a custom wpa_supplicant.conf file. Currently, if the module is not configured to generate a config file, the service looks for the config at /etc/wpa_supplicant.conf. The configFile option allows changing this fallback location.

I also added a commit that hardens the service script against spaces in various variables.

I have tested this PR with and without network.wireless.interfaces set.

cc @globin

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits
lopsided98 added 2 commits Aug 1, 2020
This allows a custom config file to be located somewhere other than
Copy link

Ma27 commented Aug 5, 2020

The module (and also your change unfortunately) seem to be attempts to work around the merging behavior of the module system that can end up in unintuitive situations (for instance if configFile and e.g. networks is declared, a "conflicting options"-error will be thrown with your change). Instead, I'd prefer an approach like this:

  • wpa_supplicant.service always uses /etc/wpa_supplicant.conf (or sth. similar) by default.

  • The default config file is declared like this in the module:

      environment.etc."wpa_supplicant.conf".text = ''
        # code to generate `wpa_supplicant.conf`
  • Now you can override the config file on your own e.g. like this:

    { lib, ... }: {
      environment.etc."wpa_supplicant.conf" = lib.mkForce { source = /path/to/your/wpa_supplicant.conf; };
Copy link
Contributor Author

lopsided98 commented Aug 6, 2020

Thanks, the latter snipped works for me as is (I didn't think of just making the file a symlink). I don't have a ton of time or motivation to work on this module right now, so I think I'll just leave it as is and close this PR.

@lopsided98 lopsided98 closed this Aug 6, 2020
@lopsided98 lopsided98 deleted the lopsided98:wpa-supplicant-config-file branch Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.