From 10fdec076840682480bbfb541e31d6258e0da638 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Sat, 18 Jan 2025 22:32:36 +0100 Subject: [PATCH] work --- flake.lock | 88 ++++++++++++++++++- flake.nix | 1 + hosts/headful/work/envfs.nix | 3 + hosts/headful/work/php.nix | 56 ++++++++++++ .../work/{distrobox.nix => phpstorm.nix} | 2 +- 5 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 hosts/headful/work/envfs.nix create mode 100644 hosts/headful/work/php.nix rename hosts/headful/work/{distrobox.nix => phpstorm.nix} (66%) diff --git a/flake.lock b/flake.lock index da97c25..cbb4bac 100644 --- a/flake.lock +++ b/flake.lock @@ -121,6 +121,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -388,6 +404,42 @@ "type": "github" } }, + "nixpkgs_6": { + "locked": { + "lastModified": 1734435836, + "narHash": "sha256-kMBQ5PRiFLagltK0sH+08aiNt3zGERC2297iB6vrvlU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4989a246d7a390a859852baddb1013f825435cee", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "phps": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": "nixpkgs_6", + "utils": "utils" + }, + "locked": { + "lastModified": 1734905622, + "narHash": "sha256-3BwuhHKjfpTg/VnH0+uao3DqUmI1mowbLt3f+ysBwQM=", + "owner": "fossar", + "repo": "nix-phps", + "rev": "323d9eb87385473078ebdeef8873530c4f7dbbd7", + "type": "github" + }, + "original": { + "owner": "fossar", + "repo": "nix-phps", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -395,7 +447,8 @@ "devenv-root": "devenv-root", "flake-parts": "flake-parts_2", "hardware": "hardware", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_5", + "phps": "phps" } }, "systems": { @@ -412,6 +465,39 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 381ee7b..b31cfc3 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,7 @@ flake = false; }; devenv.url = "github:cachix/devenv"; + phps.url = "github:fossar/nix-phps"; }; outputs = { diff --git a/hosts/headful/work/envfs.nix b/hosts/headful/work/envfs.nix new file mode 100644 index 0000000..2a2382e --- /dev/null +++ b/hosts/headful/work/envfs.nix @@ -0,0 +1,3 @@ +{ + services.envfs.enable = true; +} diff --git a/hosts/headful/work/php.nix b/hosts/headful/work/php.nix new file mode 100644 index 0000000..b90581b --- /dev/null +++ b/hosts/headful/work/php.nix @@ -0,0 +1,56 @@ +{ + inputs, + pkgs, + ... +}: let + supportedPhps = [ + "php72" + "php73" + "php74" + "php80" + "php81" + "php82" + "php83" + "php84" + ]; +in { + nix.settings = { + substituters = ["https://fossar.cachix.org/"]; + trusted-public-keys = ["fossar.cachix.org-1:Zv6FuqIboeHPWQS7ysLCJ7UT7xExb4OE8c4LyGb5AsE="]; + }; + + environment.systemPackages = + map ( + phpName: + pkgs.writeShellApplication { + name = "with-${phpName}"; + runtimeInputs = let + php = inputs.phps.packages.${pkgs.system}.${phpName}.buildEnv { + extensions = { + enabled, + all, + }: + enabled ++ [all.xdebug all.amqp]; + extraConfig = '' + display_errors = On + error_reporting = E_ALL + + memory_limit = -1 + + xdebug.mode = develop,coverage,gcstats,profile,debug,trace + xdebug.discover_client_host = 1 + xdebug.client_host = localhost + ''; + }; + in [ + php + php.packages.composer + pkgs.symfony-cli + ]; + text = '' + exec "$@" + ''; + } + ) + supportedPhps; +} diff --git a/hosts/headful/work/distrobox.nix b/hosts/headful/work/phpstorm.nix similarity index 66% rename from hosts/headful/work/distrobox.nix rename to hosts/headful/work/phpstorm.nix index 5b6e13b..0796603 100644 --- a/hosts/headful/work/distrobox.nix +++ b/hosts/headful/work/phpstorm.nix @@ -1,5 +1,5 @@ {pkgs, ...}: { environment.systemPackages = [ - pkgs.distrobox + pkgs.jetbrains.phpstorm ]; }