mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
networkmanager-declarative: remove
This commit is contained in:
@@ -140,7 +140,6 @@
|
|||||||
|
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
moodle-dl = import modules/moodle-dl.nix;
|
moodle-dl = import modules/moodle-dl.nix;
|
||||||
networkmanager-declarative = import modules/networkmanager-declarative.nix;
|
|
||||||
passport = import modules/passport.nix;
|
passport = import modules/passport.nix;
|
||||||
panoptikon = import modules/panoptikon.nix;
|
panoptikon = import modules/panoptikon.nix;
|
||||||
power-action = import modules/power-action.nix;
|
power-action = import modules/power-action.nix;
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
# https://github.com/jmackie/nixos-networkmanager-profiles/
|
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with lib; let
|
|
||||||
nm = config.networking.networkmanager;
|
|
||||||
|
|
||||||
mkProfile = profileAttrs:
|
|
||||||
if !(isAttrs profileAttrs)
|
|
||||||
then throw "error 1"
|
|
||||||
else {
|
|
||||||
enable = true;
|
|
||||||
mode = "0400"; # readonly (user)
|
|
||||||
text =
|
|
||||||
(foldlAttrs (accum: {
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}: ''
|
|
||||||
${accum}
|
|
||||||
|
|
||||||
[${name}] ${mkProfileEntry value}'')
|
|
||||||
"# Generated by nixos-networkmanager-profiles"
|
|
||||||
profileAttrs)
|
|
||||||
+ "\n";
|
|
||||||
};
|
|
||||||
|
|
||||||
mkProfileEntry = entryAttrs:
|
|
||||||
if !(isAttrs entryAttrs)
|
|
||||||
then throw "error 2"
|
|
||||||
else
|
|
||||||
foldlAttrs (accum: {
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}: ''
|
|
||||||
${accum}
|
|
||||||
${name}=${toString value}'') ""
|
|
||||||
entryAttrs;
|
|
||||||
|
|
||||||
foldlAttrs = op: nul: attrs:
|
|
||||||
foldl (accum: {
|
|
||||||
fst,
|
|
||||||
snd,
|
|
||||||
}:
|
|
||||||
op accum (nameValuePair fst snd))
|
|
||||||
nul
|
|
||||||
(lists.zipLists (attrNames attrs) (attrValues attrs));
|
|
||||||
|
|
||||||
attrLength = attrs: length (attrValues attrs);
|
|
||||||
in {
|
|
||||||
options.networking.networkmanager.profiles = mkOption {
|
|
||||||
type = types.attrs;
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf (attrLength nm.profiles > 0) {
|
|
||||||
environment.etc = foldlAttrs (accum: {
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}:
|
|
||||||
accum
|
|
||||||
// {
|
|
||||||
"NetworkManager/system-connections/${name}.nmconnection" =
|
|
||||||
mkProfile value;
|
|
||||||
}) {}
|
|
||||||
nm.profiles;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user