about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-05-09T15·04+0200
committertazjin <tazjin@tvl.su>2022-05-10T13·41+0000
commit5518f620bbec2e4407519a4a5b71073c9ed380af (patch)
treea27204451742773ce8d62c02f09a6c63a794a4b6 /users
parentc4a3500d7024df199572c102420a4c8398344c1a (diff)
refactor(tazjin/nixos): Split up desktop/laptop configurations r/4047
Change-Id: I0f5d631491be0c811ad171510568aac097d2fddd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5553
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users')
-rw-r--r--users/tazjin/nixos/modules/desktop.nix53
-rw-r--r--users/tazjin/nixos/modules/laptop.nix12
-rw-r--r--users/tazjin/nixos/modules/persistence.nix2
-rw-r--r--users/tazjin/nixos/modules/physical.nix12
-rw-r--r--users/tazjin/nixos/tverskoy/default.nix73
5 files changed, 83 insertions, 69 deletions
diff --git a/users/tazjin/nixos/modules/desktop.nix b/users/tazjin/nixos/modules/desktop.nix
new file mode 100644
index 000000000000..c78463386c46
--- /dev/null
+++ b/users/tazjin/nixos/modules/desktop.nix
@@ -0,0 +1,53 @@
+# EXWM and other desktop configuration.
+{ depot, lib, pkgs, ... }:
+
+{
+  services = {
+    pipewire = {
+      enable = true;
+      alsa.enable = true;
+      pulse.enable = true;
+    };
+
+    redshift.enable = true;
+    blueman.enable = true;
+
+    xserver = {
+      enable = true;
+      layout = "us";
+      xkbOptions = "caps:super";
+
+      libinput.enable = true;
+
+      displayManager = {
+        # Give EXWM permission to control the session.
+        sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
+        lightdm.enable = true;
+        # lightdm.greeters.gtk.clock-format = "%H:%M"; # TODO(tazjin): TZ?
+      };
+
+      windowManager.session = lib.singleton {
+        name = "exwm";
+        start = "${depot.users.tazjin.emacs}/bin/tazjins-emacs";
+      };
+    };
+  };
+
+  # Set variables to enable EXWM-XIM and other Emacs features.
+  environment.sessionVariables = {
+    XMODIFIERS = "@im=exwm-xim";
+    GTK_IM_MODULE = "xim";
+    QT_IM_MODULE = "xim";
+    CLUTTER_IM_MODULE = "xim";
+    EDITOR = "emacsclient";
+  };
+
+  # Do not restart the display manager automatically
+  systemd.services.display-manager.restartIfChanged = lib.mkForce false;
+
+  # If something needs more than 10s to stop it should probably be
+  # killed.
+  systemd.extraConfig = ''
+    DefaultTimeoutStopSec=10s
+  '';
+}
diff --git a/users/tazjin/nixos/modules/laptop.nix b/users/tazjin/nixos/modules/laptop.nix
new file mode 100644
index 000000000000..9a4a095b26a4
--- /dev/null
+++ b/users/tazjin/nixos/modules/laptop.nix
@@ -0,0 +1,12 @@
+# Configuration specifically for laptops that move around.
+{ ... }:
+
+{
+  # Automatically detect location to use for redshift
+  location.provider = "geoclue2";
+
+  # Enable power-saving features.
+  services.tlp.enable = true;
+
+  programs.light.enable = true;
+}
diff --git a/users/tazjin/nixos/modules/persistence.nix b/users/tazjin/nixos/modules/persistence.nix
index c07ec9227ca2..c81958161fbf 100644
--- a/users/tazjin/nixos/modules/persistence.nix
+++ b/users/tazjin/nixos/modules/persistence.nix
@@ -21,4 +21,6 @@
       "/etc/machine-id"
     ];
   };
+
+  programs.fuse.userAllowOther = true;
 }
diff --git a/users/tazjin/nixos/modules/physical.nix b/users/tazjin/nixos/modules/physical.nix
index 4517d9aeb0d3..ee89284aa899 100644
--- a/users/tazjin/nixos/modules/physical.nix
+++ b/users/tazjin/nixos/modules/physical.nix
@@ -72,4 +72,16 @@
       xsecurelock
       zoxide
     ]);
+
+  # Run services & configure programs for all machines.
+  services = {
+    mullvad-vpn.enable = true;
+    fwupd.enable = true;
+  };
+
+  programs = {
+    fish.enable = true;
+    mosh.enable = true;
+    ssh.startAgent = true;
+  };
 }
diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix
index 05520dea9ba5..4356ef2b029a 100644
--- a/users/tazjin/nixos/tverskoy/default.nix
+++ b/users/tazjin/nixos/tverskoy/default.nix
@@ -14,11 +14,14 @@ in
 lib.fix (self: {
   imports = [
     (mod "open_eid.nix")
+    (usermod "desktop.nix")
     (usermod "fonts.nix")
     (usermod "home-config.nix")
+    (usermod "laptop.nix")
     (usermod "persistence.nix")
     (usermod "physical.nix")
     (usermod "zerotier.nix")
+
     (pkgs.home-manager.src + "/nixos")
   ] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;
 
@@ -111,24 +114,9 @@ lib.fix (self: {
     ];
   };
 
-  # from https://github.com/NixOS/nixpkgs/issues/64965
-  environment.etc."ipsec.secrets".text = ''
-    include ipsec.d/ipsec.nm-l2tp.secrets
-  '';
-
   security.rtkit.enable = true;
 
   services = {
-    pipewire = {
-      enable = true;
-      alsa.enable = true;
-      pulse.enable = true;
-    };
-
-    redshift.enable = true;
-    blueman.enable = true;
-    mullvad-vpn.enable = true;
-    fwupd.enable = true;
     printing.enable = true;
 
     # expose i2c device as /dev/i2c-amdgpu-dm and make it user-accessible
@@ -137,29 +125,7 @@ lib.fix (self: {
       SUBSYSTEM=="i2c-dev", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:08.1/0000:06:00.0/i2c-5/i2c-dev/i2c-5", SYMLINK+="i2c-amdgpu-dm", TAG+="uaccess"
     '';
 
-    # Enable power-saving features.
-    tlp.enable = true;
-
-    xserver = {
-      enable = true;
-      layout = "us";
-      xkbOptions = "caps:super";
-      videoDrivers = [ "amdgpu" ];
-
-      libinput.enable = true;
-
-      displayManager = {
-        # Give EXWM permission to control the session.
-        sessionCommands = "${pkgs.xorg.xhost}/bin/xhost +SI:localuser:$USER";
-        lightdm.enable = true;
-        # lightdm.greeters.gtk.clock-format = "%H:%M"; # TODO(tazjin): TZ?
-      };
-
-      windowManager.session = lib.singleton {
-        name = "exwm";
-        start = "${depot.users.tazjin.emacs}/bin/tazjins-emacs";
-      };
-    };
+    xserver.videoDrivers = [ "amdgpu" ];
 
     # Automatically collect garbage from the Nix store.
     depot.automatic-gc = {
@@ -171,39 +137,8 @@ lib.fix (self: {
     };
   };
 
-  # Set variables to enable EXWM-XIM
-  environment.sessionVariables = {
-    XMODIFIERS = "@im=exwm-xim";
-    GTK_IM_MODULE = "xim";
-    QT_IM_MODULE = "xim";
-    CLUTTER_IM_MODULE = "xim";
-  };
-
-  # Automatically detect location to use for redshift
-  location.provider = "geoclue2";
-
-  # Do not restart the display manager automatically
-  systemd.services.display-manager.restartIfChanged = lib.mkForce false;
-
-  # If something needs more than 10s to stop it should probably be
-  # killed.
-  systemd.extraConfig = ''
-    DefaultTimeoutStopSec=10s
-  '';
-
   time.timeZone = "Africa/Cairo";
 
-  programs = {
-    adb.enable = true;
-    fish.enable = true;
-    light.enable = true;
-    mosh.enable = true;
-    ssh.startAgent = true;
-
-    # Required by impermanence
-    fuse.userAllowOther = true;
-  };
-
   systemd.user.services.lieer-tazjin = {
     description = "Synchronise mail@tazj.in via lieer";
     script = "${pkgs.lieer}/bin/gmi sync";