Commit 88da5ceeda49

Vincent Demeester <vincent@sbr.pm>
2018-11-23 17:44:53
modules: update desktop modules and some hardwares
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 51b9e5d
hardware/dell-latitude-e6540.nix
@@ -1,6 +1,9 @@
 { config, pkgs, ... }:
 
 {
+  boot.loader.efi.canTouchEfiVariables = true;
+  hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
+
   boot = {
     kernelParams = [
       # Kernel GPU Savings Options (NOTE i915 chipset only)
hardware/lenovo-p50.nix
@@ -4,6 +4,13 @@
   imports = [
     ./thinkpad.nix
   ];
+  
+  hardware.bluetooth.enable = true;
+  hardware.bluetooth.powerOnBoot = true;
+  hardware.nvidia.optimus_prime.enable = true;
+  hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
+  hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
+  
   services = {
     acpid = {
       lidEventCommands = ''
hardware/thinkpad.nix
@@ -1,11 +1,16 @@
 { config, pkgs, ... }:
 
 {
+  hardware.trackpoint.enable = false;
   hardware.cpu.intel.updateMicrocode = true;
+  hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
+
   environment.systemPackages = with pkgs; [
     linuxPackages.tp_smapi
   ];
+
   boot = {
+    loader.efi.canTouchEfiVariables = true;
     kernelParams = [
       # Kernel GPU Savings Options (NOTE i915 chipset only)
       "i915.enable_rc6=1" "i915.enable_fbc=1"
machine/shikoku.nix
@@ -18,6 +18,8 @@
   profiles.virtualization.enable = true;
   
   time.timeZone = "Europe/Paris";
+
+  boot.loader.efi.canTouchEfiVariables = true;
   boot.loader.grub.enable = true;
   boot.loader.grub.version = 2;
   boot.loader.grub.efiSupport = true;
machine/wakasu.nix
@@ -4,7 +4,6 @@
   imports =
     [ # Include the results of the hardware scan.
     ../hardware-configuration.nix
-    ../profiles/laptop.nix
     ../profiles/ssh.nix
     ../profiles/dev.nix
     ../location/home.nix
@@ -15,15 +14,17 @@
   profiles.docker.enable = true;
   profiles.containerd.enable = true;
   profiles.virtualization.enable = true;
+
+  # Move elsewhere
+  programs.podman = {
+    enable = true;
+  };
+
   security.pam.loginLimits = [
     { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; }
     { domain = "@audio"; item = "rtprio";  type = "-"; value = "99"; }
     { domain = "@audio"; item = "nofile";  type = "-"; value = "99999"; }
   ];
-  
-  hardware.bluetooth.enable = true;
-  hardware.bluetooth.powerOnBoot = true;
-  hardware.trackpoint.enable = false;
 
   networking.firewall.allowedUDPPortRanges = [ { from = 6001; to = 6101; } ];
   networking.firewall.allowedTCPPorts = [ 7946 9000 5000 ];
@@ -45,16 +46,9 @@
       };
     };
   };
-  hardware.nvidia.optimus_prime.enable = true;
-  hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
-  hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
-
-  # Move elsewhere
-  programs.podman = {
-    enable = true;
-  };
 
   services.syncthing-edge.guiAddress = with import ../assets/machines.nix; "${wireguard.ips.wakasu}:8384";
+
   services.wireguard = with import ../assets/machines.nix; {
     enable = true;
     ips = [ "${wireguard.ips.wakasu}/24" ];
modules/profiles/desktop.nix
@@ -32,11 +32,23 @@ in
         description = "Enable syncthing with the desktop profile";
         type = types.bool;
       };
+      scanning = mkOption {
+        default = true;
+        description = "Enable scanning with the desktop profile";
+        type = types.bool;
+      };
+      printing = mkOption {
+        default = true;
+        description = "Enable printing with the desktop profile";
+        type = types.bool;
+      };
     };
   };
   config = mkIf cfg.enable {
-    profiles.pulseaudio.enable = cfg.pulseaudio;
     profiles.avahi.enable = cfg.avahi;
+    profiles.printing.enable = cfg.printing;
+    profiles.pulseaudio.enable = cfg.pulseaudio;
+    profiles.scanning.enable = cfg.scanning;
     profiles.syncthing.enable = cfg.syncthing;
 
     boot = {
modules/profiles/printing.nix
@@ -0,0 +1,25 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.printing;
+in
+{
+  options = {
+    profiles.printing = {
+      enable = mkOption {
+        default = false;
+        description = "Enable printing profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    services = {
+      printing = {
+        enable = true;
+        drivers = [ pkgs.gutenprint ];
+      };
+    };
+  };
+}
modules/profiles/scanning.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.scanning;
+in
+{
+  options = {
+    profiles.scanning = {
+      enable = mkOption {
+        default = false;
+        description = "Enable scanning profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    environment.systemPackages = with pkgs; [
+      saneFrontends
+      simple-scan
+    ];
+    hardware.sane = {
+      enable = true;
+    };
+  };
+}
modules/module-list.nix
@@ -12,7 +12,9 @@
     ./profiles/laptop.nix
     ./profiles/nix-config.nix
     ./profiles/nix-auto-update.nix
+    ./profiles/printing.nix
     ./profiles/pulseaudio.nix
+    ./profiles/scanning.nix
     ./profiles/syncthing.nix
     ./profiles/users.nix
     ./profiles/virtualization.nix
profiles/desktop.nix
@@ -1,12 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  imports = [
-    ./printing.nix
-    ./scanning.nix
-  ];
-
-  boot.loader.efi.canTouchEfiVariables = true;
-  hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
-
-}
profiles/laptop.nix
@@ -1,8 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  imports = [
-    ./desktop.nix
-  ];
-
-}
profiles/printing.nix
@@ -1,10 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  services = {
-    printing = {
-      enable = true;
-      drivers = [ pkgs.gutenprint ];
-    };
-  };
-}
profiles/scanning.nix
@@ -1,11 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment.systemPackages = with pkgs; [
-    saneFrontends
-    simple-scan
-  ];
-  hardware.sane = {
-    enable = true;
-  };
-}