uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
112
nixos/tests/nextcloud/basic.nix
Normal file
112
nixos/tests/nextcloud/basic.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
args@{ pkgs, nextcloudVersion ? 22, ... }:
|
||||
|
||||
(import ../make-test-python.nix ({ pkgs, ...}: let
|
||||
adminpass = "notproduction";
|
||||
adminuser = "root";
|
||||
in {
|
||||
name = "nextcloud-basic";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ globin eqyiel ];
|
||||
};
|
||||
|
||||
nodes = rec {
|
||||
# The only thing the client needs to do is download a file.
|
||||
client = { ... }: {
|
||||
services.davfs2.enable = true;
|
||||
system.activationScripts.davfs2-secrets = ''
|
||||
echo "http://nextcloud/remote.php/webdav/ ${adminuser} ${adminpass}" > /tmp/davfs2-secrets
|
||||
chmod 600 /tmp/davfs2-secrets
|
||||
'';
|
||||
virtualisation.fileSystems = {
|
||||
"/mnt/dav" = {
|
||||
device = "http://nextcloud/remote.php/webdav/";
|
||||
fsType = "davfs";
|
||||
options = let
|
||||
davfs2Conf = (pkgs.writeText "davfs2.conf" "secrets /tmp/davfs2-secrets");
|
||||
in [ "conf=${davfs2Conf}" "x-systemd.automount" "noauto"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nextcloud = { config, pkgs, ... }: let
|
||||
cfg = config;
|
||||
in {
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/nextcloud-data 0750 nextcloud nginx - -"
|
||||
];
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
datadir = "/var/lib/nextcloud-data";
|
||||
hostName = "nextcloud";
|
||||
config = {
|
||||
# Don't inherit adminuser since "root" is supposed to be the default
|
||||
adminpassFile = "${pkgs.writeText "adminpass" adminpass}"; # Don't try this at home!
|
||||
dbtableprefix = "nixos_";
|
||||
};
|
||||
package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
|
||||
autoUpdateApps = {
|
||||
enable = true;
|
||||
startAt = "20:00";
|
||||
};
|
||||
phpExtraExtensions = all: [ all.bz2 ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.services.nextcloud.occ ];
|
||||
};
|
||||
|
||||
nextcloudWithoutMagick = args@{ config, pkgs, lib, ... }:
|
||||
lib.mkMerge
|
||||
[ (nextcloud args)
|
||||
{ services.nextcloud.enableImagemagick = false; } ];
|
||||
};
|
||||
|
||||
testScript = { nodes, ... }: let
|
||||
withRcloneEnv = pkgs.writeScript "with-rclone-env" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
export RCLONE_CONFIG_NEXTCLOUD_TYPE=webdav
|
||||
export RCLONE_CONFIG_NEXTCLOUD_URL="http://nextcloud/remote.php/webdav/"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_VENDOR="nextcloud"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_USER="${adminuser}"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_PASS="$(${pkgs.rclone}/bin/rclone obscure ${adminpass})"
|
||||
"''${@}"
|
||||
'';
|
||||
copySharedFile = pkgs.writeScript "copy-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
echo 'hi' | ${withRcloneEnv} ${pkgs.rclone}/bin/rclone rcat nextcloud:test-shared-file
|
||||
'';
|
||||
|
||||
diffSharedFile = pkgs.writeScript "diff-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
diff <(echo 'hi') <(${pkgs.rclone}/bin/rclone cat nextcloud:test-shared-file)
|
||||
'';
|
||||
|
||||
findInClosure = what: drv: pkgs.runCommand "find-in-closure" { exportReferencesGraph = [ "graph" drv ]; inherit what; } ''
|
||||
test -e graph
|
||||
grep "$what" graph >$out || true
|
||||
'';
|
||||
nextcloudUsesImagick = findInClosure "imagick" nodes.nextcloud.config.system.build.vm;
|
||||
nextcloudWithoutDoesntUseIt = findInClosure "imagick" nodes.nextcloudWithoutMagick.config.system.build.vm;
|
||||
in ''
|
||||
assert open("${nextcloudUsesImagick}").read() != ""
|
||||
assert open("${nextcloudWithoutDoesntUseIt}").read() == ""
|
||||
|
||||
nextcloud.start()
|
||||
client.start()
|
||||
nextcloud.wait_for_unit("multi-user.target")
|
||||
# This is just to ensure the nextcloud-occ program is working
|
||||
nextcloud.succeed("nextcloud-occ status")
|
||||
nextcloud.succeed("curl -sSf http://nextcloud/login")
|
||||
nextcloud.succeed(
|
||||
"${withRcloneEnv} ${copySharedFile}"
|
||||
)
|
||||
client.wait_for_unit("multi-user.target")
|
||||
nextcloud.succeed("test -f /var/lib/nextcloud-data/data/root/files/test-shared-file")
|
||||
client.succeed(
|
||||
"${withRcloneEnv} ${diffSharedFile}"
|
||||
)
|
||||
assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
|
||||
'';
|
||||
})) args
|
||||
21
nixos/tests/nextcloud/default.nix
Normal file
21
nixos/tests/nextcloud/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, config ? { }
|
||||
, pkgs ? import ../../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
foldl
|
||||
(matrix: ver: matrix // {
|
||||
"basic${toString ver}" = import ./basic.nix { inherit system pkgs; nextcloudVersion = ver; };
|
||||
"with-postgresql-and-redis${toString ver}" = import ./with-postgresql-and-redis.nix {
|
||||
inherit system pkgs;
|
||||
nextcloudVersion = ver;
|
||||
};
|
||||
"with-mysql-and-memcached${toString ver}" = import ./with-mysql-and-memcached.nix {
|
||||
inherit system pkgs;
|
||||
nextcloudVersion = ver;
|
||||
};
|
||||
})
|
||||
{ }
|
||||
[ 23 24 ]
|
||||
89
nixos/tests/nextcloud/with-mysql-and-memcached.nix
Normal file
89
nixos/tests/nextcloud/with-mysql-and-memcached.nix
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
args@{ pkgs, nextcloudVersion ? 22, ... }:
|
||||
|
||||
(import ../make-test-python.nix ({ pkgs, ...}: let
|
||||
adminpass = "hunter2";
|
||||
adminuser = "root";
|
||||
in {
|
||||
name = "nextcloud-with-mysql-and-memcached";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ eqyiel ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
# The only thing the client needs to do is download a file.
|
||||
client = { ... }: {};
|
||||
|
||||
nextcloud = { config, pkgs, ... }: {
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
hostName = "nextcloud";
|
||||
https = true;
|
||||
package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
|
||||
caching = {
|
||||
apcu = true;
|
||||
redis = false;
|
||||
memcached = true;
|
||||
};
|
||||
database.createLocally = true;
|
||||
config = {
|
||||
dbtype = "mysql";
|
||||
dbname = "nextcloud";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "127.0.0.1";
|
||||
dbport = 3306;
|
||||
dbpassFile = "${pkgs.writeText "dbpass" "hunter2" }";
|
||||
# Don't inherit adminuser since "root" is supposed to be the default
|
||||
adminpassFile = "${pkgs.writeText "adminpass" adminpass}"; # Don't try this at home!
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.nextcloud-setup= {
|
||||
requires = ["mysql.service"];
|
||||
after = ["mysql.service"];
|
||||
};
|
||||
|
||||
services.memcached.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = let
|
||||
configureMemcached = pkgs.writeScript "configure-memcached" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
nextcloud-occ config:system:set memcached_servers 0 0 --value 127.0.0.1 --type string
|
||||
nextcloud-occ config:system:set memcached_servers 0 1 --value 11211 --type integer
|
||||
nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\APCu' --type string
|
||||
nextcloud-occ config:system:set memcache.distributed --value '\OC\Memcache\Memcached' --type string
|
||||
'';
|
||||
withRcloneEnv = pkgs.writeScript "with-rclone-env" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
export RCLONE_CONFIG_NEXTCLOUD_TYPE=webdav
|
||||
export RCLONE_CONFIG_NEXTCLOUD_URL="http://nextcloud/remote.php/webdav/"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_VENDOR="nextcloud"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_USER="${adminuser}"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_PASS="$(${pkgs.rclone}/bin/rclone obscure ${adminpass})"
|
||||
'';
|
||||
copySharedFile = pkgs.writeScript "copy-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
echo 'hi' | ${pkgs.rclone}/bin/rclone rcat nextcloud:test-shared-file
|
||||
'';
|
||||
|
||||
diffSharedFile = pkgs.writeScript "diff-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
diff <(echo 'hi') <(${pkgs.rclone}/bin/rclone cat nextcloud:test-shared-file)
|
||||
'';
|
||||
in ''
|
||||
start_all()
|
||||
nextcloud.wait_for_unit("multi-user.target")
|
||||
nextcloud.succeed("${configureMemcached}")
|
||||
nextcloud.succeed("curl -sSf http://nextcloud/login")
|
||||
nextcloud.succeed(
|
||||
"${withRcloneEnv} ${copySharedFile}"
|
||||
)
|
||||
client.wait_for_unit("multi-user.target")
|
||||
client.succeed(
|
||||
"${withRcloneEnv} ${diffSharedFile}"
|
||||
)
|
||||
'';
|
||||
})) args
|
||||
102
nixos/tests/nextcloud/with-postgresql-and-redis.nix
Normal file
102
nixos/tests/nextcloud/with-postgresql-and-redis.nix
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
args@{ pkgs, nextcloudVersion ? 22, ... }:
|
||||
|
||||
(import ../make-test-python.nix ({ pkgs, ...}: let
|
||||
adminpass = "hunter2";
|
||||
adminuser = "custom-admin-username";
|
||||
in {
|
||||
name = "nextcloud-with-postgresql-and-redis";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ eqyiel ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
# The only thing the client needs to do is download a file.
|
||||
client = { ... }: {};
|
||||
|
||||
nextcloud = { config, pkgs, ... }: {
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
hostName = "nextcloud";
|
||||
package = pkgs.${"nextcloud" + (toString nextcloudVersion)};
|
||||
caching = {
|
||||
apcu = false;
|
||||
redis = true;
|
||||
memcached = false;
|
||||
};
|
||||
config = {
|
||||
dbtype = "pgsql";
|
||||
dbname = "nextcloud";
|
||||
dbuser = "nextcloud";
|
||||
dbhost = "/run/postgresql";
|
||||
inherit adminuser;
|
||||
adminpassFile = toString (pkgs.writeText "admin-pass-file" ''
|
||||
${adminpass}
|
||||
'');
|
||||
};
|
||||
};
|
||||
|
||||
services.redis = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
systemd.services.nextcloud-setup= {
|
||||
requires = ["postgresql.service"];
|
||||
after = [
|
||||
"postgresql.service"
|
||||
];
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "nextcloud" ];
|
||||
ensureUsers = [
|
||||
{ name = "nextcloud";
|
||||
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = let
|
||||
configureRedis = pkgs.writeScript "configure-redis" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
nextcloud-occ config:system:set redis 'host' --value 'localhost' --type string
|
||||
nextcloud-occ config:system:set redis 'port' --value 6379 --type integer
|
||||
nextcloud-occ config:system:set memcache.local --value '\OC\Memcache\Redis' --type string
|
||||
nextcloud-occ config:system:set memcache.locking --value '\OC\Memcache\Redis' --type string
|
||||
'';
|
||||
withRcloneEnv = pkgs.writeScript "with-rclone-env" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
export RCLONE_CONFIG_NEXTCLOUD_TYPE=webdav
|
||||
export RCLONE_CONFIG_NEXTCLOUD_URL="http://nextcloud/remote.php/webdav/"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_VENDOR="nextcloud"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_USER="${adminuser}"
|
||||
export RCLONE_CONFIG_NEXTCLOUD_PASS="$(${pkgs.rclone}/bin/rclone obscure ${adminpass})"
|
||||
"''${@}"
|
||||
'';
|
||||
copySharedFile = pkgs.writeScript "copy-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
echo 'hi' | ${pkgs.rclone}/bin/rclone rcat nextcloud:test-shared-file
|
||||
'';
|
||||
|
||||
diffSharedFile = pkgs.writeScript "diff-shared-file" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
diff <(echo 'hi') <(${pkgs.rclone}/bin/rclone cat nextcloud:test-shared-file)
|
||||
'';
|
||||
in ''
|
||||
start_all()
|
||||
nextcloud.wait_for_unit("multi-user.target")
|
||||
nextcloud.succeed("${configureRedis}")
|
||||
nextcloud.succeed("curl -sSf http://nextcloud/login")
|
||||
nextcloud.succeed(
|
||||
"${withRcloneEnv} ${copySharedFile}"
|
||||
)
|
||||
client.wait_for_unit("multi-user.target")
|
||||
client.succeed(
|
||||
"${withRcloneEnv} ${diffSharedFile}"
|
||||
)
|
||||
'';
|
||||
})) args
|
||||
Loading…
Add table
Add a link
Reference in a new issue