Initial commit
This commit is contained in:
commit
917011db7e
5 changed files with 198 additions and 0 deletions
157
book/index.adoc
Normal file
157
book/index.adoc
Normal file
|
@ -0,0 +1,157 @@
|
|||
[separator=::]
|
||||
= Nix for PHP Developers
|
||||
:author: Oliver Davies (opdavies)
|
||||
:copyright: 2025 {author}
|
||||
:creator: {author}
|
||||
:description: How to use Nix as a PHP Developer.
|
||||
:doctype: book
|
||||
:email: oliver@oliverdavies.uk
|
||||
// :front-cover-image: image:cover.png[width=1024,height=1024]
|
||||
:icons: font
|
||||
:keywords: php software-development nix linux
|
||||
:leveloffset: +1
|
||||
:pygments-linenums-mode: table
|
||||
:pygments-style: vs
|
||||
:revdate: {date}
|
||||
:revnumber: v0.0.1
|
||||
:revremark: Under development
|
||||
:sectlinks:
|
||||
:sectnums!:
|
||||
:source-highlighter: pygments
|
||||
:toc-title: Table of Contents
|
||||
:toc: left
|
||||
:toclevels: 2
|
||||
:xrefstyle: short
|
||||
|
||||
include::introduction/index.adoc[]
|
||||
|
||||
[installing_php]
|
||||
== Other ways to install PHP
|
||||
|
||||
////
|
||||
apt, yum, pacman, etc. System package managers.
|
||||
Homebrew on macOS and Linux.
|
||||
Docker, podman, DDEV (containers).
|
||||
Valet/Herd?
|
||||
Symfony CLI.
|
||||
Is there an "official" way on php.net?
|
||||
////
|
||||
|
||||
[different_versions]
|
||||
== Different versions of PHP for different projects
|
||||
|
||||
////
|
||||
Virtual machines.
|
||||
Vagrant.
|
||||
Containers.
|
||||
Valet/Herd. Symfony CLI.
|
||||
IAC - Ansible, etc.
|
||||
nvm for PHP?
|
||||
"virtual" environments, aka. ruby, python.
|
||||
|
||||
Why do you need a full operating system?
|
||||
Why use something specific to a particular framework?
|
||||
////
|
||||
|
||||
[what_nix]
|
||||
== What is Nix?
|
||||
|
||||
[nix_language]
|
||||
=== The language
|
||||
|
||||
[nix_package_manager]
|
||||
=== The package manager
|
||||
|
||||
[nix_build_tool]
|
||||
=== The build tool
|
||||
|
||||
[nixos]
|
||||
=== The operating system (NixOS)
|
||||
|
||||
[nix_benefits]
|
||||
== What are the benefits of using Nix?
|
||||
|
||||
////
|
||||
Lightweight.
|
||||
Simpler - no need for Makefiles or helper scripts.
|
||||
More native feel.
|
||||
One tool to work with everything.
|
||||
Different languages and frameworks.
|
||||
Agnostic package manager, works on different Linux distros as well as macOS.
|
||||
Lots of available packages and operating system options.
|
||||
Ecosystem of tools - e.g. Home Manager.
|
||||
////
|
||||
|
||||
=== Reproducible software, not just repeatable
|
||||
|
||||
=== Imperative vs. declarative
|
||||
|
||||
[dev_shells]
|
||||
== What are dev shells?
|
||||
|
||||
[direnv]
|
||||
== dev shells and direnv
|
||||
|
||||
Using a local flake:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
use flake .
|
||||
----
|
||||
|
||||
=== Remote dev shells
|
||||
|
||||
Using a remote flake:
|
||||
|
||||
You can use a `flake.nix` flake in any Git repository, not just the directory you're in.
|
||||
|
||||
It can be in a different local directory or a remote Git repository.
|
||||
|
||||
For example, you can add this to use the `php84` dev shell within my dev-shells repository:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
use flake "git+https://code.oliverdavies.uk/opdavies/dev-shells#php84"
|
||||
----
|
||||
|
||||
This will install PHP 8.4, Composer and Phpactor without needing to create a bespoke `flake.nix`.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
If you're referencing a GitHub repository, you can use the shorter `github:username/repo` format instead of the full repository URL.
|
||||
====
|
||||
|
||||
[what_flakes]
|
||||
== What are Flakes?
|
||||
|
||||
[flake_templates]
|
||||
=== Flake templates
|
||||
|
||||
////
|
||||
flake-utils
|
||||
flake-parts
|
||||
////
|
||||
|
||||
[configuring_php]
|
||||
== Configuring PHP with Nix
|
||||
|
||||
[managing_services]
|
||||
== Managing services without NixOS
|
||||
|
||||
[building_derivations]
|
||||
== Building derivations of PHP applications
|
||||
|
||||
[nix_composer]
|
||||
== Nix vs. Composer
|
||||
|
||||
////
|
||||
composer2nix
|
||||
////
|
||||
|
||||
== Other usages for Nix
|
||||
|
||||
////
|
||||
Homelab/Server
|
||||
////
|
||||
|
||||
== Organising Nix configurations
|
Loading…
Add table
Add a link
Reference in a new issue