Merge pull request #186940 from NickCao/stratis-cli

stratis-cli: init at 3.2.0

Changed files
+249
nixos
pkgs
development
python-modules
dbus-python-client-gen
dbus-signature-pyparsing
hs-dbus-signature
into-dbus-python
tools
filesystems
stratis-cli
stratisd
top-level
+1
nixos/modules/module-list.nix
···
./tasks/network-interfaces-scripted.nix
./tasks/scsi-link-power-management.nix
./tasks/snapraid.nix
./tasks/swraid.nix
./tasks/trackpoint.nix
./tasks/powertop.nix
···
./tasks/network-interfaces-scripted.nix
./tasks/scsi-link-power-management.nix
./tasks/snapraid.nix
+
./tasks/stratis.nix
./tasks/swraid.nix
./tasks/trackpoint.nix
./tasks/powertop.nix
+18
nixos/modules/tasks/stratis.nix
···
···
+
{ config, lib, pkgs, ... }:
+
+
let
+
cfg = config.services.stratis;
+
in
+
{
+
options.services.stratis = {
+
enable = lib.mkEnableOption (lib.mdDoc "Stratis Storage - Easy to use local storage management for Linux");
+
};
+
+
config = lib.mkIf cfg.enable {
+
environment.systemPackages = [ pkgs.stratis-cli ];
+
systemd.packages = [ pkgs.stratisd ];
+
services.dbus.packages = [ pkgs.stratisd ];
+
services.udev.packages = [ pkgs.stratisd ];
+
systemd.services.stratisd.wantedBy = [ "sysinit.target" ];
+
};
+
}
+1
nixos/tests/all-tests.nix
···
sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {};
starship = handleTest ./starship.nix {};
step-ca = handleTestOn ["x86_64-linux"] ./step-ca.nix {};
strongswan-swanctl = handleTest ./strongswan-swanctl.nix {};
stunnel = handleTest ./stunnel.nix {};
sudo = handleTest ./sudo.nix {};
···
sssd-ldap = handleTestOn ["x86_64-linux"] ./sssd-ldap.nix {};
starship = handleTest ./starship.nix {};
step-ca = handleTestOn ["x86_64-linux"] ./step-ca.nix {};
+
stratis = handleTest ./stratis {};
strongswan-swanctl = handleTest ./strongswan-swanctl.nix {};
stunnel = handleTest ./stunnel.nix {};
sudo = handleTest ./sudo.nix {};
+7
nixos/tests/stratis/default.nix
···
···
+
{ system ? builtins.currentSystem
+
, pkgs ? import ../../.. { inherit system; }
+
}:
+
+
{
+
simple = import ./simple.nix { inherit system pkgs; };
+
}
+39
nixos/tests/stratis/simple.nix
···
···
+
import ../make-test-python.nix ({ pkgs, ... }:
+
{
+
name = "stratis";
+
+
meta = with pkgs.lib.maintainers; {
+
maintainers = [ nickcao ];
+
};
+
+
nodes.machine = { pkgs, ... }: {
+
services.stratis.enable = true;
+
virtualisation.emptyDiskImages = [ 1024 1024 1024 1024 ];
+
};
+
+
testScript = ''
+
machine.wait_for_unit("stratisd")
+
# test pool creation
+
machine.succeed("stratis pool create testpool /dev/vdb")
+
machine.succeed("stratis pool add-data testpool /dev/vdc")
+
machine.succeed("stratis pool init-cache testpool /dev/vdd")
+
machine.succeed("stratis pool add-cache testpool /dev/vde")
+
# test filesystem creation and rename
+
machine.succeed("stratis filesystem create testpool testfs0")
+
machine.succeed("stratis filesystem rename testpool testfs0 testfs1")
+
# test snapshot
+
machine.succeed("mkdir -p /mnt/testfs1 /mnt/testfs2")
+
machine.wait_for_file("/dev/stratis/testpool/testfs1")
+
machine.succeed("mount /dev/stratis/testpool/testfs1 /mnt/testfs1")
+
machine.succeed("echo test0 > /mnt/testfs1/test0")
+
machine.succeed("echo test1 > /mnt/testfs1/test1")
+
machine.succeed("stratis filesystem snapshot testpool testfs1 testfs2")
+
machine.succeed("echo test2 > /mnt/testfs1/test1")
+
machine.wait_for_file("/dev/stratis/testpool/testfs2")
+
machine.succeed("mount /dev/stratis/testpool/testfs2 /mnt/testfs2")
+
assert "test0" in machine.succeed("cat /mnt/testfs1/test0")
+
assert "test0" in machine.succeed("cat /mnt/testfs2/test0")
+
assert "test2" in machine.succeed("cat /mnt/testfs1/test1")
+
assert "test1" in machine.succeed("cat /mnt/testfs2/test1")
+
'';
+
})
+34
pkgs/development/python-modules/dbus-python-client-gen/default.nix
···
···
+
{ lib
+
, buildPythonPackage
+
, fetchFromGitHub
+
, into-dbus-python
+
, dbus-python
+
, pytestCheckHook
+
}:
+
+
buildPythonPackage rec {
+
pname = "dbus-python-client-gen";
+
version = "0.8";
+
+
src = fetchFromGitHub {
+
owner = "stratis-storage";
+
repo = pname;
+
rev = "v${version}";
+
hash = "sha256-nSzxT65WHBVct5pGHmIAHJXftd0tKZeK/argN+V9xcs=";
+
};
+
+
propagatedBuildInputs = [
+
into-dbus-python
+
dbus-python
+
];
+
checkInputs = [
+
pytestCheckHook
+
];
+
+
meta = with lib; {
+
description = "A Python library for generating dbus-python client code";
+
homepage = "https://github.com/stratis-storage/dbus-python-client-gen";
+
license = licenses.mpl20;
+
maintainers = with maintainers; [ nickcao ];
+
};
+
}
+34
pkgs/development/python-modules/dbus-signature-pyparsing/default.nix
···
···
+
{ lib
+
, buildPythonPackage
+
, fetchFromGitHub
+
, pyparsing
+
, pytestCheckHook
+
, hypothesis
+
, hs-dbus-signature
+
}:
+
+
buildPythonPackage rec {
+
pname = "dbus-signature-pyparsing";
+
version = "0.04";
+
+
src = fetchFromGitHub {
+
owner = "stratis-storage";
+
repo = pname;
+
rev = "v${version}";
+
hash = "sha256-IXyepfq7pLTRkTolKWsKGrYDoxukVC9JTrxS9xV7s2I=";
+
};
+
+
propagatedBuildInputs = [ pyparsing ];
+
checkInputs = [
+
pytestCheckHook
+
hypothesis
+
hs-dbus-signature
+
];
+
+
meta = with lib; {
+
description = "A Parser for a D-Bus Signature";
+
homepage = "https://github.com/stratis-storage/dbus-signature-pyparsing";
+
license = licenses.asl20;
+
maintainers = with maintainers; [ nickcao ];
+
};
+
}
+28
pkgs/development/python-modules/hs-dbus-signature/default.nix
···
···
+
{ lib
+
, buildPythonPackage
+
, fetchPypi
+
, pytestCheckHook
+
, hypothesis
+
}:
+
+
buildPythonPackage rec {
+
pname = "hs-dbus-signature";
+
version = "0.7";
+
+
src = fetchPypi {
+
inherit pname version;
+
hash = "sha256-NNnTcSX+K8zU+sj1QBd13h7aEXN9VqltJMNWCuhgZ6I=";
+
};
+
+
checkInputs = [
+
pytestCheckHook
+
hypothesis
+
];
+
+
meta = with lib; {
+
description = "A Hypothesis Strategy for Generating Arbitrary DBus Signatures";
+
homepage = "https://github.com/stratis-storage/hs-dbus-signature";
+
license = licenses.mpl20;
+
maintainers = with maintainers; [ nickcao ];
+
};
+
}
+38
pkgs/development/python-modules/into-dbus-python/default.nix
···
···
+
{ lib
+
, buildPythonPackage
+
, fetchFromGitHub
+
, dbus-signature-pyparsing
+
, dbus-python
+
, pytestCheckHook
+
, hypothesis
+
, hs-dbus-signature
+
}:
+
+
buildPythonPackage rec {
+
pname = "into-dbus-python";
+
version = "0.08";
+
+
src = fetchFromGitHub {
+
owner = "stratis-storage";
+
repo = pname;
+
rev = "v${version}";
+
hash = "sha256-Z8e6oAvRMIisMjG4HcS5jSH1znGVc7pGpMITo5fXYVs=";
+
};
+
+
propagatedBuildInputs = [
+
dbus-signature-pyparsing
+
dbus-python
+
];
+
checkInputs = [
+
pytestCheckHook
+
hypothesis
+
hs-dbus-signature
+
];
+
+
meta = with lib; {
+
description = "A transformer to dbus-python types";
+
homepage = "https://github.com/stratis-storage/into-dbus-python";
+
license = licenses.asl20;
+
maintainers = with maintainers; [ nickcao ];
+
};
+
}
+36
pkgs/tools/filesystems/stratis-cli/default.nix
···
···
+
{ lib
+
, python3Packages
+
, fetchFromGitHub
+
, nixosTests
+
}:
+
+
python3Packages.buildPythonApplication rec {
+
pname = "stratis-cli";
+
version = "3.2.0";
+
+
src = fetchFromGitHub {
+
owner = "stratis-storage";
+
repo = pname;
+
rev = "v${version}";
+
hash = "sha256-JQXTzvm4l/pl2T4djZ3HEdDQJdFE+I9doe8Iv5q34kw=";
+
};
+
+
propagatedBuildInputs = with python3Packages; [
+
psutil
+
python-dateutil
+
wcwidth
+
justbytes
+
dbus-client-gen
+
dbus-python-client-gen
+
packaging
+
];
+
+
passthru.tests = nixosTests.stratis;
+
+
meta = with lib; {
+
description = "CLI for the Stratis project";
+
homepage = "https://stratis-storage.github.io";
+
license = licenses.asl20;
+
maintainers = with maintainers; [ nickcao ];
+
};
+
}
+3
pkgs/tools/filesystems/stratisd/default.nix
···
, tpm2-tools
, coreutils
, clevisSupport ? false
}:
stdenv.mkDerivation rec {
···
rm -r "$out/lib/dracut"
rm -r "$out/lib/systemd/system-generators"
'';
meta = with lib; {
description = "Easy to use local storage management for Linux";
···
, tpm2-tools
, coreutils
, clevisSupport ? false
+
, nixosTests
}:
stdenv.mkDerivation rec {
···
rm -r "$out/lib/dracut"
rm -r "$out/lib/systemd/system-generators"
'';
+
+
passthru.tests = nixosTests.stratis;
meta = with lib; {
description = "Easy to use local storage management for Linux";
+2
pkgs/top-level/all-packages.nix
···
stratisd = callPackage ../tools/filesystems/stratisd { };
strawberry = libsForQt5.callPackage ../applications/audio/strawberry { };
schildichat-desktop = callPackage ../applications/networking/instant-messengers/schildichat/schildichat-desktop.nix {
···
stratisd = callPackage ../tools/filesystems/stratisd { };
+
stratis-cli = callPackage ../tools/filesystems/stratis-cli { };
+
strawberry = libsForQt5.callPackage ../applications/audio/strawberry { };
schildichat-desktop = callPackage ../applications/networking/instant-messengers/schildichat/schildichat-desktop.nix {
+8
pkgs/top-level/python-packages.nix
···
inherit (pkgs) dbus;
};
dbutils = callPackage ../development/python-modules/dbutils { };
db-dtypes = callPackage ../development/python-modules/db-dtypes { };
···
hpccm = callPackage ../development/python-modules/hpccm { };
hsaudiotag3k = callPackage ../development/python-modules/hsaudiotag3k { };
hsluv = callPackage ../development/python-modules/hsluv { };
···
interruptingcow = callPackage ../development/python-modules/interruptingcow { };
intervaltree = callPackage ../development/python-modules/intervaltree { };
intreehooks = callPackage ../development/python-modules/intreehooks { };
···
inherit (pkgs) dbus;
};
+
dbus-python-client-gen = callPackage ../development/python-modules/dbus-python-client-gen { };
+
+
dbus-signature-pyparsing = callPackage ../development/python-modules/dbus-signature-pyparsing { };
+
dbutils = callPackage ../development/python-modules/dbutils { };
db-dtypes = callPackage ../development/python-modules/db-dtypes { };
···
hpccm = callPackage ../development/python-modules/hpccm { };
+
hs-dbus-signature = callPackage ../development/python-modules/hs-dbus-signature { };
+
hsaudiotag3k = callPackage ../development/python-modules/hsaudiotag3k { };
hsluv = callPackage ../development/python-modules/hsluv { };
···
interruptingcow = callPackage ../development/python-modules/interruptingcow { };
intervaltree = callPackage ../development/python-modules/intervaltree { };
+
+
into-dbus-python = callPackage ../development/python-modules/into-dbus-python { };
intreehooks = callPackage ../development/python-modules/intreehooks { };