diff options
author | provokateurin <kate@provokateurin.de> | 2025-05-16 09:03:25 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2025-05-16 11:20:42 +0200 |
commit | 6f47aac8b5c5a94f8a55b793aa468740708580be (patch) | |
tree | 47445384253f33b205149b1b187cde70bf5f5f0c | |
parent | 4b62b5785e2c4c88a85c8bd337de99ef46c44bd5 (diff) | |
download | nextcloud-server-chore/nix-flake.tar.gz nextcloud-server-chore/nix-flake.zip |
chore: Add nix flake with development shellchore/nix-flake
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r-- | .envrc | 1 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .reuse/dep5 | 2 | ||||
-rw-r--r-- | build/files-checker.php | 3 | ||||
-rw-r--r-- | flake.lock | 61 | ||||
-rw-r--r-- | flake.nix | 88 |
6 files changed, 156 insertions, 1 deletions
diff --git a/.envrc b/.envrc new file mode 100644 index 00000000000..3550a30f2de --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index a55b5c4602b..dfad450a778 100644 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,5 @@ core/js/mimetypelist.js cypress/downloads cypress/snapshots cypress/videos + +/.direnv diff --git a/.reuse/dep5 b/.reuse/dep5 index 486c713f6aa..4abe782fb68 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -351,6 +351,6 @@ Files: apps/theming/fonts/OpenDyslexic-Bold.otf apps/theming/fonts/OpenDyslexic- Copyright: 2012-2019 Abbie Gonzalez <https://abbiecod.es|support@abbiecod.es>, with Reserved Font Name OpenDyslexic. License: OFL-1.1-RFN -Files: openapi.json +Files: openapi.json .envrc flake.nix flake.lock Copyright: 2025 Nextcloud GmbH and Nextcloud contributors License: AGPL-3.0-or-later diff --git a/build/files-checker.php b/build/files-checker.php index 4cbd0874247..4dfc7267e23 100644 --- a/build/files-checker.php +++ b/build/files-checker.php @@ -11,6 +11,7 @@ $expectedFiles = [ '..', '.devcontainer', '.editorconfig', + '.envrc', '.eslintignore', '.eslintrc.js', '.git', @@ -61,6 +62,8 @@ $expectedFiles = [ 'cypress.d.ts', 'cypress', 'dist', + 'flake.lock', + 'flake.nix', 'index.html', 'index.php', 'lib', diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..bef1c5d3b59 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "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" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747209494, + "narHash": "sha256-fLise+ys+bpyjuUUkbwqo5W/UyIELvRz9lPBPoB0fbM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5d736263df906c5da72ab0f372427814de2f52f8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000000..87b575bd87a --- /dev/null +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + lib = pkgs.lib; + in + { + devShells.default = + let + php_version = lib.strings.concatStrings (builtins.match ".*PHP_VERSION_ID < ([0-9])0([0-9])00.*" (builtins.readFile ./lib/versioncheck.php)); + php = pkgs.pkgs."php${php_version}".buildEnv { + # Based off https://docs.nextcloud.com/server/latest/admin_manual/installation/php_configuration.html + extensions = ({ enabled, all }: enabled ++ (with all; [ + # Required + ctype + curl + dom + fileinfo + filter + gd + mbstring + openssl + posix + session + simplexml + xmlreader + xmlwriter + zip + zlib + # Database connectors + pdo_sqlite + pdo_mysql + pdo_pgsql + # Recommended + intl + sodium + # Required for specific apps + ldap + smbclient + ftp + imap + # Recommended for specific apps (optional) + gmp + exif + # For enhanced server performance (optional) + apcu + memcached + redis + # For preview generation (optional) + imagick + # For command line processing (optional) + pcntl + + # Debugging + xdebug + ])); + + extraConfig = '' + max_execution_time=300 + memory_limit=-1 + + xdebug.mode=debug + ''; + }; + node_version = builtins.substring 1 (-1) (builtins.elemAt (lib.strings.splitString "." (builtins.fromJSON (builtins.readFile ./package.json)).engines.node) 0); + node = pkgs."nodejs_${node_version}"; + in + pkgs.mkShell { + NOCOVERAGE = 1; + + packages = [ + php + php.packages.composer + node + # Preview generation + pkgs.ffmpeg + pkgs.libreoffice + ]; + }; + } + ); +} |