Skip to content

Commit

Permalink
Allow armv6l-linux / armv7l-linux (Raspberry Pi)
Browse files Browse the repository at this point in the history
  • Loading branch information
SFrijters committed Sep 4, 2024
1 parent c8a49fd commit 6bb2b7e
Showing 1 changed file with 56 additions and 48 deletions.
104 changes: 56 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,70 @@
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = rec {
default = logwatch;
logwatch = pkgs.callPackage ./packages/logwatch.nix { };
nix-gc-script = pkgs.callPackage ./packages/logwatch-scripts/nix-gc.nix { };
nixos-upgrade-script = pkgs.callPackage ./packages/logwatch-scripts/nixos-upgrade.nix { };
};
flake-utils.lib.eachSystem
(
flake-utils.lib.defaultSystems
++ [
"armv6l-linux"
"armv7l-linux"
]
)
(
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = rec {
default = logwatch;
logwatch = pkgs.callPackage ./packages/logwatch.nix { };
nix-gc-script = pkgs.callPackage ./packages/logwatch-scripts/nix-gc.nix { };
nixos-upgrade-script = pkgs.callPackage ./packages/logwatch-scripts/nixos-upgrade.nix { };
};

checks.default = pkgs.nixosTest {
name = "logwatch-module-test";
checks.default = pkgs.nixosTest {
name = "logwatch-module-test";

nodes.server =
{ ... }:
{
nodes.server =
{ ... }:
{

imports = [ self.nixosModules.logwatch ];
imports = [ self.nixosModules.logwatch ];

environment.systemPackages = [ pkgs.mailutils ];
environment.systemPackages = [ pkgs.mailutils ];

services = {
logwatch.enable = true;
postfix.enable = true;
services = {
logwatch.enable = true;
postfix.enable = true;
};
};
};

testScript = ''
import sys
import time
start_all()
server.wait_for_unit("default.target")
# Force restart of logwatch so it sends a mail
server.systemctl("restart logwatch")
# VMs on CI runners can be kind of slow, delay here
time.sleep(3)
# Get all mails for root and check if the expected subject is there
mail = server.succeed("mail -p")
print(mail)
if "Subject: Logwatch for server" not in mail:
sys.exit(1)
if "unstable" not in "${self.packages.${system}.logwatch.version}":
if "Logwatch ${self.packages.${system}.logwatch.version}" not in mail:
sys.exit(1)
else:
if "Logwatch ${self.packages.${system}.logwatch.src.rev}" not in mail:
sys.exit(1)
'';
};
testScript = ''
import sys
import time
start_all()
server.wait_for_unit("default.target")
# Force restart of logwatch so it sends a mail
server.systemctl("restart logwatch")
# VMs on CI runners can be kind of slow, delay here
time.sleep(3)
# Get all mails for root and check if the expected subject is there
mail = server.succeed("mail -p")
print(mail)
if "Subject: Logwatch for server" not in mail:
sys.exit(1)
if "unstable" not in "${self.packages.${system}.logwatch.version}":
if "Logwatch ${self.packages.${system}.logwatch.version}" not in mail:
sys.exit(1)
else:
if "Logwatch ${self.packages.${system}.logwatch.src.rev}" not in mail:
sys.exit(1)
'';
};

formatter = pkgs.nixfmt-rfc-style;
}
)
formatter = pkgs.nixfmt-rfc-style;
}
)
// {
nixosModules = {
logwatch = import ./modules/logwatch.nix;
Expand Down

0 comments on commit 6bb2b7e

Please sign in to comment.