Updates for TechMids
BIN
nix-for-php-developers/forgejo.png
Normal file
|
After Width: | Height: | Size: 296 KiB |
BIN
nix-for-php-developers/homelab.jpg
Normal file
|
After Width: | Height: | Size: 4.2 MiB |
BIN
nix-for-php-developers/homelab2.jpg
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
nix-for-php-developers/immich.png
Normal file
|
After Width: | Height: | Size: 2.8 MiB |
BIN
nix-for-php-developers/jellyfin.png
Normal file
|
After Width: | Height: | Size: 4.1 MiB |
BIN
nix-for-php-developers/peertube.png
Normal file
|
After Width: | Height: | Size: 868 KiB |
|
|
@ -23,7 +23,7 @@ h1 {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
# Nix for PHP Developers
|
# Nix for PHP Developers<br> (and everyone else)
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
@ -39,6 +39,7 @@ https://www.oliverdavies.uk
|
||||||
<style scoped>
|
<style scoped>
|
||||||
section {
|
section {
|
||||||
place-content: center;
|
place-content: center;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|
@ -46,18 +47,14 @@ h1 {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
# Nix for ~~PHP Developers~~ everyone
|
# This is a Nix talk with some PHP,<br> not a PHP talk with some Nix
|
||||||
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
Oliver Davies (opdavies)
|
|
||||||
|
|
||||||
https://www.oliverdavies.uk
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
PHP examples, but apply to other languages.
|
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 -->
|
<!-- _paginate: false -->
|
||||||
|
|
@ -66,18 +63,105 @@ Replace PHP with your language of choice
|
||||||
|
|
||||||
# About Me
|
# About Me
|
||||||
|
|
||||||
- PHP since 2007
|
- HTML, CSS, PHP since 2007
|
||||||
- Drupal since 2008
|
- Drupal since 2008
|
||||||
|
- JavaScript, TypeScript, Go
|
||||||
- Full-time Linux since ~2015
|
- Full-time Linux since ~2015
|
||||||
- Nix/NixOS since 2022
|
- 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.
|
PHP and Drupal Development. Linux-based infrastructure and systems administration. Automation.
|
||||||
|
|
||||||
Vagrant, Puppet, Ansible.
|
Vagrant, Puppet, Ansible.
|
||||||
|
-->
|
||||||
|
|
||||||
This is talk #107
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Homelab 1.0
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: #021330;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
|
-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: #021330;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!--
|
||||||
|
_footer: ''
|
||||||
|
_paginate: false
|
||||||
-->
|
-->
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -351,6 +435,11 @@ $ nix run nixpkgs#php82 -- -v
|
||||||
PHP 8.2.29
|
PHP 8.2.29
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Great for one-off tools, but what if you need more than one thing
|
||||||
|
-->
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Using a `shell.nix` file
|
# 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.
|
Can import shell.nix.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
@ -499,6 +589,10 @@ Without NixOS:
|
||||||
|
|
||||||
<https://github.com/juspay/services-flake>
|
<https://github.com/juspay/services-flake>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
What if you need long-running services, like a database
|
||||||
|
-->
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Managing services
|
# Managing services
|
||||||
|
|
@ -596,6 +690,12 @@ Run `nix run .` and go to http://localhost:8000.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
@ -605,6 +705,12 @@ _paginate: false
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
section {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
@ -704,7 +810,7 @@ use flake
|
||||||
Using a remote Flake:
|
Using a remote Flake:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
use flake "git+https://code.oliverdavies.uk/opdavies/dev-shells#php84"
|
use flake "git+https://git.oliverdavies.uk/opdavies/dev-shells#php84"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```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:
|
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
|
```shell
|
||||||
nix build
|
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
|
# Building Nix packages
|
||||||
|
|
||||||
```shell
|
```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?
|
# Not sure?
|
||||||
|
|
||||||
Want to try it, but you're 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://github.com/nixos/nixpkgs
|
||||||
- https://wiki.nixos.org/wiki/PHP
|
- https://wiki.nixos.org/wiki/PHP
|
||||||
- https://nixos.org/manual/nixpkgs/stable/#ssec-building-php-projects
|
- https://nixos.org/manual/nixpkgs/stable/#ssec-building-php-projects
|
||||||
- https://code.oliverdavies.uk/opdavies/lab
|
- https://git.oliverdavies.uk/opdavies/lab
|
||||||
- https://code.oliverdavies.uk/opdavies/nix-config (laptop and home server)
|
- https://git.oliverdavies.uk/opdavies/nix-config (laptop, Neovim, home server)
|
||||||
- https://books.oliverdavies.uk/nix-for-php-developers (book, in progress)
|
- https://books.oliverdavies.uk/nix-for-php-developers (book, in progress)
|
||||||
|
|
|
||||||
BIN
nix-for-php-developers/website.png
Normal file
|
After Width: | Height: | Size: 114 KiB |