commit
d7042595d5
@ -0,0 +1,42 @@ |
||||
# This file contains type hints that can be prepended to Nix test scripts so they can be type |
||||
# checked. |
||||
|
||||
from test_driver.driver import Driver |
||||
from test_driver.vlan import VLan |
||||
from test_driver.machine import Machine |
||||
from test_driver.logger import Logger |
||||
from typing import Callable, Iterator, ContextManager, Optional, List, Dict, Any, Union |
||||
from typing_extensions import Protocol |
||||
from pathlib import Path |
||||
|
||||
|
||||
class RetryProtocol(Protocol): |
||||
def __call__(self, fn: Callable, timeout: int = 900) -> None: |
||||
raise Exception("This is just type information for the Nix test driver") |
||||
|
||||
|
||||
class PollingConditionProtocol(Protocol): |
||||
def __call__( |
||||
self, |
||||
fun_: Optional[Callable] = None, |
||||
*, |
||||
seconds_interval: float = 2.0, |
||||
description: Optional[str] = None, |
||||
) -> Union[Callable[[Callable], ContextManager], ContextManager]: |
||||
raise Exception("This is just type information for the Nix test driver") |
||||
|
||||
|
||||
start_all: Callable[[], None] |
||||
subtest: Callable[[str], ContextManager[None]] |
||||
retry: RetryProtocol |
||||
test_script: Callable[[], None] |
||||
machines: List[Machine] |
||||
vlans: List[VLan] |
||||
driver: Driver |
||||
log: Logger |
||||
create_machine: Callable[[Dict[str, Any]], Machine] |
||||
run_tests: Callable[[], None] |
||||
join_all: Callable[[], None] |
||||
serial_stdout_off: Callable[[], None] |
||||
serial_stdout_on: Callable[[], None] |
||||
polling_condition: PollingConditionProtocol |
@ -1,96 +1,119 @@ |
||||
import ./make-test-python.nix ( |
||||
{ pkgs, ... }: |
||||
|
||||
let |
||||
password = "some_password"; |
||||
repository = "/tmp/restic-backup"; |
||||
rcloneRepository = "rclone:local:/tmp/restic-rclone-backup"; |
||||
let |
||||
password = "some_password"; |
||||
repository = "/tmp/restic-backup"; |
||||
repositoryFile = "${pkgs.writeText "repositoryFile" "/tmp/restic-backup-from-file"}"; |
||||
rcloneRepository = "rclone:local:/tmp/restic-rclone-backup"; |
||||
|
||||
passwordFile = "${pkgs.writeText "password" "correcthorsebatterystaple"}"; |
||||
initialize = true; |
||||
paths = [ "/opt" ]; |
||||
pruneOpts = [ |
||||
"--keep-daily 2" |
||||
"--keep-weekly 1" |
||||
"--keep-monthly 1" |
||||
"--keep-yearly 99" |
||||
]; |
||||
in |
||||
{ |
||||
name = "restic"; |
||||
backupPrepareCommand = '' |
||||
touch /opt/backupPrepareCommand |
||||
test ! -e /opt/backupCleanupCommand |
||||
''; |
||||
|
||||
meta = with pkgs.lib.maintainers; { |
||||
maintainers = [ bbigras i077 ]; |
||||
}; |
||||
backupCleanupCommand = '' |
||||
rm /opt/backupPrepareCommand |
||||
touch /opt/backupCleanupCommand |
||||
''; |
||||
|
||||
nodes = { |
||||
server = |
||||
{ pkgs, ... }: |
||||
{ |
||||
services.restic.backups = { |
||||
remotebackup = { |
||||
inherit repository passwordFile initialize paths pruneOpts; |
||||
}; |
||||
rclonebackup = { |
||||
repository = rcloneRepository; |
||||
rcloneConfig = { |
||||
type = "local"; |
||||
one_file_system = true; |
||||
}; |
||||
passwordFile = "${pkgs.writeText "password" "correcthorsebatterystaple"}"; |
||||
initialize = true; |
||||
paths = [ "/opt" ]; |
||||
pruneOpts = [ |
||||
"--keep-daily 2" |
||||
"--keep-weekly 1" |
||||
"--keep-monthly 1" |
||||
"--keep-yearly 99" |
||||
]; |
||||
in |
||||
{ |
||||
name = "restic"; |
||||
|
||||
# This gets overridden by rcloneConfig.type |
||||
rcloneConfigFile = pkgs.writeText "rclone.conf" '' |
||||
[local] |
||||
type=ftp |
||||
''; |
||||
inherit passwordFile initialize paths pruneOpts; |
||||
}; |
||||
remoteprune = { |
||||
inherit repository passwordFile; |
||||
pruneOpts = [ "--keep-last 1" ]; |
||||
}; |
||||
}; |
||||
meta = with pkgs.lib.maintainers; { |
||||
maintainers = [ bbigras i077 ]; |
||||
}; |
||||
|
||||
environment.sessionVariables.RCLONE_CONFIG_LOCAL_TYPE = "local"; |
||||
nodes = { |
||||
server = |
||||
{ pkgs, ... }: |
||||
{ |
||||
services.restic.backups = { |
||||
remotebackup = { |
||||
inherit repository passwordFile initialize paths pruneOpts backupPrepareCommand backupCleanupCommand; |
||||
}; |
||||
remotebackup-from-file = { |
||||
inherit repositoryFile passwordFile initialize paths pruneOpts; |
||||
}; |
||||
rclonebackup = { |
||||
repository = rcloneRepository; |
||||
rcloneConfig = { |
||||
type = "local"; |
||||
one_file_system = true; |
||||
}; |
||||
|
||||
# This gets overridden by rcloneConfig.type |
||||
rcloneConfigFile = pkgs.writeText "rclone.conf" '' |
||||
[local] |
||||
type=ftp |
||||
''; |
||||
inherit passwordFile initialize paths pruneOpts; |
||||
}; |
||||
remoteprune = { |
||||
inherit repository passwordFile; |
||||
pruneOpts = [ "--keep-last 1" ]; |
||||
}; |
||||
}; |
||||
|
||||
environment.sessionVariables.RCLONE_CONFIG_LOCAL_TYPE = "local"; |
||||
}; |
||||
}; |
||||
|
||||
testScript = '' |
||||
server.start() |
||||
server.wait_for_unit("dbus.socket") |
||||
server.fail( |
||||
"${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots", |
||||
"${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots", |
||||
) |
||||
server.succeed( |
||||
"mkdir -p /opt", |
||||
"touch /opt/some_file", |
||||
"mkdir -p /tmp/restic-rclone-backup", |
||||
"timedatectl set-time '2016-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
'${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
"timedatectl set-time '2017-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-14 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-15 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-16 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^4 snapshot"', |
||||
'${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots -c | grep -e "^4 snapshot"', |
||||
"systemctl start restic-backups-remoteprune.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
) |
||||
''; |
||||
} |
||||
testScript = '' |
||||
server.start() |
||||
server.wait_for_unit("dbus.socket") |
||||
server.fail( |
||||
"${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots", |
||||
'${pkgs.restic}/bin/restic --repository-file ${repositoryFile} -p ${passwordFile} snapshots"', |
||||
"${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots", |
||||
) |
||||
server.succeed( |
||||
"mkdir -p /opt", |
||||
"touch /opt/some_file", |
||||
"mkdir -p /tmp/restic-rclone-backup", |
||||
"timedatectl set-time '2016-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-remotebackup-from-file.service", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
'${pkgs.restic}/bin/restic --repository-file ${repositoryFile} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
'${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
"timedatectl set-time '2017-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-13 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-14 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-15 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
"timedatectl set-time '2018-12-16 13:45'", |
||||
"systemctl start restic-backups-remotebackup.service", |
||||
"rm /opt/backupCleanupCommand", |
||||
"systemctl start restic-backups-rclonebackup.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^4 snapshot"', |
||||
'${pkgs.restic}/bin/restic -r ${rcloneRepository} -p ${passwordFile} snapshots -c | grep -e "^4 snapshot"', |
||||
"systemctl start restic-backups-remoteprune.service", |
||||
'${pkgs.restic}/bin/restic -r ${repository} -p ${passwordFile} snapshots -c | grep -e "^1 snapshot"', |
||||
) |
||||
''; |
||||
} |
||||
) |
||||
|
@ -0,0 +1,37 @@ |
||||
{ lib, stdenvNoCC, fetchurl, makeWrapper, jre } : |
||||
|
||||
stdenvNoCC.mkDerivation rec { |
||||
pname = "panoply"; |
||||
version = "5.0.6"; |
||||
|
||||
src = fetchurl { |
||||
url = "https://www.giss.nasa.gov/tools/panoply/download/PanoplyJ-${version}.tgz"; |
||||
sha256 = "0nbr22sxfmk48ngk9gb1vcwv3fkd5m0v208xx6vl00nlnbh4kms4"; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ makeWrapper ]; |
||||
|
||||
installPhase = '' |
||||
runHook preInstall |
||||
|
||||
jarbase=$out/share/panoply |
||||
mkdir -p $out/bin $jarbase/jars |
||||
|
||||
sed -i "s:^SCRIPTDIR.*:SCRIPTDIR=$jarbase:" panoply.sh |
||||
|
||||
cp panoply.sh $out/bin/panoply |
||||
cp -r jars $jarbase |
||||
|
||||
wrapProgram "$out/bin/panoply" --prefix PATH : "${jre}/bin" |
||||
|
||||
runHook postHook |
||||
''; |
||||
|
||||
meta = with lib; { |
||||
description = "netCDF, HDF and GRIB Data Viewer"; |
||||
homepage = "https://www.giss.nasa.gov/tools/panoply"; |
||||
platforms = platforms.linux; |
||||
maintainers = [ maintainers.markuskowa ]; |
||||
license = licenses.unfree; # Package does not state a license |
||||
}; |
||||
} |
@ -1,4 +1,4 @@ |
||||
# frozen_string_literal: true |
||||
source "https://rubygems.org" |
||||
|
||||
gem "metasploit-framework", git: "https://github.com/rapid7/metasploit-framework", ref: "refs/tags/6.2.0" |
||||
gem "metasploit-framework", git: "https://github.com/rapid7/metasploit-framework", ref: "refs/tags/6.2.1" |
||||
|
Loading…
Reference in new issue