update nextcloud module, cleanup
This commit is contained in:
parent
982b8f7d7c
commit
bc7778e46c
4 changed files with 136 additions and 109 deletions
60
flake.lock
generated
60
flake.lock
generated
|
|
@ -1,57 +1,57 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"nixos-shell": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1698737528,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-65qiCQPFGCpdjcfQrO1EZKe+LFD0tzmlecFOACNwMbY=",
|
||||||
"owner": "numtide",
|
"owner": "Mic92",
|
||||||
"repo": "flake-utils",
|
"repo": "nixos-shell",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "8a835e240adc32e68d6fc7ca5aaf3f597de08d5f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "Mic92",
|
||||||
"repo": "flake-utils",
|
"repo": "nixos-shell",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701282334,
|
"lastModified": 1628465643,
|
||||||
"narHash": "sha256-MxCVrXY6v4QmfTwIysjjaX0XUhqBbxTWWB4HXtDYsdk=",
|
"narHash": "sha256-QSNw9bDq9uGUniQQtakRuw4m21Jxugm23SXLVgEV4DM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "057f9aecfb71c4437d2b27d3323df7f93c010b7e",
|
"rev": "6ef4f522d63f22b40004319778761040d3197390",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
"ref": "23.11",
|
"ref": "nixos-unstable",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1705916986,
|
||||||
|
"narHash": "sha256-iBpfltu6QvN4xMpen6jGGEb6jOqmmVQKUrXdOJ32u8w=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d7f206b723e42edb09d9d753020a84b3061a79d8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-23.11",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"nixos-shell": "nixos-shell",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
42
flake.nix
42
flake.nix
|
|
@ -1,33 +1,43 @@
|
||||||
{
|
{
|
||||||
|
description = "Spawns lightweight nixos vm in a shell";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# FIXME
|
nixpkgs.url = "nixpkgs/nixos-23.11";
|
||||||
#nixpkgs.url = "nixpkgs/23.11";
|
nixos-shell.url = "github:Mic92/nixos-shell";
|
||||||
nixpkgs.url = "github:onny/nixpkgs/nextcloud-update2";
|
|
||||||
# Required for multi platform support
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
outputs = { self, nixpkgs, nixos-shell }: let
|
||||||
let
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
start =
|
start =
|
||||||
pkgs.writeShellScriptBin "start" ''
|
pkgs.writeShellScriptBin "start" ''
|
||||||
set -e
|
set -e
|
||||||
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80,hostfwd=tcp::1433-:143,hostfwd=tcp::5877-:587"
|
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80,hostfwd=tcp::1433-:143,hostfwd=tcp::5877-:587"
|
||||||
${pkgs.nixos-shell}/bin/nixos-shell vm-nextcloud.nix
|
${pkgs.nixos-shell}/bin/nixos-shell --flake .
|
||||||
'';
|
'';
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
devShell = pkgs.mkShell {
|
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
|
||||||
packages = with pkgs; [
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
(import ./vm-nextcloud.nix)
|
||||||
|
nixos-shell.nixosModules.nixos-shell
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.x86_64-linux = {
|
||||||
|
default = with pkgs; mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
php82Packages.composer
|
php82Packages.composer
|
||||||
phpunit
|
phpunit
|
||||||
nodejs
|
nodejs
|
||||||
nodePackages.rollup
|
nodePackages.rollup
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
packages = { inherit start; };
|
packages = { inherit start; };
|
||||||
defaultPackage = start;
|
defaultPackage.x86_64-linux = start;
|
||||||
});
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
62
nixos-shell.nix
Normal file
62
nixos-shell.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
{ lib, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
"${toString modulesPath}/virtualisation/qemu-vm.nix"
|
||||||
|
];
|
||||||
|
|
||||||
|
options.nixos-shell = with lib; {
|
||||||
|
mounts = let
|
||||||
|
cache = mkOption {
|
||||||
|
type = types.enum ["none" "loose" "fscache" "mmap"];
|
||||||
|
default = "loose"; # bad idea? Well, at least it is fast!1!!
|
||||||
|
description = "9p caching policy";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
mountHome = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Whether to mount `/home`.";
|
||||||
|
};
|
||||||
|
|
||||||
|
mountNixProfile = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Whether to mount the user's nix profile.";
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit cache;
|
||||||
|
|
||||||
|
extraMounts = mkOption {
|
||||||
|
type = types.attrsOf (types.coercedTo
|
||||||
|
types.path (target: {
|
||||||
|
inherit target;
|
||||||
|
})
|
||||||
|
(types.submodule ({ config, ... }: {
|
||||||
|
options = {
|
||||||
|
target = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
description = lib.mdDoc "Target on the guest.";
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit cache;
|
||||||
|
|
||||||
|
tag = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.tag = lib.mkDefault (
|
||||||
|
builtins.substring 0 31 ( # tags must be shorter than 32 bytes
|
||||||
|
"a" + # tags must not begin with a digit
|
||||||
|
builtins.hashString "md5" config._module.args.name
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -95,61 +95,16 @@
|
||||||
trusted_domains = [ "10.100.100.1" ];
|
trusted_domains = [ "10.100.100.1" ];
|
||||||
"integrity.check.disabled" = true;
|
"integrity.check.disabled" = true;
|
||||||
debug = true;
|
debug = true;
|
||||||
apps_paths = [
|
|
||||||
{
|
|
||||||
path = "/var/lib/nextcloud/nix-apps";
|
|
||||||
url = "/nix-apps";
|
|
||||||
writable = false;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
path = "/var/lib/nextcloud/apps";
|
|
||||||
url = "/apps";
|
|
||||||
writable = false;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
path = "/var/lib/nextcloud/store-apps";
|
|
||||||
url = "/store-apps";
|
|
||||||
writable = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-shell.mounts.extraMounts = {
|
nixos-shell.mounts.extraMounts = {
|
||||||
"/var/lib/nextcloud/cleanup" = {
|
"/var/lib/nextcloud/store-apps/cleanup" = {
|
||||||
target = ./cleanup;
|
target = /home/onny/projects/nixos-nextcloud-testumgebung/cleanup;
|
||||||
cache = "none";
|
cache = "none";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.mounts = [
|
|
||||||
{
|
|
||||||
what = "/var/lib/nextcloud/cleanup";
|
|
||||||
where = "/var/lib/nextcloud/store-apps/cleanup";
|
|
||||||
type = "fuse.bindfs";
|
|
||||||
options = "uid=997,gid=997";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
enable = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services."prepare-bindfs-mount" = {
|
|
||||||
script = ''
|
|
||||||
set -eu
|
|
||||||
${pkgs.coreutils}/bin/mkdir -p /var/lib/nextcloud/store-apps
|
|
||||||
${pkgs.coreutils}/bin/chown nextcloud:nextcloud /var/lib/nextcloud/store-apps
|
|
||||||
'';
|
|
||||||
before = [
|
|
||||||
"nextcloud-setup.service"
|
|
||||||
"var-lib-nextcloud-store\\x2dapps-calendar.mount"
|
|
||||||
];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = "root";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Setup mail server
|
# Setup mail server
|
||||||
services.maddy = {
|
services.maddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -191,7 +146,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
system.fsPackages = [ pkgs.bindfs ];
|
#system.fsPackages = [ pkgs.bindfs ];
|
||||||
|
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "23.11";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue