From 6d80ede6a51a7397bf5472b901989a075d53189e Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 13 Mar 2020 11:44:35 +0100 Subject: [PATCH 1/4] nix/pkgs: remove rdedup as it's on stable now --- nix/pkgs/default.nix | 2 -- nix/pkgs/rdedup/default.nix | 35 --------------------- nix/pkgs/rdedup/v3.1.1-fix-Cargo.lock.patch | 28 ----------------- 3 files changed, 65 deletions(-) delete mode 100644 nix/pkgs/rdedup/default.nix delete mode 100644 nix/pkgs/rdedup/v3.1.1-fix-Cargo.lock.patch diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index fabac52..2a7f4d2 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -35,8 +35,6 @@ in rec { pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sgx); linuxPackages_sgx_latest = linuxPackages_sgx_540rc3; - rdedup = pkgs.callPackages ../pkgs/rdedup {}; - busyboxStatic = pkgs.busybox.override { enableStatic = true; extraConfig = '' diff --git a/nix/pkgs/rdedup/default.nix b/nix/pkgs/rdedup/default.nix deleted file mode 100644 index 6ac542e..0000000 --- a/nix/pkgs/rdedup/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl, libsodium -, llvmPackages, clang_39, lzma }: - -rustPlatform.buildRustPackage rec { - name = "rdedup-${version}"; - version = "3.1.1"; - - src = fetchFromGitHub { - owner = "dpc"; - repo = "rdedup"; - rev = "rdedup-v${version}"; - sha256 = "0y34a3mpghdmcb2rx4z62q0s351bfmy1287d75mm07ryfgglgsd7"; - }; - - patches = [ - ./v3.1.1-fix-Cargo.lock.patch - ]; - - cargoSha256 = "0p19qcz2ph6axfccjwc6z72hrlb48l7sf1n0hc1gfq8hj2s3k2s1"; - - nativeBuildInputs = [ pkgconfig llvmPackages.libclang clang_39 ]; - buildInputs = [ openssl libsodium lzma ]; - - configurePhase = '' - export LIBCLANG_PATH="${llvmPackages.libclang}/lib" - ''; - - meta = with stdenv.lib; { - description = "Data deduplication with compression and public key encryption"; - homepage = https://github.com/dpc/rdedup; - license = licenses.mpl20; - maintainers = with maintainers; [ dywedir ]; - platforms = platforms.all; - }; -} diff --git a/nix/pkgs/rdedup/v3.1.1-fix-Cargo.lock.patch b/nix/pkgs/rdedup/v3.1.1-fix-Cargo.lock.patch deleted file mode 100644 index 7dafc77..0000000 --- a/nix/pkgs/rdedup/v3.1.1-fix-Cargo.lock.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/Cargo.lock b/Cargo.lock -index 96be83a..fe07471 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -880,12 +880,12 @@ dependencies = [ - - [[package]] - name = "rdedup" --version = "3.1.0" -+version = "3.1.1" - dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -- "rdedup-lib 3.0.0", -+ "rdedup-lib 3.1.0", - "rpassword 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -@@ -900,7 +900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" - - [[package]] - name = "rdedup-lib" --version = "3.0.0" -+version = "3.1.0" - dependencies = [ - "backblaze-b2 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", From 0ea2593e9c69e2a49f06425ec4e5a7abfd386545 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Sun, 15 Mar 2020 09:55:59 +0100 Subject: [PATCH 2/4] nix/os/containers/backup: add common safety options to shell script --- nix/os/containers/backup.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/os/containers/backup.nix b/nix/os/containers/backup.nix index 426979b..8b9a3d3 100644 --- a/nix/os/containers/backup.nix +++ b/nix/os/containers/backup.nix @@ -126,6 +126,8 @@ in args // { ''; script = '' #! ${pkgs.bash}/bin/bash + set -Eeuxo pipefail + export RUST_BACKTRACE=1 export TIMESTAMP=$(date +"%Y%m%d.%H%M%S") @@ -133,9 +135,7 @@ in args // { for d in `ls -1 ${bkpSource}`; do echo Determining backup source size ${bkpSource}/$d... du -hs ${bkpSource}/$d - set -x rdup -x /dev/null ${bkpSource}/$d | rdedup -v -ttt --dir=${bkpDestination}/rdedup store $d-''${TIMESTAMP} - set +x done sync echo Finished rdup/rdedup backup... From ebe3167f5b4bc15feebdb5c531d2601209cfa882 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Sun, 15 Mar 2020 09:57:21 +0100 Subject: [PATCH 3/4] nix/os/devices/vmd32387.contaboserver.net: update to NixOS 20.03 --- nix/os/containers/webserver.nix | 32 ++++++++++++------- .../configuration.nix | 1 + .../vmd32387.contaboserver.net/versions.nix | 15 ++++++--- nix/pkgs/default.nix | 4 ++- nix/variables/versions.nix | 14 +++++--- 5 files changed, 43 insertions(+), 23 deletions(-) diff --git a/nix/os/containers/webserver.nix b/nix/os/containers/webserver.nix index 56d201d..7b34875 100644 --- a/nix/os/containers/webserver.nix +++ b/nix/os/containers/webserver.nix @@ -36,20 +36,28 @@ in args // { ''; }; - services.phpfpm.phpPackage = pkgs.php56; + nixpkgs.config.php = { + imap = false; + openssl = false; + curl = false; + ldap = false; + }; - services.phpfpm.poolConfigs.mypool = '' - listen = 127.0.0.1:9000 - user = nobody - pm = dynamic - pm.max_children = 5 - pm.start_servers = 2 - pm.min_spare_servers = 1 - pm.max_spare_servers = 3 - pm.max_requests = 500 + services.phpfpm.pools.mypool = { + phpPackage = pkgs.php56; + listen = "127.0.0.1:9000"; + user = "nobody"; + settings = { + "pm" = "dynamic"; + "pm.max_children" = 5; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 1; + "pm.max_spare_servers" = 3; + "pm.max_requests" = 500; - php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED - ''; + "php_admin_value[error_reporting]" = "E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED"; + }; + }; services.mysql = { enable = true; diff --git a/nix/os/devices/vmd32387.contaboserver.net/configuration.nix b/nix/os/devices/vmd32387.contaboserver.net/configuration.nix index 2239b54..48f44d9 100644 --- a/nix/os/devices/vmd32387.contaboserver.net/configuration.nix +++ b/nix/os/devices/vmd32387.contaboserver.net/configuration.nix @@ -12,5 +12,6 @@ ./system.nix ./hw.nix ./pkg.nix + ./boot.nix ]; } diff --git a/nix/os/devices/vmd32387.contaboserver.net/versions.nix b/nix/os/devices/vmd32387.contaboserver.net/versions.nix index 4db49e8..3ddc083 100644 --- a/nix/os/devices/vmd32387.contaboserver.net/versions.nix +++ b/nix/os/devices/vmd32387.contaboserver.net/versions.nix @@ -1,15 +1,20 @@ { channelsNixosStable = { - ref = "nixos-19.03"; - rev = "07e2b59812de95deeedde95fb6ba22d581d12fbc"; + ref = "nixos-20.03"; + rev = "730453919bdc191496eb5dda04d69c4c99c724b9"; }; channelsNixosUnstable = { ref = "nixos-unstable"; - rev = "34aa254f9ebf5899636a9927ceefbc9df80230f4"; + rev = "0729b8c55e0dfaf302af4c57546871d47a652048"; + }; + nixpkgsMaster = { + url = "https://github.com/NixOS/nixpkgs/"; + ref = "master"; + rev = "641e1029748a8ccd5fc052f0029e2fee89ebd0ef"; }; homeManagerModule = { url = "https://github.com/rycee/home-manager"; - ref = "master"; - rev = "465d08d99f5b72b38cecb7ca1865b7255de3ee86"; + ref = "release-19.09"; + rev = "0d1ca254d0f213a118459c5be8ae465018132f74"; }; } diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 2a7f4d2..bc20d8f 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -48,7 +48,9 @@ in rec { }; php56 = (pkgs.callPackages - "${nixpkgsWithPhp5}/pkgs/development/interpreters/php/default.nix" {}) + "${nixpkgsWithPhp5}/pkgs/development/interpreters/php/default.nix" { + icu = pkgs.icu60; + }) .php56.overrideAttrs(drv: rec { # See https://secure.php.net/ChangeLog-5.php version = "5.6.40"; diff --git a/nix/variables/versions.nix b/nix/variables/versions.nix index 2739d8a..d4b01eb 100644 --- a/nix/variables/versions.nix +++ b/nix/variables/versions.nix @@ -1,20 +1,24 @@ { channelsNixosStable = { + ref = "nixos-20.03"; + rev = "730453919bdc191496eb5dda04d69c4c99c724b9"; + }; + channelsNixos1909 = { ref = "nixos-19.09"; - rev = "c5aabb0d603e2c1ea05f5a93b3be82437f5ebf31"; + rev = "64565f9d8ffe5bc3737ebd5f6b97756fac16d23b"; }; channelsNixosUnstable = { ref = "nixos-unstable"; - rev = "7827d3f4497ed722fedca57fd4d5ca1a65c38256"; + rev = "0729b8c55e0dfaf302af4c57546871d47a652048"; }; nixpkgsMaster = { url = "https://github.com/NixOS/nixpkgs/"; ref = "master"; - rev = "abe853b84c58ddbb7c5c07e80090d47480d56c11"; + rev = "47f61c9d7f116701ad9ca0d4b894ebb5f36ef5cf"; }; homeManagerModule = { url = "https://github.com/rycee/home-manager"; - ref = "master"; - rev = "450571056552c9311fcb2894328696b535265593"; + ref = "release-19.09"; + rev = "0d1ca254d0f213a118459c5be8ae465018132f74"; }; } From 1b36ecea3de1e65a2a04abf79343250bcf944211 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Sun, 15 Mar 2020 09:56:39 +0100 Subject: [PATCH 4/4] nix/os/containers/backup: add gargabe-collection This adds instructions to remove all older backups. --- nix/os/containers/backup.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix/os/containers/backup.nix b/nix/os/containers/backup.nix index 8b9a3d3..19b91a4 100644 --- a/nix/os/containers/backup.nix +++ b/nix/os/containers/backup.nix @@ -139,6 +139,13 @@ in args // { done sync echo Finished rdup/rdedup backup... + + echo Removing all previous backups... + rdedup --dir=${bkpDestination}/rdedup list | grep -v ''${TIMESTAMP} | xargs echo rdedup --dir=${bkpDestination}/rdedup remove + + echo Running rdedup garbage-collector... + time rdedup -v -ttt --dir=${bkpDestination}/rdedup gc + echo Determining backup destination size ${bkpDestination}/rdedup... du -hs ${bkpDestination}/rdedup '';