summaryrefslogtreecommitdiff
path: root/nixos/profiles/workstation
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/profiles/workstation')
-rw-r--r--nixos/profiles/workstation/create.nix11
-rw-r--r--nixos/profiles/workstation/default.nix20
-rw-r--r--nixos/profiles/workstation/dev.nix31
-rw-r--r--nixos/profiles/workstation/graphical.nix98
-rwxr-xr-xnixos/profiles/workstation/scripts/deploy-dir16
-rw-r--r--nixos/profiles/workstation/scripts/reset-bg2
-rw-r--r--nixos/profiles/workstation/scripts/set-bg3
7 files changed, 181 insertions, 0 deletions
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"