Building a Philosophy Workstation with NixOS: Installing Firefox, VSCodium, and LaTeX

A NixOS tutorial on creating a Philosophy Workstation with Firefox, VSCodium, and LaTeX.

An oil painting of two women at a desk. One of them is writing.
Johannes Vermeer: Lady Writing a Letter with her Maid. Image Source: Wikimedia Commons.

Hey there! I'm Shen, and I'm a Philosophy and Computer Science student. My area of interest is in metaphysics and ontology – and in this tutorial, I will show you how to setup a workstation for Philosophy using NixOS.

This tutorial is designed for the Philosophy student who is familiar and comfortable with Linux in general, but new to NixOS. It may also be suitable for Computer Science students and Software Developers, with some modifications. The tutorial will walk you through the process step-by-step and provide ample links and explanations. We will be continuing from where the previous guide left off, starting with wireless networking, Home Manager, and a basic Sway graphical environment. In this guide (Part II), we will install and configure the software needed to practice philosophy:

  • Firefox – For reading papers, and writing blog posts! Unlike Wittgenstein, we can (thankfully) publish more than one work in our lifetime.
  • TeX/LaTeX – Used to write essays and longer-form content. LaTeX allows us to focus on the formal cause of our essay, instead of grappling with the material cause. Plato didn't write his dialogues on Microsoft Word, and neither should you.
  • VSCodium – We will use VSCodium (an open-source fork of VSCode) to write LaTeX documents. We use VSCodium because it's extensibility allows us to use a custom language engine. The syntax highlighting will be helpful for students of the Analytic tradition as well. (Full disclosure: I am a student of the Continental tradition.)

For Part III, we will also do the following:

The ontology of this tutorial is dialectical in nature. Hence we will not provide a complete configuration (which would only be true opinion, and not knowledge) – but take the reader step-by-step through the process of building a NixOS workstation.

Installing and Configuring Firefox

Let's begin with installing and configuring Firefox. We'll be adding Firefox to our configurations.nix file using Home Manager. Having Firefox available on our NixOS system is as easy as adding:

programs.firefox = {
    enable = true;
};

Followed by running sudo nixos-rebuild --switch. But wait! We are not done yet. For this configuration would only give us a bare-bones, default Firefox installation. Could we manage our settings (and even browser plugins) through our NixOS config as well? That is certainly possible. In fact, Home Manager offers a wide array of options for configuring Firefox. All of these settings are held within the (Firefox) user profile, so we can begin by setting up a default profile for Firefox:

programs.firefox = {
    enable = true;
    profiles.default = {
        id = 0;
        name = "Default";
    };
};

It is within this profiles.default scope where we can customise our Firefox installation. Here, you can add directives such as userChrome or userContent, which allows you to change the look and interface of the Firefox UI in powerful ways. For example, you can use the userChrome directive to add custom CSS styles which can remove the Firefox tab bar. This would be useful if you are using a browser extension such as Tree Style Tabs.

Configuring Firefox Settings Through NixOS

For our tutorial, we will add the settings directive within profiles.default. This allows us to configure Firefox with our settings and preferences – which can be both as mundane as setting a homepage, to disabling the default telemetry, debugging, and the sponsored Pocket integration. Previously, you would have had to dig through Firefox's settings page, but with the power of NixOS, we can configure it all in one place! Let's begin by setting our homepage:

programs.firefox = {
    enable = true;
    profiles.default = {
        id = 0;
        name = "Default";
        settings = {
            # Browser settings go here
            "browser.startup.homepage" = "https://shen.hong.io/";
            
        };
    };
};

Note how each setting directive is a string, followed by an equal sign that points to it's value, and the line ends with a semicolon. Don't mess this up! The rest of the settings will all go within this scope.

Next, let's enable HTTPS Everywhere. This will ensure that our browser connects to websites only via HTTPS, and show a warning should it not be available. Don't worry, you can still visit (and whitelist) HTTP sites, but it's a good security measure for 2022.

# Enable HTTPS-Only Mode
"dom.security.https_only_mode" = true;
"dom.security.https_only_mode_ever_enabled" = true;

Continuing on this theme of security and privacy, lets enable some privacy settings such as the Do Not Track header, as well as configure Firefox's built-in tracking protection. These measures are no replacement for a dedicated browser extension such as UBlock Origin, but it's a good start.

# Privacy settings
"privacy.donottrackheader.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
"privacy.partition.network_state.ocsp_cache" = true;

Remember! Privacy is essential to the conduct and practice of true philosophy.

# Disable all sorts of telemetry
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.ping-centre.telemetry" = false;
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.updatePing.enabled" = false;

# As well as Firefox 'experiments'
"experiments.activeExperiment" = false;
"experiments.enabled" = false;
"experiments.supported" = false;
"network.allow-experiments" = false;

I admit, number of directives in the previous section was distressingly long. And I'm not even sure if the options listed are complete. If you happen to know of any other settings that will help improve the privacy of a Firefox user, please reach out and let me know! In any case, we are not done yet. The last thing that we must do in our Firefox configuration, is to remove and disable the Pocket extension. These settings should completely neutralise it – we both remove Pocket from the new tabs page, as well as delete it's API URL and the unique per-user authentication key.

# Disable Pocket Integration
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"extensions.pocket.enabled" = false;
"extensions.pocket.api" = "";
"extensions.pocket.oAuthConsumerKey" = "";
"extensions.pocket.showHome" = false;
"extensions.pocket.site" = "";

With all of the above settings, you should have a Firefox installation that's secure, privacy-friendly, and ready for use. Remember to run sudo nixos-rebuild --switch!

Where do I find additional settings for Firefox?

All of the settings above came from Firefox. Specifically, they are entries from Firefox's about:config page. If you enter that into your Firefox URL bar, it should open a special internal page which lists all the settings and their values. As far as I understand, these settings are how Firefox configures itself internally. What is an easy way to browse, or find more settings?

Unfortunately, I can't seem to find an official listing or directory of all the settings and explanations for their effects. I was able to find an user-contributed Wiki which lists many settings, but the entries appear to be a little dated. If someone can help me find an official list of all about:config entries and their usage, I would be very grateful. Let me know if you know where to look!

How do I configure extensions like uBlock Origin through NixOS?

This... isn't actually a rhetorical question. I genuinely wish to know! Right now, I have simply installed my Firefox extensions manually from within Firefox. I'd like to be able to manage my extensions through NixOS and Home Manager as well, but I'm not sure how. If you know of a way to manage Firefox extensions through Nix, I would be grateful if you can write to me.

Installing LaTeX on NixOS

After FireFox, installing LaTeX is a relatively simple affair. LaTeX is a document typesetting engine used to produce academic and technical documents, and it is an essential part of my personal philosophy workflow. LaTeX under NixOS is offered by the texlive scheme, with different schemes for different numbers of LaTeX packages. If space or installation time is a constraint, it may be useful to go with a smaller scheme like texlive.combined.scheme-medium, but I personally didn't worry and went with the full installation with all LaTeX packages:

# Packages installed (under Home Manager)
home.packages = with pkgs; [
    # Full LaTeX installation with all packages
    texlive.combined.scheme-full
];

The above directive, followed by a quick sudo nixos-rebuild --switch – and LaTeX is installed! It's available via latex or lualatex. Isn't NixOS magical?

LaTeX support in NixOS is important to me. I write all my papers in LaTeX – as it allows me to focus on the content of my discourse, rather than it's layout. That's not to say LaTeX documents aren't beautiful on their own, however! Over the years, I've made my own LaTeX template which comes with all the typographic bells and whistles of professional typesetting. It's also PDF/A compliant (archival grade), for the day I die and become one with the facticity of historicity. And of course, LaTeX's powerful TKZ-Euclide package allows the Galileo's Geometra filosofico to construct demonstrations of the same apodeictic certainty as Euclid.

Example of a TKZ-Euclide Construction in LaTeX. Excerpt from my essay on the Hjelmslev transformation (which is ironically, on non-Euclidean Geometry).

The completely text-based format of LaTeX makes it easy to commit one's work to version control, which makes it easy to keep track of the progression of one's thoughts and changes through time. Immanuel Kant certainly wished that he had git while he was working on his Critique of Pure Reason. Alas, he didn't – and that's why modern editions of his text have to put up with very strange marginal page numbering schemes like 14[b] and 188[a], just to keep track of the differences between the first and second editions. Whatever the metaphysics of the future is, it will be version-controlled with git and paginated with diff.

Installing VSCodium, and Configuration for the Java Language Engine

Working with a LaTeX Document (my thesis on Sartre) with VSCodium

Now that we have LaTeX installed, it's time to install and configure VSCodium so we have an editor to work with. VSCodium is an open-source fork of Microsoft's VSCode, a powerful and highly configurable text editor. Named in honor of Charles Cotin, the 15th century French philosopher and polyglot, both Cotin and VSCode are known for their support of many languages. VSCodium is used for academic writing, but it is also popular amongst Programmers and Software Developers as well.

# Install VSCodium under Home Manager
programs.vscode = {
    enable = true;
    # Make sure to use the open source vscodium
    package = pkgs.vscodium;
};

Add the above within Home Manager's scope in configurations.nix, and VSCodium should be available. You can verify it by running codium in the command line to launch it. However, we are not finished with it yet. We still have two plugins to install:

  • LaTeX Workshop for LaTeX Syntax Highlighting and Support
  • LTeX for Grammar and Spell-checking.

We'll install both plugins in the next step through VSCodium's GUI. Although Home Manager does offer a way to define VSCodium plugins through the configurations.nix file, the two plugins above do not appear to be packaged. If the situation has changed, and the plugins are available – please let me know!

Installing the LaTeX Workshop and LTeX Plugin through VSCodium GUI

First, we will install the LaTeX Workshop plugin. This plugin adds syntax highlighting for .tex files, as well as useful autocompletion for LaTeX and packages. Simply search for it in the Extensions tab of VSCodium. It should appear with the name LaTeX Workshop, with the extension ID of james-yu.latex-workshop. Install it and we're done – it does not require any additional configuration.

Next, we install the LTeX VSCode plugin. LTeX is a powerful grammar and spelling checker, with a deep integration with LaTeX and LaTeX packages. This is not a simple dictionary by any means – it uses the same syntax engine that Software Developers and Programmers use for computer code. Furthermore, advanced users can configure LTeX to use n-Gram based language models, pre-trained neural networks, and Word2Vec language models. It's certainly a plugin that the younger Wittgenstein would be proud of – just imagine how useful symbol definition lookups and keyword autocompletion would have been, when writing the Tractatus Logico-Philosophicus!

For the actual installation, likewise navigate to the Extensions tab of VSCodium, and search for LTeX. It should appear with the name LTeX – LanguageTool grammar/spell checking and the extension ID is valentjn.vscode-ltex. Install this now – we will have to configure it next.

Configuring Java for the LTeX plugin's Local LSP Server

The LTeX plugin works by running a local instance of a Language Server that implements the LSP (Language Server Protocol), which requires Java. Unfortunately, due to NixOS's idiosyncratic ontology, the included Java executable does not work, so we must first install Java using Home Manager and have it available to our user.

# Install the Open Source Java Runtime under Home Manager
programs.java = {
    enable = true;
    package = pkgs.jdk11;
};

We use the package directive to simply tell NixOS to use the open source implementation of the Java Runtime, instead of Oracle's version. Run a sudo nixos-rebuild --switch. Now, we must restart our workstation. Restarting is essential in this process: NixOS must not only install Java, but the Java executable must be included in the $PATH variable of our user. The $PATH is essentially a list of places that your computer searches through, when you run a program like vim or git. Likewise, NixOS must set the $JAVA_HOME variable, which is a variable that Java Programs expect. As far as I can tell, these variables are only set properly when the computer is restarted after installation.

Once your computer has rebooted, we must retrieve the $JAVA_HOME path. Do this by simply running:

echo $JAVA_HOME

In the terminal. You should see a path which leads to your Java executable. Copy this path, and navigate into the settings page of LTeX in VSCodium. Find the setting listed as ltex.java.path, and paste your $JAVA_HOME output there.

Now restart VSCodium, and the LTeX plugin should work! Now, you should have completed the configuration of your writing space. With VSCodium and LTeX, you have a solid tool for writing essays – the material of philosophical inquiry. And oh, what wonderful essays you will write!

But what kind of essays can I write? I don't know any philosophy! I don't know anything at all!

Socrates knew nothing, and he was the wisest man in Athens.

No, but seriously – what should I write about?

Why not write about yourself? Philosophy is fundamentally an act of contemplation – and there is no better form of contemplation than the contemplation of the self. Know thyself, was the inscription at the Temple of the Oracle of Delphi. There can be great pleasure and virtue, in writing essays about your world and what you know.

This is not a sophistry – I genuinely mean it. Write about yourself. There's no topic that you know better than your own being. And in this process, you will follow the path of Michel de Montaigne, who wrote essays too. Montaigne sat down one day, in the evening of his life. In front of a philosophy workstation not too dissimilar to our own. He had also pondered, about the question of what to write about.

He realised very quickly that he knew little. He saw himself before all the experts of the world – the geometers and theologians, and realised he can hope to offer nothing useful in that regard. He was a courtier and a statesman – an occupation usual for a nobleman of his rank. But his career is uninteresting, and his hair is greying, and he knew he was not going to create a treatise of political philosophy or any lofty work of grandeur and acclaim.

"What do I know?" Asked Michel de Montaigne. And so he decided to write, about the only thing that he knew well. He wrote about himself. He wrote for himself. He examined the world through his eyes, and tried to contemplate about its questions – without thought as to approval or greatness. He wrote essays On Friendship, and On Solitude. On the Education of Children. He wrote about the little things that he knew well. And throughout this all, he wrote with humility and contemplation, with genuine curiosity and goodwill. Above all, he wrote with frankness and sincerity. When the court was abuzz with sensation and scandal, upon hearing stories On Cannibals and "savages" from the New World, Montaigne wrote about how:

I do not believe, from what I have been told about this people, that there is anything barbarous or savage about them.

But directed the eye of his fellows towards the cruelty of the Inquisition, and the affairs of their own "civilised" states.

I consider it more barbarous to eat a man alive than to eat him dead; to tear by rack and torture a body still full of feeling, ... a practice which we have not only read about but seen within recent memory, not between ancient enemies, but between neighbours and fellow-citizens and, what is worse, under the cloak of piety and religion - than to roast and eat a man after he is dead.

It's hard to write, because we all ask ourselves Montaigne's question: "What do I know?" And just like Montaigne, we find ourselves facing the experts of the world, the great mathematicians and computer scientists – who have written volumes and monographs, irreproachable in their perfection. But you are still the foremost expert of yourself, if you strive towards contemplation and curiosity. And like Michel de Montaigne, you can write about your world, and what you know – in bits and dabbles and little blog posts too.

Ultimately, Montaigne's writings – his attempts at understanding his world – gave us the literary genre of the essay itself (essayer: French, "to try") . It catapulted him to fame, and he is considered one of the foremost philosophers and humanists of the European Renaissance. But this all began very slowly – with curious person, sitting in front of a workstation. A Philosophy workstation.

Who picks up their pen, and began to write.

sudo nixos-rebuild --switch
touch  my-essay.tex
codium my-essay.tex

Thank you for reading Part II of my guide in building a Philosophy Workstation with NixOS. If you have any questions or comments, feel free to contact me – I would love to know if my guide has helped you in any way! I enjoy exchanging emails with interesting strangers, and look forwards to your correspondence.