Commit d299d36626f8

Vincent Demeester <vincent@sbr.pm>
2021-01-03 08:31:12
systems: temporary re-add some profiles…
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 14c501f
Changed files (2)
systems
modules
systems/modules/profiles/i3.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.desktop.i3;
+in
+{
+  options = {
+    profiles.desktop.i3 = {
+      enable = mkEnableOption "Enable i3 desktop profile";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    profiles = {
+      desktop.enable = true;
+    };
+    services = {
+      blueman.enable = true;
+      autorandr.enable = true;
+      xserver = {
+        displayManager = {
+          defaultSession = "none+i3";
+          lightdm.enable = true;
+          lightdm.greeters.pantheon.enable = true;
+        };
+        windowManager.i3.enable = true;
+      };
+      dbus = {
+        enable = true;
+        # socketActivated = true;
+        packages = [ pkgs.gnome3.dconf ];
+      };
+    };
+  };
+}
systems/modules/profiles/yubikey.nix
@@ -0,0 +1,46 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.yubikey;
+in
+{
+  options = {
+    profiles.yubikey = {
+      enable = mkEnableOption "Enable yubikey profile";
+      u2f = mkOption {
+        default = true;
+        description = "wether to enable auth with yubkeys throguh pam using u2f";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable (mkMerge [
+    {
+      environment = {
+        systemPackages = with pkgs; [
+          yubico-piv-tool
+          yubikey-personalization
+          yubioath-desktop
+          yubikey-manager
+        ];
+      };
+      services = {
+        pcscd.enable = true;
+        udev = {
+          packages = with pkgs; [ yubikey-personalization ];
+          extraRules = ''
+            # Yubico YubiKey
+            KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", TAG+="uaccess", MODE="0660", GROUP="wheel"
+            # ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
+          '';
+        };
+      };
+    }
+    (mkIf cfg.u2f {
+      security.pam.u2f = {
+        enable = true;
+      };
+    })
+  ]);
+}