diff --git a/nix-for-php-developers/forgejo.png b/nix-for-php-developers/forgejo.png new file mode 100644 index 0000000..b7ff8c6 Binary files /dev/null and b/nix-for-php-developers/forgejo.png differ diff --git a/nix-for-php-developers/homelab.jpg b/nix-for-php-developers/homelab.jpg new file mode 100644 index 0000000..15a62ea Binary files /dev/null and b/nix-for-php-developers/homelab.jpg differ diff --git a/nix-for-php-developers/homelab2.jpg b/nix-for-php-developers/homelab2.jpg new file mode 100644 index 0000000..b7dd7c5 Binary files /dev/null and b/nix-for-php-developers/homelab2.jpg differ diff --git a/nix-for-php-developers/immich.png b/nix-for-php-developers/immich.png new file mode 100644 index 0000000..ebcfa03 Binary files /dev/null and b/nix-for-php-developers/immich.png differ diff --git a/nix-for-php-developers/jellyfin.png b/nix-for-php-developers/jellyfin.png new file mode 100644 index 0000000..860e18f Binary files /dev/null and b/nix-for-php-developers/jellyfin.png differ diff --git a/nix-for-php-developers/peertube.png b/nix-for-php-developers/peertube.png new file mode 100644 index 0000000..fabaf68 Binary files /dev/null and b/nix-for-php-developers/peertube.png differ diff --git a/nix-for-php-developers/slides.md b/nix-for-php-developers/slides.md index 0e8adfb..ebea7b0 100644 --- a/nix-for-php-developers/slides.md +++ b/nix-for-php-developers/slides.md @@ -23,7 +23,7 @@ h1 { } -# Nix for PHP Developers +# Nix for PHP Developers
(and everyone else)

@@ -39,6 +39,7 @@ https://www.oliverdavies.uk -# Nix for ~~PHP Developers~~ everyone - -
-
- -Oliver Davies (opdavies) - -https://www.oliverdavies.uk +# This is a Nix talk with some PHP,
not a PHP talk with some Nix @@ -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 -This is talk #107 +--- + + + +![bg fit](./homelab2.jpg) + + + +--- + + + +![bg fit](./homelab.jpg) + + + + + +--- + +![bg fit](./website.png) + + + +--- + + + +![bg fit](./forgejo.png) + + + +--- + + + +![bg fit](./jellyfin.png) + + + +--- + + + +![bg fit](./immich.png) + + --- @@ -351,6 +435,11 @@ $ nix run nixpkgs#php82 -- -v PHP 8.2.29 ``` + + + --- # Using a `shell.nix` file @@ -396,6 +485,7 @@ Composer version 2.8.5 2025-01-21 15:23:40 ``` @@ -499,6 +589,10 @@ Without NixOS: + + --- # Managing services @@ -596,6 +690,12 @@ Run `nix run .` and go to http://localhost:8000. --- + + ![bg fit](./process-compose.png) --- @@ -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="; +} +``` +--- + + + # 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; +``` + + + +--- + # 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) diff --git a/nix-for-php-developers/website.png b/nix-for-php-developers/website.png new file mode 100644 index 0000000..d77b5c4 Binary files /dev/null and b/nix-for-php-developers/website.png differ