stockholm/lass/3modules/autowifi.nix

39 lines
926 B
Nix
Raw Normal View History

2019-08-28 21:02:53 +00:00
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let
cfg = config.lass.autowifi;
in {
options.lass.autowifi = {
enable = mkEnableOption "automatic wifi connector";
knownWifisFile = mkOption {
type = types.str;
default = "/etc/wifis";
};
enablePrisonBreak = mkOption {
type = types.bool;
default = false;
};
2019-08-28 21:02:53 +00:00
};
config = lib.mkIf cfg.enable {
2019-08-28 21:02:53 +00:00
systemd.services.autowifi = {
description = "Automatic wifi connector";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.networkmanager ];
2019-08-28 21:02:53 +00:00
serviceConfig = {
Type = "simple";
Restart = "always";
RestartSec = "10s";
ExecStart = "${autowifi}/bin/autowifi";
2019-08-28 21:02:53 +00:00
};
};
networking.networkmanager.dispatcherScripts = mkIf cfg.enablePrisonBreak [
{ source = "${pkgs.callPackage <stockholm/makefu/5pkgs/prison-break}/bin/prison-break"; }
];
2019-08-28 21:02:53 +00:00
};
}