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/create_ap: add module #168510

Merged
merged 1 commit into from
Apr 23, 2022
Merged

nixos/create_ap: add module #168510

merged 1 commit into from
Apr 23, 2022

Conversation

onny
Copy link
Contributor

@onny onny commented Apr 13, 2022

Description of changes

Working on a module for the new package linux-wifi-hotspot. I would like to be able to create a wifi hotspot with this NixOS service like this:

services.create_ap = {
  enable = true;
  settings = {
    INTERNET_IFACE = "eth0";
    WIFI_IFACE = "wlan0";
    SSID = "onnys hotspot";
    PASSPHRASE = "12345678";
  };
};
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@onny onny marked this pull request as draft April 13, 2022 17:32
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: changelog 8.has: documentation This PR adds or changes documentation labels Apr 13, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Apr 13, 2022
@onny onny changed the title [DRAFT] nixos/create_ap: add module nixos/create_ap: add module Apr 14, 2022
@onny onny marked this pull request as ready for review April 14, 2022 10:45
@onny onny requested review from kradalby and cheriimoya April 14, 2022 14:51
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin labels Apr 14, 2022
@onny
Copy link
Contributor Author

onny commented Apr 15, 2022

create_ap --config test.conf works well for creating a access point, unfortunately it doesn't work inside the systemd service. In there, it couldn't find the wireless network device.
I'm using the upstream systemd unit and overwrite the ExecStart section. Maybe it is missing some important environment settings which are needed on NixOS?

nixos/doc/manual/release-notes/rl-2205.section.md Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
@cheriimoya
Copy link
Contributor

so the module does not work at the moment?

Copy link
Contributor

@cheriimoya cheriimoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't test the service so far, will try that next

nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/linux-wifi-hotspot/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/linux-wifi-hotspot/default.nix Outdated Show resolved Hide resolved
@onny
Copy link
Contributor Author

onny commented Apr 20, 2022

Okay tested the service and it works now :) Ready to merge if it is okay for you

@cheriimoya
Copy link
Contributor

if this is still a draft, please mark it as such

nixos/doc/manual/release-notes/rl-2205.section.md Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/create_ap.nix Outdated Show resolved Hide resolved
@onny
Copy link
Contributor Author

onny commented Apr 20, 2022

Thank you for this explanation, I guess that makes sense.

I added the changes and it looks fine for me :)

Copy link
Contributor

@cheriimoya cheriimoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this change I think I'm happy:)

nixos/doc/manual/release-notes/rl-2205.section.md Outdated Show resolved Hide resolved
@cheriimoya
Copy link
Contributor

I tested basic functionality and it seems to work. My phone is connecting (dhcp isn't working but i didn't configure it anyway) and i can ping it from my laptop.

I might use this in the future 👍

Copy link
Contributor

@cheriimoya cheriimoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajs124
Copy link
Member

ajs124 commented Apr 21, 2022

This might be a stupid question, but what does this do that services.hostapd doesn't?

@onny
Copy link
Contributor Author

onny commented Apr 21, 2022

This script also uses hostapd as a dependency. I guess it is even simpler than using hostapd directly since it also setups dhcp and routing

@onny onny requested a review from happysalada April 23, 2022 09:46
@happysalada
Copy link
Contributor

Looks good to me, thanks to everyone involved!

@happysalada happysalada merged commit 24b5378 into NixOS:master Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants