summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2024/PHP/.envrc2
-rw-r--r--2024/PHP/flake.lock27
-rw-r--r--2024/PHP/flake.nix43
-rw-r--r--2024/PHP/shell.nix31
4 files changed, 71 insertions, 32 deletions
diff --git a/2024/PHP/.envrc b/2024/PHP/.envrc
index 0a722d7..cffc922 100644
--- a/2024/PHP/.envrc
+++ b/2024/PHP/.envrc
@@ -1 +1 @@
-use nix;
+use flake . --impure
diff --git a/2024/PHP/flake.lock b/2024/PHP/flake.lock
new file mode 100644
index 0000000..b7695d9
--- /dev/null
+++ b/2024/PHP/flake.lock
@@ -0,0 +1,27 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1741010256,
+ "narHash": "sha256-WZNlK/KX7Sni0RyqLSqLPbK8k08Kq7H7RijPJbq9KHM=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "ba487dbc9d04e0634c64e3b1f0d25839a0a68246",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/2024/PHP/flake.nix b/2024/PHP/flake.nix
new file mode 100644
index 0000000..2be5644
--- /dev/null
+++ b/2024/PHP/flake.nix
@@ -0,0 +1,43 @@
+{
+ description = "Advent of Code 2024: PHP";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
+ };
+
+ outputs =
+ { nixpkgs, ... }:
+ let
+ pkgs = import nixpkgs {
+ config.allowUnfree = true;
+ };
+ in
+ {
+ devShells.x86_64-linux.default =
+ let
+ phpVersion = "php84";
+
+ phpPackage = pkgs.lib.attrByPath [ phpVersion ] null pkgs;
+ phpPackages = pkgs.lib.attrByPath [ "${phpVersion}Packages" ] null pkgs;
+ phpExtensions = pkgs.lib.attrByPath [ "${phpVersion}Extensions" ] null pkgs;
+ in
+ pkgs.mkShell {
+ # build tools
+ nativeBuildInputs = with pkgs; [
+ phpPackage
+ nodejs_18
+ ];
+ # dependencies
+ buildInputs = with pkgs; [
+ intelephense
+ phpunit
+ phpPackages.php-cs-fixer
+ phpPackages.phpstan
+ phpExtensions.xdebug
+
+ gh # GitHub CLI
+ ];
+ };
+
+ };
+}
diff --git a/2024/PHP/shell.nix b/2024/PHP/shell.nix
deleted file mode 100644
index 8b25fa1..0000000
--- a/2024/PHP/shell.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ }:
-
-let
- config = {
- allowUnfree = true;
- };
- pkgs = import <nixpkgs> { inherit config; };
-
- phpVersion = "php84";
-
- phpPackage = pkgs.lib.attrByPath [ phpVersion ] null pkgs;
- phpPackages = pkgs.lib.attrByPath [ "${phpVersion}Packages" ] null pkgs;
- phpExtensions = pkgs.lib.attrByPath [ "${phpVersion}Extensions" ] null pkgs;
-in
-pkgs.mkShell {
- # build tools
- nativeBuildInputs = with pkgs; [
- phpPackage
- nodejs_18
- ];
- # dependencies
- buildInputs = with pkgs; [
- intelephense
- phpunit
- phpPackages.php-cs-fixer
- phpPackages.phpstan
- phpExtensions.xdebug
-
- gh # GitHub CLI
- ];
-}