Skip to content

Commit f555744

Browse files
committed
grav: init at 1.7.48
1 parent f2f268e commit f555744

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

pkgs/by-name/gr/grav/01-nix.patch

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff -Nurp grav-src/system/src/Grav/Common/Cache.php grav-src-nixos/system/src/Grav/Common/Cache.php
2+
--- grav-src/system/src/Grav/Common/Cache.php 1970-01-01 01:00:01.000000000 +0100
3+
+++ grav-src-nixos/system/src/Grav/Common/Cache.php 2024-11-22 15:46:47.481175690 +0100
4+
@@ -517,7 +517,7 @@ class Cache extends Getters
5+
6+
$output[] = '';
7+
8+
- if (($remove === 'all' || $remove === 'standard') && file_exists($user_config)) {
9+
+ if (($remove === 'all' || $remove === 'standard') && file_exists($user_config) && is_writable($user_config)) {
10+
touch($user_config);
11+
12+
$output[] = '<red>Touched: </red>' . $user_config;
13+
@@ -544,7 +544,7 @@ class Cache extends Getters
14+
{
15+
$user_config = USER_DIR . 'config/system.yaml';
16+
17+
- if (file_exists($user_config)) {
18+
+ if (file_exists($user_config) && is_writable($user_config)) {
19+
touch($user_config);
20+
}
21+
22+
diff -Nurp grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php
23+
--- grav-src/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 1970-01-01 01:00:01.000000000 +0100
24+
+++ grav-src-nixos/system/src/Grav/Console/Gpm/SelfupgradeCommand.php 2024-11-22 16:05:13.752536788 +0100
25+
@@ -94,6 +94,11 @@ class SelfupgradeCommand extends GpmComm
26+
$input = $this->getInput();
27+
$io = $this->getIO();
28+
29+
+ # Adopted from Arch package.
30+
+ $io->error('Grav cannot be upgraded this way as it has been installed with a distribution package.');
31+
+ $io->writeln('Use Nix to upgrade.');
32+
+ return 1;
33+
+
34+
if (!class_exists(ZipArchive::class)) {
35+
$io->title('GPM Self Upgrade');
36+
$io->error('php-zip extension needs to be enabled!');

pkgs/by-name/gr/grav/package.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
stdenvNoCC,
3+
lib,
4+
fetchzip,
5+
}:
6+
7+
let
8+
version = "1.7.48";
9+
in
10+
stdenvNoCC.mkDerivation {
11+
pname = "grav";
12+
inherit version;
13+
14+
src = fetchzip {
15+
url = "https://github.com/getgrav/grav/releases/download/${version}/grav-admin-v${version}.zip";
16+
hash = "sha256-e8WpdO0n3pY4Ajs1fvMkMI+CrR6uMitswvYS5rxal4g=";
17+
};
18+
19+
patches = [
20+
# Disables functionality that attempts to edit files in Nix store. Also adds
21+
# a block of the self-upgrade command.
22+
./01-nix.patch
23+
];
24+
25+
installPhase = ''
26+
runHook preInstall
27+
mkdir -p $out/
28+
cp -R . $out/
29+
runHook postInstall
30+
'';
31+
32+
meta = with lib; {
33+
description = "Fast, simple, and flexible, file-based web platform";
34+
homepage = "https://getgrav.com";
35+
maintainers = with maintainers; [ rycee ];
36+
license = licenses.mit;
37+
};
38+
}

0 commit comments

Comments
 (0)