From 1b65ba7a838e422c9bf16ddcaf796a996fa51b6b Mon Sep 17 00:00:00 2001
From: Martin Fischer <martin@push-f.com>
Date: Fri, 27 Dec 2024 08:45:34 +0100
Subject: refactor: introduce profiles

---
 nixos/hosts/ev/default.nix                    |   8 +-
 nixos/hosts/hamac/default.nix                 |   9 +--
 nixos/hosts/tente/default.nix                 |   4 +-
 nixos/nixpkgs/config.nix                      |   4 -
 nixos/nixpkgs/overlays.nix                    |   4 -
 nixos/parts/basics-physical.nix               |   8 --
 nixos/parts/basics.nix                        |  35 ---------
 nixos/parts/create.nix                        |  11 ---
 nixos/parts/dev.nix                           |  36 ---------
 nixos/parts/graphical.nix                     | 103 --------------------------
 nixos/parts/scripts/deploy-dir                |  16 ----
 nixos/parts/scripts/reset-bg                  |   2 -
 nixos/parts/scripts/set-bg                    |   3 -
 nixos/parts/server.nix                        |   9 ---
 nixos/parts/tailscale.nix                     |   8 --
 nixos/profiles/common/basics.nix              |  35 +++++++++
 nixos/profiles/common/default.nix             |   8 ++
 nixos/profiles/common/nixpkgs/config.nix      |   4 +
 nixos/profiles/common/nixpkgs/overlays.nix    |   4 +
 nixos/profiles/common/sanix.nix               |  24 ++++++
 nixos/profiles/server/default.nix             |  13 ++++
 nixos/profiles/workstation/create.nix         |  11 +++
 nixos/profiles/workstation/default.nix        |  20 +++++
 nixos/profiles/workstation/dev.nix            |  31 ++++++++
 nixos/profiles/workstation/graphical.nix      |  98 ++++++++++++++++++++++++
 nixos/profiles/workstation/scripts/deploy-dir |  16 ++++
 nixos/profiles/workstation/scripts/reset-bg   |   2 +
 nixos/profiles/workstation/scripts/set-bg     |   3 +
 nixos/rebuild                                 |   2 +-
 nixos/sanix.nix                               |  29 --------
 nixos/shared/basics-physical.nix              |   8 ++
 nixos/shared/tailscale.nix                    |   8 ++
 32 files changed, 292 insertions(+), 284 deletions(-)
 delete mode 100644 nixos/nixpkgs/config.nix
 delete mode 100644 nixos/nixpkgs/overlays.nix
 delete mode 100644 nixos/parts/basics-physical.nix
 delete mode 100644 nixos/parts/basics.nix
 delete mode 100644 nixos/parts/create.nix
 delete mode 100644 nixos/parts/dev.nix
 delete mode 100644 nixos/parts/graphical.nix
 delete mode 100755 nixos/parts/scripts/deploy-dir
 delete mode 100644 nixos/parts/scripts/reset-bg
 delete mode 100644 nixos/parts/scripts/set-bg
 delete mode 100644 nixos/parts/server.nix
 delete mode 100644 nixos/parts/tailscale.nix
 create mode 100644 nixos/profiles/common/basics.nix
 create mode 100644 nixos/profiles/common/default.nix
 create mode 100644 nixos/profiles/common/nixpkgs/config.nix
 create mode 100644 nixos/profiles/common/nixpkgs/overlays.nix
 create mode 100644 nixos/profiles/common/sanix.nix
 create mode 100644 nixos/profiles/server/default.nix
 create mode 100644 nixos/profiles/workstation/create.nix
 create mode 100644 nixos/profiles/workstation/default.nix
 create mode 100644 nixos/profiles/workstation/dev.nix
 create mode 100644 nixos/profiles/workstation/graphical.nix
 create mode 100755 nixos/profiles/workstation/scripts/deploy-dir
 create mode 100644 nixos/profiles/workstation/scripts/reset-bg
 create mode 100644 nixos/profiles/workstation/scripts/set-bg
 delete mode 100644 nixos/sanix.nix
 create mode 100644 nixos/shared/basics-physical.nix
 create mode 100644 nixos/shared/tailscale.nix

(limited to 'nixos')

diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix
index d8b4b24..ec2ed86 100644
--- a/nixos/hosts/ev/default.nix
+++ b/nixos/hosts/ev/default.nix
@@ -8,11 +8,9 @@
 {
   imports = [
     ./hardware-configuration.nix
-    ../../sanix.nix
-    ../../parts/server.nix
-    ../../parts/tailscale.nix
-    ../../parts/basics.nix
-    ../../parts/basics-physical.nix
+    <top/profiles/server>
+    <top/shared/tailscale.nix>
+    <top/shared/basics-physical.nix>
   ];
 
   boot.loader.systemd-boot.enable = true;
diff --git a/nixos/hosts/hamac/default.nix b/nixos/hosts/hamac/default.nix
index c8f40e1..594d70c 100644
--- a/nixos/hosts/hamac/default.nix
+++ b/nixos/hosts/hamac/default.nix
@@ -6,13 +6,8 @@
 {
   imports = [
     ./hardware-configuration.nix
-    ../../sanix.nix
-    ../../parts/basics.nix
-    ../../parts/basics-physical.nix
-    ../../parts/graphical.nix
-    ../../parts/tailscale.nix
-    ../../parts/dev.nix
-    ../../parts/create.nix
+    <top/profiles/workstation>
+    <top/shared/tailscale.nix>
   ];
 
   # Bootloader.
diff --git a/nixos/hosts/tente/default.nix b/nixos/hosts/tente/default.nix
index b38d1ea..7885ff4 100644
--- a/nixos/hosts/tente/default.nix
+++ b/nixos/hosts/tente/default.nix
@@ -21,9 +21,7 @@ in
 {
   imports = [
     ./hardware-configuration.nix
-    ../../sanix.nix
-    ../../parts/server.nix
-    ../../parts/basics.nix
+    <top/profiles/server>
   ];
 
   # Use the GRUB 2 boot loader.
diff --git a/nixos/nixpkgs/config.nix b/nixos/nixpkgs/config.nix
deleted file mode 100644
index b53485a..0000000
--- a/nixos/nixpkgs/config.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-# https://nixos.org/manual/nixpkgs/stable/#chap-packageconfig
-{
-
-}
diff --git a/nixos/nixpkgs/overlays.nix b/nixos/nixpkgs/overlays.nix
deleted file mode 100644
index 613338f..0000000
--- a/nixos/nixpkgs/overlays.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-# https://nixos.org/manual/nixpkgs/stable/#sec-overlays-definition
-[
-
-]
diff --git a/nixos/parts/basics-physical.nix b/nixos/parts/basics-physical.nix
deleted file mode 100644
index 683c3b2..0000000
--- a/nixos/parts/basics-physical.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment.systemPackages = with pkgs; [
-    pciutils
-    usbutils
-  ];
-}
diff --git a/nixos/parts/basics.nix b/nixos/parts/basics.nix
deleted file mode 100644
index aa6eff9..0000000
--- a/nixos/parts/basics.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment.systemPackages = with pkgs; [
-    git
-    vim
-
-    file
-    htop
-    ripgrep
-    tree
-    # TODO: use a tree alternative that understands .gitignore
-    wget
-  ];
-
-  users.defaultUserShell = pkgs.zsh;
-  programs.zsh = {
-    enable = true;
-
-    # Disabling compinit in /etc/zshrc so that we can call
-    # compinit with a custom zcompdump location in .zshrc.
-    enableGlobalCompInit = false;
-  };
-
-  environment.sessionVariables =
-    let
-      config = "$HOME/config/user";
-    in
-    {
-      # Set environment variables for software that doesn't
-      # follow the XDG Base Directory specification.
-
-      ZDOTDIR = "${config}/zsh";
-    };
-}
diff --git a/nixos/parts/create.nix b/nixos/parts/create.nix
deleted file mode 100644
index 1fc7a28..0000000
--- a/nixos/parts/create.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment.systemPackages = with pkgs; [
-    graphviz-nox # for dot
-
-    gimp
-    krita
-  ];
-}
-
diff --git a/nixos/parts/dev.nix b/nixos/parts/dev.nix
deleted file mode 100644
index 0d258b4..0000000
--- a/nixos/parts/dev.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  environment.sessionVariables = {
-    # Tell .zshrc to source zshrc-dev.sh.
-    MYNIX_DEV = "true";
-  };
-
-  environment.systemPackages = with pkgs; [
-    rustup
-    python313
-    nodejs_22
-
-    # CLI tools
-    docker-compose
-    gnumake
-    jq
-    just
-    sqlite-interactive
-    tokei
-
-    (writeShellScriptBin "deploy-dir" (builtins.readFile ./scripts/deploy-dir))
-
-    gcc # rustc fails if cc linker isn't found
-    chromium
-
-    vscodium
-    # I'm installing extensions via my install-imperative script.
-  ];
-
-  virtualisation.podman = {
-    enable = true;
-    dockerSocket.enable = true;
-  };
-}
-
diff --git a/nixos/parts/graphical.nix b/nixos/parts/graphical.nix
deleted file mode 100644
index d459c33..0000000
--- a/nixos/parts/graphical.nix
+++ /dev/null
@@ -1,103 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  programs.sway = {
-    enable = true;
-    # Execute sway with required environment variables for GTK apps.
-    wrapperFeatures.gtk = true;
-  };
-  programs.ssh.startAgent = true;
-
-  environment.loginShellInit = ''
-    [[ "$(tty)" == /dev/tty1 ]] && exec sway
-  '';
-
-  environment.sessionVariables = {
-    # Tell .zshrc to source zshrc-graphical.sh.
-    MYNIX_GRAPHICAL = "true";
-  };
-
-  environment.systemPackages = with pkgs; [
-    swaylock
-
-    # CLI tools
-    brightnessctl
-    wl-clipboard # for wl-copy and wl-paste
-    grim
-
-    # When I ssh into a server my terminal changes to a host-specific background color via
-    # a LocalCommand configured in ~/.ssh/config and a ZSH function to reset the color on exit.
-    (writeShellScriptBin "set-bg" (builtins.readFile ./scripts/set-bg))
-    (writeShellScriptBin "reset-bg" (builtins.readFile ./scripts/reset-bg))
-
-    # graphical tools
-    imv
-    mpv
-
-    # set and forget
-    i3status-rust
-  ];
-
-  # This generates /etc/xdg/mimeapps.list. The XDG spec and xdg-open don't support wildcards in MIME types.
-  # TODO: use an xdg-open alternative that supports wildcards in MIME types and doesn't use mimeapps.list
-  xdg.mime.defaultApplications =
-    let
-      defaultBrowser = "firefox.desktop";
-    in
-    {
-      "text/html" = defaultBrowser;
-
-      "x-scheme-handler/http" = defaultBrowser;
-      "x-scheme-handler/https" = defaultBrowser;
-      "x-scheme-handler/mailto" = "thunderbird.desktop";
-    };
-
-  services.pipewire = {
-    enable = true;
-    alsa.enable = true;
-    alsa.support32Bit = true;
-    pulse.enable = true;
-  };
-  security.rtkit.enable = true; # recommended for PipeWire
-
-  programs.thunderbird = {
-    enable = true;
-  };
-
-  programs.firefox = {
-    enable = true;
-
-    policies = {
-      DontCheckDefaultBrowser = true;
-      DisablePocket = true;
-      FirefoxHome = {
-        SponsoredTopSites = false;
-      };
-
-      SearchSuggestEnabled = false;
-      # cannot use SearchEngines because it's only available on ESR :(
-      # (https://mozilla.github.io/policy-templates/#searchengines-this-policy-is-only-available-on-the-esr)
-
-      Preferences = {
-        "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px
-        "browser.uidensity" = 1;
-        "browser.aboutConfig.showWarning" = false;
-        "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked
-      };
-
-      ExtensionSettings = {
-        "uBlock0@raymondhill.net" = {
-          install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
-          installation_mode = "force_installed";
-        };
-      };
-
-      PasswordManagerEnabled = false;
-      AutofillCreditCardEnabled = false;
-      ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
-        install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
-        installation_mode = "force_installed";
-      };
-    };
-  };
-}
diff --git a/nixos/parts/scripts/deploy-dir b/nixos/parts/scripts/deploy-dir
deleted file mode 100755
index bb7dfdf..0000000
--- a/nixos/parts/scripts/deploy-dir
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-if [ "$#" -ne 3 ]; then
-    echo "usage: $0 <local_dir> <ssh_dest> <remote_dir>"
-    exit 1
-fi
-printf -v remote_dir %q $3
-
-cd $1
-tar cf - . | ssh $2 "set -xe
-TEMP_DIR=\$(mktemp -d)
-cd \$TEMP_DIR
-tar xvf -
-rm -rf $remote_dir
-mv \$TEMP_DIR $remote_dir
-"
diff --git a/nixos/parts/scripts/reset-bg b/nixos/parts/scripts/reset-bg
deleted file mode 100644
index 5aa20f6..0000000
--- a/nixos/parts/scripts/reset-bg
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env bash
-echo -en "\033]111\007"
diff --git a/nixos/parts/scripts/set-bg b/nixos/parts/scripts/set-bg
deleted file mode 100644
index e78afdc..0000000
--- a/nixos/parts/scripts/set-bg
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-rgb_with_slashes=$(echo "$1" | sed -r 's,(..)(..),\1/\2/,')
-echo -en "\033]11;rgb:$rgb_with_slashes\007"
diff --git a/nixos/parts/server.nix b/nixos/parts/server.nix
deleted file mode 100644
index 3d94985..0000000
--- a/nixos/parts/server.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  services = {
-    openssh = {
-      enable = true;
-    };
-  };
-}
diff --git a/nixos/parts/tailscale.nix b/nixos/parts/tailscale.nix
deleted file mode 100644
index 5d5a99c..0000000
--- a/nixos/parts/tailscale.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ config, pkgs, ... }:
-
-{
-  services.tailscale = {
-    enable = true;
-    # MANUAL: run tailscale up --login-server https://<tailscaleControlServer>/
-  };
-}
diff --git a/nixos/profiles/common/basics.nix b/nixos/profiles/common/basics.nix
new file mode 100644
index 0000000..aa6eff9
--- /dev/null
+++ b/nixos/profiles/common/basics.nix
@@ -0,0 +1,35 @@
+{ config, pkgs, ... }:
+
+{
+  environment.systemPackages = with pkgs; [
+    git
+    vim
+
+    file
+    htop
+    ripgrep
+    tree
+    # TODO: use a tree alternative that understands .gitignore
+    wget
+  ];
+
+  users.defaultUserShell = pkgs.zsh;
+  programs.zsh = {
+    enable = true;
+
+    # Disabling compinit in /etc/zshrc so that we can call
+    # compinit with a custom zcompdump location in .zshrc.
+    enableGlobalCompInit = false;
+  };
+
+  environment.sessionVariables =
+    let
+      config = "$HOME/config/user";
+    in
+    {
+      # Set environment variables for software that doesn't
+      # follow the XDG Base Directory specification.
+
+      ZDOTDIR = "${config}/zsh";
+    };
+}
diff --git a/nixos/profiles/common/default.nix b/nixos/profiles/common/default.nix
new file mode 100644
index 0000000..de4499a
--- /dev/null
+++ b/nixos/profiles/common/default.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{
+  imports = [
+    ./sanix.nix
+    ./basics.nix
+  ];
+}
diff --git a/nixos/profiles/common/nixpkgs/config.nix b/nixos/profiles/common/nixpkgs/config.nix
new file mode 100644
index 0000000..b53485a
--- /dev/null
+++ b/nixos/profiles/common/nixpkgs/config.nix
@@ -0,0 +1,4 @@
+# https://nixos.org/manual/nixpkgs/stable/#chap-packageconfig
+{
+
+}
diff --git a/nixos/profiles/common/nixpkgs/overlays.nix b/nixos/profiles/common/nixpkgs/overlays.nix
new file mode 100644
index 0000000..613338f
--- /dev/null
+++ b/nixos/profiles/common/nixpkgs/overlays.nix
@@ -0,0 +1,4 @@
+# https://nixos.org/manual/nixpkgs/stable/#sec-overlays-definition
+[
+
+]
diff --git a/nixos/profiles/common/sanix.nix b/nixos/profiles/common/sanix.nix
new file mode 100644
index 0000000..a20db24
--- /dev/null
+++ b/nixos/profiles/common/sanix.nix
@@ -0,0 +1,24 @@
+{ lib, pkgs, config, ... }: {
+  # Use the Nixpkgs config and overlays from the local files for this NixOS build
+  nixpkgs = {
+    config = import ./nixpkgs/config.nix;
+    overlays = import ./nixpkgs/overlays.nix;
+  };
+
+  # Makes commands default to the same Nixpkgs, config, overlays and NixOS configuration
+  nix.nixPath = [
+    "nixpkgs=${pkgs.path}"
+    "nixos-config=${toString <nixos-config>}"
+    "nixpkgs-overlays=${toString ./nixpkgs/overlays.nix}"
+  ];
+  environment.variables.NIXPKGS_CONFIG = lib.mkForce (toString ./nixpkgs/config.nix);
+
+  # Remove the stateful nix-channel command
+  environment.extraSetup = ''
+    rm --force $out/bin/nix-channel
+  '';
+
+  # This option is broken when set false, prevent people from setting it to false
+  # And we implement the important bit above ourselves
+  nix.channel.enable = true;
+}
diff --git a/nixos/profiles/server/default.nix b/nixos/profiles/server/default.nix
new file mode 100644
index 0000000..4ccef67
--- /dev/null
+++ b/nixos/profiles/server/default.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, ... }:
+
+{
+  imports = [
+    ../common
+  ];
+
+  services = {
+    openssh = {
+      enable = true;
+    };
+  };
+}
diff --git a/nixos/profiles/workstation/create.nix b/nixos/profiles/workstation/create.nix
new file mode 100644
index 0000000..1fc7a28
--- /dev/null
+++ b/nixos/profiles/workstation/create.nix
@@ -0,0 +1,11 @@
+{ config, pkgs, ... }:
+
+{
+  environment.systemPackages = with pkgs; [
+    graphviz-nox # for dot
+
+    gimp
+    krita
+  ];
+}
+
diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix
new file mode 100644
index 0000000..ddc9a8c
--- /dev/null
+++ b/nixos/profiles/workstation/default.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, ... }:
+
+{
+  imports = [
+    ../common
+    <top/shared/basics-physical.nix>
+    ./graphical.nix
+    ./dev.nix
+    ./create.nix
+  ];
+
+  environment.systemPackages = with pkgs; [
+    npins
+  ];
+
+  environment.sessionVariables = {
+    # Tell .zshrc to source zshrc-workstation.sh.
+    MYNIX_PROFILE = "workstation";
+  };
+}
diff --git a/nixos/profiles/workstation/dev.nix b/nixos/profiles/workstation/dev.nix
new file mode 100644
index 0000000..1e04b4c
--- /dev/null
+++ b/nixos/profiles/workstation/dev.nix
@@ -0,0 +1,31 @@
+{ config, pkgs, ... }:
+
+{
+  environment.systemPackages = with pkgs; [
+    rustup
+    python313
+    nodejs_22
+
+    # CLI tools
+    docker-compose
+    gnumake
+    jq
+    just
+    sqlite-interactive
+    tokei
+
+    (writeShellScriptBin "deploy-dir" (builtins.readFile ./scripts/deploy-dir))
+
+    gcc # rustc fails if cc linker isn't found
+    chromium
+
+    vscodium
+    # I'm installing extensions via my install-imperative script.
+  ];
+
+  virtualisation.podman = {
+    enable = true;
+    dockerSocket.enable = true;
+  };
+}
+
diff --git a/nixos/profiles/workstation/graphical.nix b/nixos/profiles/workstation/graphical.nix
new file mode 100644
index 0000000..d79ed97
--- /dev/null
+++ b/nixos/profiles/workstation/graphical.nix
@@ -0,0 +1,98 @@
+{ config, pkgs, ... }:
+
+{
+  programs.sway = {
+    enable = true;
+    # Execute sway with required environment variables for GTK apps.
+    wrapperFeatures.gtk = true;
+  };
+  programs.ssh.startAgent = true;
+
+  environment.loginShellInit = ''
+    [[ "$(tty)" == /dev/tty1 ]] && exec sway
+  '';
+
+  environment.systemPackages = with pkgs; [
+    swaylock
+
+    # CLI tools
+    brightnessctl
+    wl-clipboard # for wl-copy and wl-paste
+    grim
+
+    # When I ssh into a server my terminal changes to a host-specific background color via
+    # a LocalCommand configured in ~/.ssh/config and a ZSH function to reset the color on exit.
+    (writeShellScriptBin "set-bg" (builtins.readFile ./scripts/set-bg))
+    (writeShellScriptBin "reset-bg" (builtins.readFile ./scripts/reset-bg))
+
+    # graphical tools
+    imv
+    mpv
+
+    # set and forget
+    i3status-rust
+  ];
+
+  # This generates /etc/xdg/mimeapps.list. The XDG spec and xdg-open don't support wildcards in MIME types.
+  # TODO: use an xdg-open alternative that supports wildcards in MIME types and doesn't use mimeapps.list
+  xdg.mime.defaultApplications =
+    let
+      defaultBrowser = "firefox.desktop";
+    in
+    {
+      "text/html" = defaultBrowser;
+
+      "x-scheme-handler/http" = defaultBrowser;
+      "x-scheme-handler/https" = defaultBrowser;
+      "x-scheme-handler/mailto" = "thunderbird.desktop";
+    };
+
+  services.pipewire = {
+    enable = true;
+    alsa.enable = true;
+    alsa.support32Bit = true;
+    pulse.enable = true;
+  };
+  security.rtkit.enable = true; # recommended for PipeWire
+
+  programs.thunderbird = {
+    enable = true;
+  };
+
+  programs.firefox = {
+    enable = true;
+
+    policies = {
+      DontCheckDefaultBrowser = true;
+      DisablePocket = true;
+      FirefoxHome = {
+        SponsoredTopSites = false;
+      };
+
+      SearchSuggestEnabled = false;
+      # cannot use SearchEngines because it's only available on ESR :(
+      # (https://mozilla.github.io/policy-templates/#searchengines-this-policy-is-only-available-on-the-esr)
+
+      Preferences = {
+        "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px
+        "browser.uidensity" = 1;
+        "browser.aboutConfig.showWarning" = false;
+        "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked
+      };
+
+      ExtensionSettings = {
+        "uBlock0@raymondhill.net" = {
+          install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
+          installation_mode = "force_installed";
+        };
+      };
+
+      PasswordManagerEnabled = false;
+      AutofillCreditCardEnabled = false;
+      ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
+        install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
+        installation_mode = "force_installed";
+      };
+    };
+  };
+}
diff --git a/nixos/profiles/workstation/scripts/deploy-dir b/nixos/profiles/workstation/scripts/deploy-dir
new file mode 100755
index 0000000..bb7dfdf
--- /dev/null
+++ b/nixos/profiles/workstation/scripts/deploy-dir
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+if [ "$#" -ne 3 ]; then
+    echo "usage: $0 <local_dir> <ssh_dest> <remote_dir>"
+    exit 1
+fi
+printf -v remote_dir %q $3
+
+cd $1
+tar cf - . | ssh $2 "set -xe
+TEMP_DIR=\$(mktemp -d)
+cd \$TEMP_DIR
+tar xvf -
+rm -rf $remote_dir
+mv \$TEMP_DIR $remote_dir
+"
diff --git a/nixos/profiles/workstation/scripts/reset-bg b/nixos/profiles/workstation/scripts/reset-bg
new file mode 100644
index 0000000..5aa20f6
--- /dev/null
+++ b/nixos/profiles/workstation/scripts/reset-bg
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+echo -en "\033]111\007"
diff --git a/nixos/profiles/workstation/scripts/set-bg b/nixos/profiles/workstation/scripts/set-bg
new file mode 100644
index 0000000..e78afdc
--- /dev/null
+++ b/nixos/profiles/workstation/scripts/set-bg
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+rgb_with_slashes=$(echo "$1" | sed -r 's,(..)(..),\1/\2/,')
+echo -en "\033]11;rgb:$rgb_with_slashes\007"
diff --git a/nixos/rebuild b/nixos/rebuild
index 978dc87..80a52cd 100755
--- a/nixos/rebuild
+++ b/nixos/rebuild
@@ -28,4 +28,4 @@ nixpkgsPath=$(nix-eval --argstr channel "$channel" --expr '{channel}: (import ./
 
 # nixos-rebuild always reads Nixpkgs from the NIX_PATH,
 # so we need to set it explicitly to our pinned version
-exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath"
+exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath" -I top="$(pwd)"
diff --git a/nixos/sanix.nix b/nixos/sanix.nix
deleted file mode 100644
index 02d9ed5..0000000
--- a/nixos/sanix.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ lib, pkgs, config, ... }: {
-  environment.systemPackages = with pkgs; [
-    # We're using npins to manage the systems Nixpkgs version, install it globally for ease
-    npins
-  ];
-
-  # Use the Nixpkgs config and overlays from the local files for this NixOS build
-  nixpkgs = {
-    config = import ./nixpkgs/config.nix;
-    overlays = import ./nixpkgs/overlays.nix;
-  };
-
-  # Makes commands default to the same Nixpkgs, config, overlays and NixOS configuration
-  nix.nixPath = [
-    "nixpkgs=${pkgs.path}"
-    "nixos-config=${toString <nixos-config>}"
-    "nixpkgs-overlays=${toString ./nixpkgs/overlays.nix}"
-  ];
-  environment.variables.NIXPKGS_CONFIG = lib.mkForce (toString ./nixpkgs/config.nix);
-
-  # Remove the stateful nix-channel command
-  environment.extraSetup = ''
-    rm --force $out/bin/nix-channel
-  '';
-
-  # This option is broken when set false, prevent people from setting it to false
-  # And we implement the important bit above ourselves
-  nix.channel.enable = true;
-}
diff --git a/nixos/shared/basics-physical.nix b/nixos/shared/basics-physical.nix
new file mode 100644
index 0000000..683c3b2
--- /dev/null
+++ b/nixos/shared/basics-physical.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{
+  environment.systemPackages = with pkgs; [
+    pciutils
+    usbutils
+  ];
+}
diff --git a/nixos/shared/tailscale.nix b/nixos/shared/tailscale.nix
new file mode 100644
index 0000000..5d5a99c
--- /dev/null
+++ b/nixos/shared/tailscale.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{
+  services.tailscale = {
+    enable = true;
+    # MANUAL: run tailscale up --login-server https://<tailscaleControlServer>/
+  };
+}
-- 
cgit v1.2.3