enhance nextcloud user creation
This commit is contained in:
parent
2d26a70252
commit
bd15bb380a
5 changed files with 202 additions and 71 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -1 +1,12 @@
|
|||
nixos.qcow2
|
||||
|
||||
# Devenv
|
||||
.devenv*
|
||||
devenv.local.nix
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
# pre-commit
|
||||
.pre-commit-config.yaml
|
||||
|
||||
|
|
|
|||
2
calendar
2
calendar
|
|
@ -1 +1 @@
|
|||
Subproject commit afb60be7d579fdaab9fac66a1228f7c16ea74a0e
|
||||
Subproject commit a5d19d4fae91e53f22ef18be3f89104daa368dae
|
||||
2
circles
2
circles
|
|
@ -1 +1 @@
|
|||
Subproject commit e76bb81c384eecab6b36e66c277c1e835002ec54
|
||||
Subproject commit ce6de436885daaa510959a6d15d90445e65fc016
|
||||
156
devenv.lock
Normal file
156
devenv.lock
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devenv": {
|
||||
"locked": {
|
||||
"dir": "src/modules",
|
||||
"lastModified": 1690391043,
|
||||
"narHash": "sha256-8x5DkOaejES6C2JYX2A3riebbJHGFHBmJ+LwxXUIIVw=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "05240861ef3ae1bbe65b1acc88e2fad7dd24a84b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "src/modules",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1690327932,
|
||||
"narHash": "sha256-Fv7PYZxN4eo0K6zXhHG/vOc+e2iuqQ5ywDrh0yeRjP0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a9b47d85504bdd199e90846622c76aa0bfeabfac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689668210,
|
||||
"narHash": "sha256-XAATwDkaUxH958yXLs1lcEOmU6pSEIkatY3qjqk8X0E=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "eb433bff05b285258be76513add6f6c57b441775",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@
|
|||
cp -R . $out/
|
||||
rm -r $out/apps/firstrunwizard
|
||||
rm -r $out/apps/password_policy
|
||||
rm -r $out/apps/circles
|
||||
'';
|
||||
dontBuild = true;
|
||||
});
|
||||
|
|
@ -43,13 +42,24 @@
|
|||
package = pkgs.nextcloud27;
|
||||
hostName = "localhost";
|
||||
extraApps = with config.services.nextcloud.package.packages.apps; {
|
||||
inherit calendar contacts;
|
||||
inherit contacts;
|
||||
#inherit calendarM
|
||||
};
|
||||
extraAppsEnable = true;
|
||||
config = {
|
||||
adminuser = "admin";
|
||||
adminpassFile = "${pkgs.writeText "adminpass" "test123"}";
|
||||
};
|
||||
ensureUsers = {
|
||||
user1 = {
|
||||
email = "user1@localhost";
|
||||
passwordFile = "${pkgs.writeText "password" "test123"}";
|
||||
};
|
||||
user2 = {
|
||||
email = "user2@localhost";
|
||||
passwordFile = "${pkgs.writeText "password" "test123"}";
|
||||
};
|
||||
};
|
||||
phpPackage = lib.mkForce (pkgs.php.buildEnv {
|
||||
extensions = ({ enabled, all }: enabled ++ (with all; [
|
||||
xdebug
|
||||
|
|
@ -62,32 +72,12 @@
|
|||
"xdebug.start_with_request" = "yes";
|
||||
"xdebug.idekey" = "ECLIPSE";
|
||||
};
|
||||
appstoreEnable = false;
|
||||
appstoreEnable = true;
|
||||
configureRedis = true;
|
||||
caching.apcu = false;
|
||||
extraOptions = {
|
||||
mail_smtpmode = "sendmail";
|
||||
mail_sendmailmode = "pipe";
|
||||
log_type = "syslog";
|
||||
syslog_tag = "Nextcloud";
|
||||
loglevel = 0;
|
||||
trusted_domains = [ "10.100.100.1" ];
|
||||
phpOptions = {
|
||||
short_open_tag = "Off";
|
||||
expose_php = "Off";
|
||||
error_reporting = "E_ALL & ~E_DEPRECATED & ~E_STRICT";
|
||||
display_errors = "stderr";
|
||||
"opcache.enable_cli" = "1";
|
||||
"opcache.enable" = "1";
|
||||
"opcache.interned_strings_buffer" = "12";
|
||||
"opcache.max_accelerated_files" = "10000";
|
||||
"opcache.memory_consumption" = "128";
|
||||
"opcache.save_comments" = "1";
|
||||
"opcache.revalidate_freq" = "1";
|
||||
"opcache.fast_shutdown" = "1";
|
||||
"openssl.cafile" = "/etc/ssl/certs/ca-certificates.crt";
|
||||
catch_workers_output = "yes";
|
||||
};
|
||||
apps_paths = [
|
||||
{
|
||||
path = "/var/lib/nextcloud/nix-apps";
|
||||
|
|
@ -99,35 +89,25 @@
|
|||
url = "/apps";
|
||||
writable = false;
|
||||
}
|
||||
{
|
||||
path = "/var/lib/nextcloud/dev-apps";
|
||||
url = "/dev-apps";
|
||||
writable = false;
|
||||
}
|
||||
#{
|
||||
# path = "/var/lib/nextcloud/dev-apps";
|
||||
# url = "/dev-apps";
|
||||
# writable = false;
|
||||
#}
|
||||
];
|
||||
};
|
||||
};
|
||||
# Mount our local development repositories into the VM
|
||||
nixos-shell.mounts.extraMounts = {
|
||||
"/var/lib/nextcloud/dev-apps/circles" = {
|
||||
target = ./circles;
|
||||
"/var/lib/nextcloud/store-apps/calendar" = {
|
||||
target = ./calendar;
|
||||
cache = "none";
|
||||
};
|
||||
#"/var/lib/nextcloud/server" = {
|
||||
# target = ./server;
|
||||
# cache = "none";
|
||||
#};
|
||||
};
|
||||
# #"/var/lib/nextcloud/server" = {
|
||||
# # target = ./server;
|
||||
# # cache = "none";
|
||||
# #};
|
||||
#};
|
||||
#};
|
||||
# "/var/lib/nextcloud/server/apps/calendar" = {
|
||||
# target = ./calendar;
|
||||
# cache = "none";
|
||||
# };
|
||||
# "/var/lib/nextcloud/server/apps/activity" = {
|
||||
# target = ./activity;
|
||||
# cache = "none";
|
||||
# };
|
||||
# "/var/lib/nextcloud/server/3rdparty/sabre/dav" = {
|
||||
# target = ./dav;
|
||||
# cache = "none";
|
||||
|
|
@ -175,28 +155,12 @@
|
|||
};
|
||||
};
|
||||
|
||||
# Creating Nextcloud users and configure mail adresses
|
||||
systemd.services.nextcloud-add-user = {
|
||||
script = ''
|
||||
export OC_PASS="test123"
|
||||
${config.services.nextcloud.occ}/bin/nextcloud-occ user:add --password-from-env user1
|
||||
${config.services.nextcloud.occ}/bin/nextcloud-occ user:setting user1 settings email "user1@localhost"
|
||||
${config.services.nextcloud.occ}/bin/nextcloud-occ user:add --password-from-env user2
|
||||
${config.services.nextcloud.occ}/bin/nextcloud-occ user:setting user2 settings email "user2@localhost"
|
||||
${config.services.nextcloud.occ}/bin/nextcloud-occ user:setting admin settings email "admin@localhost"
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User= "nextcloud";
|
||||
};
|
||||
after = [ "nextcloud-setup.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
system.stateVersion = "23.05";
|
||||
|
||||
documentation.info.enable = false;
|
||||
documentation.man.enable = false;
|
||||
documentation.nixos.enable = false;
|
||||
documentation = {
|
||||
info.enable = false;
|
||||
man.enable = false;
|
||||
nixos.enable = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue