about summary refs log tree commit diff stats
path: root/system
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-05-20 07:43:36 +0200
committerSoispha <soispha@vhack.eu>2023-05-20 07:54:44 +0200
commit4d1a37c96bd5dbf31e543adad294edc0b0c3cae2 (patch)
tree6b2e8c40184f8de06af602d850b9a5eeb5910b7b /system
parentFix(hm/wms/river): Remove accel from the moonlander pointer (diff)
downloadnixos-config-4d1a37c96bd5dbf31e543adad294edc0b0c3cae2.tar.gz
nixos-config-4d1a37c96bd5dbf31e543adad294edc0b0c3cae2.zip
Fix(system): Add configs for networkmanager only if it's enabled
Diffstat (limited to '')
-rw-r--r--system/impermanence/default.nix33
-rw-r--r--system/network/default.nix12
-rw-r--r--system/users/default.nix1
3 files changed, 34 insertions, 12 deletions
diff --git a/system/impermanence/default.nix b/system/impermanence/default.nix
index 71b023ff..3c859688 100644
--- a/system/impermanence/default.nix
+++ b/system/impermanence/default.nix
@@ -1,19 +1,32 @@
-{...}: {
+{
+  config,
+  lib,
+  ...
+}: let
+  networkmanager =
+    if config.networking.networkmanager.enable
+    then [
+      "/etc/NetworkManager" # store the networkmanager configs
+    ]
+    else [];
+  directories =
+    [
+      "/etc/nixos"
+      "/var/log"
+      # TODO the following entries need to be checked
+      #"/var/lib/bluetooth"
+      #"/var/lib/nixos"
+      #"/var/lib/systemd/coredump"
+    ]
+    ++ networkmanager;
+in {
   # needed for the hm impermanence config
   programs.fuse.userAllowOther = true;
 
   environment.persistence = {
     "/srv" = {
       hideMounts = true;
-      directories = [
-        "/etc/nixos"
-        "/var/log"
-        "/etc/NetworkManager" # this shouldn't hurt even if networkmanager isn't installed
-        # TODO this needs to be checked
-        #"/var/lib/bluetooth"
-        #"/var/lib/nixos"
-        #"/var/lib/systemd/coredump"
-      ];
+      inherit directories;
       files = [
         "/etc/machine-id"
       ];
diff --git a/system/network/default.nix b/system/network/default.nix
index b613c76a..2a68d7ce 100644
--- a/system/network/default.nix
+++ b/system/network/default.nix
@@ -1,5 +1,10 @@
 # vim: ts=2
-{config, ...}: {
+{
+  config,
+  lib,
+  ...
+}:
+{
   systemd.network = {
     networks = {
       "tap0" = {
@@ -40,3 +45,8 @@
     };
   };
 }
+// lib.mkIf config.networking.networkmanager.enable {
+  users.users.soispha.extraGroups = [
+    "networkmanager" # allows to configure networkmanager as this user
+  ];
+}
diff --git a/system/users/default.nix b/system/users/default.nix
index d2fc27fd..96925671 100644
--- a/system/users/default.nix
+++ b/system/users/default.nix
@@ -34,7 +34,6 @@ in {
         extraGroups = [
           "plugdev" # although deprecated, this helps with old udev rules, that still use this group. TODO check for an open issue
           "wheel"
-          "networkmanager" # if I activate network-manager, this will help
           "libvirtd" # needed to run libvirt stuff as this user
           "scanner" # needed for permission to access the scanner
         ];