Compare commits
4 Commits
2875d29293
...
ca3ea3166f
| Author | SHA1 | Date | |
|---|---|---|---|
|
ca3ea3166f
|
|||
|
1242ba2274
|
|||
|
80d9e1029d
|
|||
|
003418b27b
|
60
flake.nix
60
flake.nix
@@ -62,6 +62,7 @@
|
||||
username = "primary";
|
||||
hostname = "muffin";
|
||||
eth_interface = "enp4s0";
|
||||
system = "x86_64-linux";
|
||||
|
||||
service_configs = rec {
|
||||
zpool_ssds = "tank";
|
||||
@@ -133,12 +134,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
hostPlatform = system;
|
||||
buildPlatform = builtins.currentSystem;
|
||||
};
|
||||
lib = import ./lib.nix { inherit inputs pkgs; };
|
||||
in
|
||||
{
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||
nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = rec {
|
||||
inherit
|
||||
username
|
||||
@@ -154,19 +160,17 @@
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
let
|
||||
ports = lib.attrValues service_configs.ports;
|
||||
uniquePorts = lib.unique ports;
|
||||
in
|
||||
(lib.length ports) == (lib.length uniquePorts);
|
||||
message = "Duplicate ports detected in 'ports' configuration";
|
||||
}
|
||||
];
|
||||
};
|
||||
config.assertions = [
|
||||
{
|
||||
assertion =
|
||||
let
|
||||
ports = lib.attrValues service_configs.ports;
|
||||
uniquePorts = lib.unique ports;
|
||||
in
|
||||
(lib.length ports) == (lib.length uniquePorts);
|
||||
message = "Duplicate ports detected in 'ports' configuration";
|
||||
}
|
||||
];
|
||||
}
|
||||
)
|
||||
|
||||
@@ -193,10 +197,7 @@
|
||||
home-manager.nixosModules.home-manager
|
||||
(
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
home-manager,
|
||||
stateVersion,
|
||||
...
|
||||
}:
|
||||
{
|
||||
@@ -217,13 +218,28 @@
|
||||
profiles.system = {
|
||||
sshUser = "root";
|
||||
user = "root";
|
||||
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.muffin;
|
||||
path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.muffin;
|
||||
};
|
||||
};
|
||||
|
||||
tests = import ./tests/tests.nix {
|
||||
inherit pkgs lib;
|
||||
config = self.nixosConfigurations.muffin.config;
|
||||
};
|
||||
packages.${system} =
|
||||
let
|
||||
testSuite = import ./tests/tests.nix {
|
||||
inherit pkgs lib;
|
||||
config = self.nixosConfigurations.muffin.config;
|
||||
};
|
||||
in
|
||||
{
|
||||
tests = pkgs.linkFarm "all-tests" (
|
||||
pkgs.lib.mapAttrsToList (name: test: {
|
||||
name = name;
|
||||
path = test;
|
||||
}) testSuite
|
||||
);
|
||||
}
|
||||
// (pkgs.lib.mapAttrs' (name: test: {
|
||||
name = "test-${name}";
|
||||
value = test;
|
||||
}) testSuite);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
}
|
||||
|
||||
20
tests/testTest.nix
Normal file
20
tests/testTest.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "test of tests";
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.succeed("echo hello!")
|
||||
'';
|
||||
}
|
||||
@@ -4,6 +4,10 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
handleTest = file: import file { inherit config lib pkgs; };
|
||||
in
|
||||
{
|
||||
zfsTest = import ./zfs.nix { inherit config lib pkgs; };
|
||||
zfsTest = handleTest ./zfs.nix;
|
||||
testTest = handleTest ./testTest.nix;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
...
|
||||
}:
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "test of tests";
|
||||
name = "zfs folder dependency and mounting test";
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
|
||||
Reference in New Issue
Block a user