<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.2">Jekyll</generator><link href="https://ap5.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ap5.dev/" rel="alternate" type="text/html" /><updated>2024-12-10T19:18:36+00:00</updated><id>https://ap5.dev/feed.xml</id><title type="html">Anna Kudriavtsev</title><subtitle>anna&apos;s personal website</subtitle><entry><title type="html">Bootstrapping Rails on NixOS</title><link href="https://ap5.dev/blog/2023/01/04/bootstrapping-rails-on-nixos" rel="alternate" type="text/html" title="Bootstrapping Rails on NixOS" /><published>2023-01-04T04:59:27+00:00</published><updated>2023-01-04T04:59:27+00:00</updated><id>https://ap5.dev/blog/2023/01/04/bootstrapping-rails-on-nixos</id><content type="html" xml:base="https://ap5.dev/blog/2023/01/04/bootstrapping-rails-on-nixos"><![CDATA[<p>recently tried to start a Rails project on NixOS, realized that there was no obvious way to start a new one, even though it seemed fairly straightforward to work on an existing project.</p>

<p>i figured out a fairly simple process. i use direnv and flakes, and this process does too.</p>

<p>first, create a project directory. enter it. create the following two files to set up a trivial flake:</p>

  <div class="code-file">
    <code class="code-file-name"> flake.nix  </code>

<div class="language-nix highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span>
    <span class="nv">description</span> <span class="o">=</span> <span class="s2">"TODO"</span><span class="p">;</span>

    <span class="nv">inputs</span><span class="o">.</span><span class="nv">flake-utils</span><span class="o">.</span><span class="nv">url</span> <span class="o">=</span> <span class="nv">github</span><span class="p">:</span><span class="sx">numtide/flake-utils</span><span class="p">;</span>

    <span class="nv">outputs</span> <span class="o">=</span> <span class="p">{</span> <span class="nv">self</span><span class="p">,</span> <span class="nv">nixpkgs</span><span class="p">,</span> <span class="nv">flake-utils</span> <span class="p">}:</span>
        <span class="nv">flake-utils</span><span class="o">.</span><span class="nv">lib</span><span class="o">.</span><span class="nv">eachDefaultSystem</span> <span class="p">(</span><span class="nv">system</span><span class="p">:</span> <span class="kd">let</span>
            <span class="nv">pkgs</span> <span class="o">=</span> <span class="nv">nixpkgs</span><span class="o">.</span><span class="nv">legacyPackages</span><span class="o">.</span><span class="p">${</span><span class="nv">system</span><span class="p">};</span>
        <span class="kn">in</span> <span class="p">{</span>
            <span class="nv">packages</span><span class="o">.</span><span class="nv">default</span> <span class="o">=</span> <span class="nv">pkgs</span><span class="o">.</span><span class="nv">callPackage</span> <span class="sx">./default.nix</span><span class="p">;</span>
        <span class="p">});</span>
<span class="p">}</span>
</code></pre></div></div>

  </div>

  <div class="code-file">
    <code class="code-file-name"> default.nix  </code>

<div class="language-nix highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span> <span class="nv">stdenv</span><span class="p">,</span> <span class="nv">ruby_3_1</span> <span class="p">}:</span>

<span class="nv">stdenv</span><span class="o">.</span><span class="nv">mkDerivation</span> <span class="p">{</span>
    <span class="nv">pname</span> <span class="o">=</span> <span class="s2">"TODO"</span><span class="p">;</span>
    <span class="nv">version</span> <span class="o">=</span> <span class="s2">"TODO"</span><span class="p">;</span>

    <span class="nv">nativeBuildInputs</span> <span class="o">=</span> <span class="p">[];</span>
    <span class="nv">buildInputs</span> <span class="o">=</span> <span class="p">[</span> <span class="nv">ruby_3_1</span> <span class="p">];</span>
<span class="p">}</span>
</code></pre></div></div>

  </div>

<p>then, create an .envrc with the following content:</p>

  <div class="code-file">
    <code class="code-file-name"> .envrc  </code>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>use flake
layout ruby
</code></pre></div></div>

  </div>

<p>run <code class="language-plaintext highlighter-rouge">direnv allow</code>.</p>

<p>next, write a bootstrap Gemfile:</p>

  <div class="code-file">
    <code class="code-file-name"> Gemfile  </code>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">source</span> <span class="s1">'https://rubygems.org'</span>

<span class="n">gem</span> <span class="s1">'rails'</span>
</code></pre></div></div>

  </div>

<p>install locally by running <code class="language-plaintext highlighter-rouge">bundle install --path=vendor</code> (ignore the warnings for now)</p>

<p>finally, run <code class="language-plaintext highlighter-rouge">bundle exec rails install .</code> and, when asked, overwrite the bootstrap gemfile with the upstream default.</p>]]></content><author><name>Anna</name></author><category term="software" /><summary type="html"><![CDATA[recently tried to start a Rails project on NixOS, realized that there was no obvious way to start a new one, even though it seemed fairly straightforward to work on an existing project.]]></summary></entry><entry><title type="html">Hello, world</title><link href="https://ap5.dev/blog/2022/08/09/hello-world-1" rel="alternate" type="text/html" title="Hello, world" /><published>2022-08-09T23:57:36+00:00</published><updated>2022-08-09T23:57:36+00:00</updated><id>https://ap5.dev/blog/2022/08/09/hello-world-1</id><content type="html" xml:base="https://ap5.dev/blog/2022/08/09/hello-world-1"><![CDATA[<p>hi! this is my first blog post… ever.</p>

<p>the idea here is to talk about things i’m working on. i have a lot of various projects that i never really share with anyone, so this might be a good way to start doing that.</p>

<p>updating this website to add this blog section has been mildly infuriating. the entire ruby ecosystem for web stuff rose and fell with the dhh/rails hype cycle, and nothing has really moved since 2015. this website is built with jekyll, which is a really nice static page generator, but no one does anything interesting with it, and third-party plugins, including the one for the templating language i used to write it, are mostly abandoned and break with new enough versions of the tool.</p>

<p>in general, writing things in ruby is a mixed bag. it’s the programming language i’m most fluent in, by far, and it has some of the cleanest design i’ve ever seen. i think it’s one of the only nicely designed OOP languages. but due to said rails hype cycle issue, there’s not really much of a community around it anymore. all the discussion places are dead or move really slowly, and there just… aren’t libraries for things. i was looking for something like <a href="https://github.com/nschloe/colorio">colorio</a> to help me implement a certain part of <a href="https://github.com/arch-community/qbot">my discord bot</a>, but nothing like this exists. i guess no color scientists care about ruby. (if anyone has any suggestions, please let me know.)</p>]]></content><author><name>Anna</name></author><category term="misc" /><summary type="html"><![CDATA[hi! this is my first blog post… ever.]]></summary></entry></feed>