Updates for TechMids

This commit is contained in:
Oliver Davies 2025-11-14 12:37:58 +00:00
parent 79fcd69ab6
commit 5511abe201
8 changed files with 195 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 KiB

View file

@ -23,7 +23,7 @@ h1 {
}
</style>
# Nix for PHP Developers
# Nix for PHP Developers<br> (and everyone else)
<br>
<br>
@ -39,6 +39,7 @@ https://www.oliverdavies.uk
<style scoped>
section {
place-content: center;
text-align: center;
}
h1 {
@ -46,18 +47,14 @@ h1 {
}
</style>
# Nix for ~~PHP Developers~~ everyone
<br>
<br>
Oliver Davies (opdavies)
https://www.oliverdavies.uk
# This is a Nix talk with some PHP,<br> not a PHP talk with some Nix
<!--
PHP examples, but apply to other languages.
Replace PHP with your language of choice
Replace things with your language/CMS/framework of choice
This is a Nix talk with some PHP, not a PHP talk with some Nix.
-->
<!-- _paginate: false -->
@ -66,18 +63,105 @@ Replace PHP with your language of choice
# About Me
- PHP since 2007
- HTML, CSS, PHP since 2007
- Drupal since 2008
- JavaScript, TypeScript, Go
- Full-time Linux since ~2015
- Nix/NixOS since 2022
- Gave my first presentation at unified.diff in September 2012
- Homelabber since 2024
<!--
PHP and Drupal Development. Linux-based infrastructure and systems administration. Automation.
Vagrant, Puppet, Ansible.
-->
This is talk #107
---
<style scoped>
section {
background: black;
}
</style>
![bg fit](./homelab2.jpg)
<!--
_footer: ''
_paginate: false
-->
---
<style scoped>
section {
background: black;
}
</style>
![bg fit](./homelab.jpg)
<!--
_footer: ''
_paginate: false
-->
<!--
Homelab 1.0
-->
---
![bg fit](./website.png)
<!--
_footer: ''
_paginate: false
-->
---
<style scoped>
section {
background: black;
}
</style>
![bg fit](./forgejo.png)
<!--
_footer: ''
_paginate: false
-->
---
<style scoped>
section {
background: #021330;
}
</style>
![bg fit](./jellyfin.png)
<!--
_footer: ''
_paginate: false
-->
---
<style scoped>
section {
background: #021330;
}
</style>
![bg fit](./immich.png)
<!--
_footer: ''
_paginate: false
-->
---
@ -351,6 +435,11 @@ $ nix run nixpkgs#php82 -- -v
PHP 8.2.29
```
<!--
Great for one-off tools, but what if you need more than one thing
-->
---
# Using a `shell.nix` file
@ -396,6 +485,7 @@ Composer version 2.8.5 2025-01-21 15:23:40
```
<!--
A more recent approach.
Can import shell.nix.
-->
@ -499,6 +589,10 @@ Without NixOS:
<https://github.com/juspay/services-flake>
<!--
What if you need long-running services, like a database
-->
---
# Managing services
@ -596,6 +690,12 @@ Run `nix run .` and go to http://localhost:8000.
---
<style scoped>
section {
background: black;
}
</style>
![bg fit](./process-compose.png)
<!--
@ -605,6 +705,12 @@ _paginate: false
---
<style scoped>
section {
background: black;
}
</style>
![bg fit](./drupal-install.png)
<!--
@ -704,7 +810,7 @@ use flake
Using a remote Flake:
```bash
use flake "git+https://code.oliverdavies.uk/opdavies/dev-shells#php84"
use flake "git+https://git.oliverdavies.uk/opdavies/dev-shells#php84"
```
```bash
@ -758,7 +864,7 @@ pkgs.writeShellApplication {
```
<!--
Explicit dependencies. More shareable and no need to remember what's installed elsewhere.
Explicit and bundled dependencies. "Batteries included". More shareable and no need to remember what's installed elsewhere.
-->
---
@ -814,7 +920,7 @@ php.buildComposerProject2 (finalAttrs: {
Packaging Sculpin was essentially the same:
https://code.oliverdavies.uk/opdavies/lab/src/branch/main/nix/sculpin
https://git.oliverdavies.uk/opdavies/lab/src/branch/main/nix/sculpin
```shell
nix build
@ -834,6 +940,49 @@ nix build
---
# Packaging npm
```nix
pkgs.buildNpmPackage rec {
pname = "openapi-generate-html";
version = "0.5.3";
src = pkgs.fetchFromGitHub {
owner = "qazsato";
repo = pname;
rev = "v${version}";
hash = "sha256-+RmwoRhvfkaj/d3EwID7E6noVV+M3h6pe7IEVYyuUwk=";
};
dontNpmBuild = true;
npmDepsHash = "sha256-7yYM43fAR2HLACOQNw7N/t8Lk+17qNfeDKzfb1wx/0U=";
}
```
---
# Packaging Go
```nix
pkgs.buildGoModule rec {
pname = "openapi-mock";
version = "0.3.9";
src = pkgs.fetchFromGitHub {
owner = "muonsoft";
repo = pname;
rev = "v${version}";
hash = "sha256-7u//uwcVV1/EI6Rr3ju7KOwMYt/dXivyvBWIpTaoWZk=";
};
vendorHash = "sha256-KPCRunuCIbBX+YpHgshixmrxM3Ey0LIdEC0Z4CtpQoI=";
}
```
---
<!-- TODO: remove this slide -->
# Building Nix packages
```shell
@ -858,6 +1007,34 @@ Phpactor 2025.03.28.0
---
# NixOS in production?
```nix
services.phpfpm.enable = true;
services.mysql.enable = true;
services.nginx.enable = true;
```
---
# NixOS in my homelab
```nix
services.jellyfin.enable = true;
services.immich.enable = true;
services.paperless.enable = true;
```
<!--
Learn once, use everywhere.
-->
---
# Not sure?
Want to try it, but you're not sure?
@ -882,6 +1059,6 @@ $ podman run --rm -it nixos/nix
- https://github.com/nixos/nixpkgs
- https://wiki.nixos.org/wiki/PHP
- https://nixos.org/manual/nixpkgs/stable/#ssec-building-php-projects
- https://code.oliverdavies.uk/opdavies/lab
- https://code.oliverdavies.uk/opdavies/nix-config (laptop and home server)
- https://git.oliverdavies.uk/opdavies/lab
- https://git.oliverdavies.uk/opdavies/nix-config (laptop, Neovim, home server)
- https://books.oliverdavies.uk/nix-for-php-developers (book, in progress)

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB