1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/tests/incron.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

56 lines
1.6 KiB
Nix

import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "incron";
meta.maintainers = [ lib.maintainers.aanderse ];
nodes.machine =
{ ... }:
{
services.incron.enable = true;
services.incron.extraPackages = [ pkgs.coreutils ];
services.incron.systab = ''
/test IN_CREATE,IN_MODIFY,IN_CLOSE_WRITE,IN_MOVED_FROM,IN_MOVED_TO echo "$@/$# $%" >> /root/incron.log
'';
# ensure the directory to be monitored exists before incron is started
systemd.tmpfiles.settings.incron-test = {
"/test".d = { };
};
};
testScript = ''
start_all()
machine.wait_for_unit("multi-user.target")
machine.wait_for_unit("incron.service")
machine.succeed("test -d /test")
# create some activity for incron to monitor
machine.succeed("touch /test/file")
machine.succeed("echo foo >> /test/file")
machine.succeed("mv /test/file /root")
machine.succeed("mv /root/file /test")
machine.sleep(1)
# touch /test/file
machine.succeed("grep '/test/file IN_CREATE' /root/incron.log")
# echo foo >> /test/file
machine.succeed("grep '/test/file IN_MODIFY' /root/incron.log")
machine.succeed("grep '/test/file IN_CLOSE_WRITE' /root/incron.log")
# mv /test/file /root
machine.succeed("grep '/test/file IN_MOVED_FROM' /root/incron.log")
# mv /root/file /test
machine.succeed("grep '/test/file IN_MOVED_TO' /root/incron.log")
# ensure something unexpected is not present
machine.fail("grep 'IN_OPEN' /root/incron.log")
'';
}
)