about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-05-09T11·35+0200
committertazjin <tazjin@tvl.su>2022-05-10T13·41+0000
commit988ac68100458034c9966ce547adb8b0ddb91173 (patch)
tree9bc3e73bb62836112fdf2a5f86b68ed122d092be /users
parentfe78a53bc9368cd629c548e53cc65d2c2b7c6952 (diff)
refactor(tazjin/nixos): First step to extracting shared config r/4039
There's some configuration shared betwene my physical machines which
is just duplicated all over the place right now. What's the point of
having Nix if you don't use it fully?

Change-Id: Ic7e89f918d2517637b3d49617b4dc1a2cc6023b9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5536
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users')
-rw-r--r--users/tazjin/default.nix27
-rw-r--r--users/tazjin/nixos/modules/physical.nix75
-rw-r--r--users/tazjin/nixos/tverskoy/default.nix83
3 files changed, 97 insertions, 88 deletions
diff --git a/users/tazjin/default.nix b/users/tazjin/default.nix
index 8359b2de3275..1b68b7127a72 100644
--- a/users/tazjin/default.nix
+++ b/users/tazjin/default.nix
@@ -1,5 +1,5 @@
 # //users/tazjin-specific CI configuration.
-{ pkgs, ... }:
+{ depot, pkgs, ... }:
 
 let
   rustfmt = pkgs.writeShellScript "rustfmt-tazjin" ''
@@ -9,11 +9,22 @@ let
   '';
 
 in
-rustfmt.overrideAttrs (_: {
-  # rustfmt not respecting config atm, disable
-  meta.ci.skip = true;
+depot.nix.readTree.drvTargets {
+  rustfmt = rustfmt.overrideAttrs (_: {
+    # rustfmt not respecting config atm, disable
+    meta.ci.skip = true;
 
-  meta.ci.extraSteps.rustfmt = {
-    command = rustfmt;
-  };
-})
+    meta.ci.extraSteps.rustfmt = {
+      command = rustfmt;
+    };
+  });
+
+  # Use a screen lock command that resets the keyboard layout
+  # before locking, to avoid locking me out when the layout is
+  # in Russian.
+  screenLock = pkgs.writeShellScriptBin "tazjin-screen-lock" ''
+    ${pkgs.xorg.setxkbmap}/bin/setxkbmap us
+    ${pkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
+    exec ${pkgs.xsecurelock}/bin/xsecurelock
+  '';
+}
diff --git a/users/tazjin/nixos/modules/physical.nix b/users/tazjin/nixos/modules/physical.nix
new file mode 100644
index 000000000000..4517d9aeb0d3
--- /dev/null
+++ b/users/tazjin/nixos/modules/physical.nix
@@ -0,0 +1,75 @@
+# Default configuration settings for physical machines that I use.
+{ pkgs, depot, ... }:
+
+{
+  # Install all the default software.
+  environment.systemPackages =
+    # programs from the depot
+    (with depot; [
+      users.tazjin.screenLock
+      users.tazjin.emacs
+      third_party.agenix.cli
+    ]) ++
+
+    # programs from nixpkgs
+    (with pkgs; [
+      amber
+      audacity
+      bat
+      curl
+      ddcutil
+      direnv
+      dmd
+      dnsutils
+      electrum
+      emacsNativeComp # emacsclient
+      exa
+      fd
+      file
+      firefox
+      fractal
+      gdb
+      gh
+      git
+      gnupg
+      google-chrome
+      gtk3 # for gtk-launch
+      htop
+      hyperfine
+      iftop
+      imagemagick
+      jq
+      lieer
+      man-pages
+      mosh
+      msmtp
+      mullvad-vpn
+      networkmanagerapplet
+      nix-prefetch-github
+      nmap
+      notmuch
+      openssh
+      openssl
+      paperlike-go
+      pass
+      pavucontrol
+      pinentry
+      pinentry-emacs
+      pulseaudio # for pactl
+      pwgen
+      quasselClient
+      rink
+      ripgrep
+      rustup
+      screen
+      scrot
+      tig
+      tokei
+      tree
+      unzip
+      vlc
+      whois
+      xsecurelock
+      zoxide
+    ]);
+}
diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix
index 4b6c6e4860e5..31204a198092 100644
--- a/users/tazjin/nixos/tverskoy/default.nix
+++ b/users/tazjin/nixos/tverskoy/default.nix
@@ -8,19 +8,13 @@ let
     monolithic = false;
   };
 
-  # Use a screen lock command that resets the keyboard layout
-  # before locking, to avoid locking me out when the layout is
-  # in Russian.
-  screenLock = pkgs.writeShellScriptBin "tazjin-screen-lock" ''
-    ${pkgs.xorg.setxkbmap}/bin/setxkbmap us
-    ${pkgs.xorg.setxkbmap}/bin/setxkbmap -option caps:super
-    exec ${pkgs.xsecurelock}/bin/xsecurelock
-  '';
   mod = name: depot.path + ("/ops/modules/" + name);
+  usermod = name: depot.path + ("/users/tazjin/nixos/modules/" + name);
 in
 lib.fix (self: {
   imports = [
     (mod "open_eid.nix")
+    (usermod "physical.nix")
     "${depot.third_party.impermanence}/nixos.nix"
     "${pkgs.home-manager.src}/nixos"
   ] ++ lib.optional (builtins.pathExists ./local-config.nix) ./local-config.nix;
@@ -262,77 +256,6 @@ lib.fix (self: {
     fuse.userAllowOther = true;
   };
 
-  environment.systemPackages =
-    # programs from the depot
-    (with depot; [
-      screenLock
-      tools.nsfv-setup
-      users.tazjin.emacs
-      third_party.agenix.cli
-    ]) ++
-
-    # programs from nixpkgs
-    (with pkgs; [
-      amber
-      audacity
-      bat
-      curl
-      ddcutil
-      direnv
-      dmd
-      dnsutils
-      electrum
-      emacsNativeComp # emacsclient
-      exa
-      fd
-      file
-      firefox
-      fractal
-      gdb
-      gh
-      git
-      gnupg
-      google-chrome
-      gtk3 # for gtk-launch
-      htop
-      hyperfine
-      iftop
-      imagemagick
-      jq
-      lieer
-      man-pages
-      mosh
-      msmtp
-      mullvad-vpn
-      networkmanagerapplet
-      nix-prefetch-github
-      nmap
-      notmuch
-      openssh
-      openssl
-      paperlike-go
-      pass
-      pavucontrol
-      pinentry
-      pinentry-emacs
-      pulseaudio # for pactl
-      pwgen
-      quasselClient
-      rink
-      ripgrep
-      rustup
-      screen
-      scrot
-      tig
-      tokei
-      tree
-      unzip
-      vlc
-      whois
-      xsecurelock
-      zoxide
-    ]);
-
   systemd.user.services.lieer-tazjin = {
     description = "Synchronise mail@tazj.in via lieer";
     script = "${pkgs.lieer}/bin/gmi sync";
@@ -416,7 +339,7 @@ lib.fix (self: {
       enable = true;
       enableDetectSleep = true;
       inactiveInterval = 10; # minutes
-      lockCmd = "${screenLock}/bin/tazjin-screen-lock";
+      lockCmd = "${depot.users.tazjin.screenLock}/bin/tazjin-screen-lock";
     };
 
     services.picom = {