136 lines
4.6 KiB
YAML
136 lines
4.6 KiB
YAML
uuid:
|
|
- value: 6ccfb609-6371-462c-b91c-4aa22d23d248
|
|
langcode:
|
|
- value: en
|
|
type:
|
|
- target_id: daily_email
|
|
target_type: node_type
|
|
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
|
|
revision_timestamp:
|
|
- value: '2025-05-11T09:00:04+00:00'
|
|
revision_uid:
|
|
- target_type: user
|
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
|
revision_log: { }
|
|
status:
|
|
- value: true
|
|
uid:
|
|
- target_type: user
|
|
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
|
|
title:
|
|
- value: 'The Nix language'
|
|
created:
|
|
- value: '2024-11-26T00:00:00+00:00'
|
|
changed:
|
|
- value: '2025-05-11T09:00:04+00:00'
|
|
promote:
|
|
- value: false
|
|
sticky:
|
|
- value: false
|
|
default_langcode:
|
|
- value: true
|
|
revision_translation_affected:
|
|
- value: true
|
|
path:
|
|
- alias: /daily/2024/11/26/the-nix-language
|
|
langcode: en
|
|
body:
|
|
- value: |
|
|
<p>Yesterday, I wrote about <a href="/daily/2024/11/25/nix-the-package-manager">Nix the package manager</a>.</p>
|
|
|
|
<p>To use it, you need to write code in the Nix language in .nix files.</p>
|
|
|
|
<p>To see an example, you can see <a href="https://github.com/opdavies/dotfiles/tree/main/nix">my dotfiles on GitHub</a> as well as lots of other people's that they've published.</p>
|
|
|
|
<p>It's a functional language so some of the concepts were new to me, but I picked it up fairly quickly and learned some of the paradigms and conventions.</p>
|
|
|
|
<p>This is the code that installs Nginx on my server:</p>
|
|
|
|
<pre><code class="nix">services.nginx = {
|
|
enable = true;
|
|
serverNamesHashBucketSize = 256;
|
|
};
|
|
</code></pre>
|
|
|
|
<p>These are some of the packages I have installed on my laptop:</p>
|
|
|
|
<pre><code class="nix">environment.systemPackages = with pkgs: {
|
|
devenv
|
|
dog
|
|
git
|
|
go
|
|
jq
|
|
php
|
|
phpPackages.composer
|
|
pv
|
|
tldr
|
|
}
|
|
</code></pre>
|
|
|
|
<p>And this is how to configure processes <a href="/daily/2024/11/11/could-nix-and-devenv-replace-docker-compose">in a devenv configuration</a>, which is built with Nix:</p>
|
|
|
|
<pre><code class="nix">processes = {
|
|
tailwind.exec = ''
|
|
cd ${drupal.theme.path}
|
|
watchexec --exts css,twig tailwindcss --config assets/tailwind.config.ts \
|
|
--output dist/tailwind.css
|
|
'';
|
|
};
|
|
</code></pre>
|
|
|
|
<p>Once you have written the configuration, you can run it and install what you've specified, and it will do it the same way every time.</p>
|
|
|
|
<p>For a crash course in the Nix language, take a look at <a href="https://zero-to-nix.com/concepts/nix-language">https://zero-to-nix.com/concepts/nix-language</a> or one of the many open-sourced configurations on GitHub.</p>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p>Yesterday, I wrote about <a href="/daily/2024/11/25/nix-the-package-manager">Nix the package manager</a>.</p>
|
|
|
|
<p>To use it, you need to write code in the Nix language in .nix files.</p>
|
|
|
|
<p>To see an example, you can see <a href="https://github.com/opdavies/dotfiles/tree/main/nix">my dotfiles on GitHub</a> as well as lots of other people's that they've published.</p>
|
|
|
|
<p>It's a functional language so some of the concepts were new to me, but I picked it up fairly quickly and learned some of the paradigms and conventions.</p>
|
|
|
|
<p>This is the code that installs Nginx on my server:</p>
|
|
|
|
<pre><code class="nix">services.nginx = {
|
|
enable = true;
|
|
serverNamesHashBucketSize = 256;
|
|
};
|
|
</code></pre>
|
|
|
|
<p>These are some of the packages I have installed on my laptop:</p>
|
|
|
|
<pre><code class="nix">environment.systemPackages = with pkgs: {
|
|
devenv
|
|
dog
|
|
git
|
|
go
|
|
jq
|
|
php
|
|
phpPackages.composer
|
|
pv
|
|
tldr
|
|
}
|
|
</code></pre>
|
|
|
|
<p>And this is how to configure processes <a href="/daily/2024/11/11/could-nix-and-devenv-replace-docker-compose">in a devenv configuration</a>, which is built with Nix:</p>
|
|
|
|
<pre><code class="nix">processes = {
|
|
tailwind.exec = ''
|
|
cd ${drupal.theme.path}
|
|
watchexec --exts css,twig tailwindcss --config assets/tailwind.config.ts \
|
|
--output dist/tailwind.css
|
|
'';
|
|
};
|
|
</code></pre>
|
|
|
|
<p>Once you have written the configuration, you can run it and install what you've specified, and it will do it the same way every time.</p>
|
|
|
|
<p>For a crash course in the Nix language, take a look at <a href="https://zero-to-nix.com/concepts/nix-language">https://zero-to-nix.com/concepts/nix-language</a> or one of the many open-sourced configurations on GitHub.</p>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|