2024-10-28 09:51:44 +00:00
|
|
|
|
{
|
|
|
|
|
description = "Lotte’s nix configuration";
|
2022-01-14 09:19:01 +00:00
|
|
|
|
|
2022-03-05 20:39:49 +00:00
|
|
|
|
inputs = {
|
2024-10-28 09:56:58 +00:00
|
|
|
|
flake-compat = {
|
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-28 09:51:44 +00:00
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs";
|
2022-03-05 20:39:49 +00:00
|
|
|
|
};
|
2022-01-14 09:19:01 +00:00
|
|
|
|
|
2022-06-12 15:39:15 +00:00
|
|
|
|
outputs = {
|
|
|
|
|
self,
|
|
|
|
|
nixpkgs,
|
2024-10-28 09:51:44 +00:00
|
|
|
|
} @ inputs': let
|
|
|
|
|
inputs =
|
|
|
|
|
inputs'
|
|
|
|
|
// {
|
|
|
|
|
nixos-config = self;
|
|
|
|
|
inherit inputs;
|
|
|
|
|
};
|
|
|
|
|
pkgsFor = system:
|
|
|
|
|
import nixpkgs {
|
2024-04-26 09:26:26 +00:00
|
|
|
|
inherit system;
|
|
|
|
|
overlays = [
|
2024-10-28 09:51:44 +00:00
|
|
|
|
(_: _:
|
|
|
|
|
inputs
|
|
|
|
|
// {
|
|
|
|
|
inherit inputs;
|
|
|
|
|
})
|
2024-08-31 05:59:35 +00:00
|
|
|
|
];
|
2024-04-26 09:26:26 +00:00
|
|
|
|
};
|
2024-10-28 09:51:44 +00:00
|
|
|
|
in {
|
|
|
|
|
checks.x86_64-linux = nixpkgs.lib.listToAttrs (map (testName: {
|
|
|
|
|
name = testName;
|
|
|
|
|
value = (pkgsFor "x86_64-linux").callPackage ./tests/${testName}.nix {};
|
|
|
|
|
}) ["containers-default"]);
|
|
|
|
|
nixosModules = {
|
|
|
|
|
containers = import ./modules/containers/default.nix;
|
|
|
|
|
containers-autoconfig = import ./modules/containers/autoconfig.nix;
|
|
|
|
|
};
|
|
|
|
|
nixosContainers = with nixpkgs.lib; let
|
|
|
|
|
containerNames = [
|
|
|
|
|
"default"
|
|
|
|
|
];
|
|
|
|
|
containerArches = ["x86_64-linux" "aarch64-linux"];
|
|
|
|
|
containers = listToAttrs (flatten (map (system: let
|
|
|
|
|
pkgs = pkgsFor system;
|
|
|
|
|
in
|
|
|
|
|
map (container: {
|
|
|
|
|
name = "container-${container}-${system}";
|
|
|
|
|
value = pkgs.callPackage ./containers/${container}-configuration.nix {};
|
|
|
|
|
})
|
|
|
|
|
containerNames)
|
|
|
|
|
containerArches));
|
2024-06-17 19:11:14 +00:00
|
|
|
|
in
|
2024-10-28 09:51:44 +00:00
|
|
|
|
containers;
|
|
|
|
|
nixosConfigurations = with nixpkgs.lib; let
|
|
|
|
|
mkSystem = args:
|
|
|
|
|
nixosSystem (args
|
|
|
|
|
// {
|
2022-06-12 15:39:15 +00:00
|
|
|
|
specialArgs =
|
2024-10-28 09:51:44 +00:00
|
|
|
|
args.specialArgs
|
|
|
|
|
or {}
|
|
|
|
|
// inputs;
|
|
|
|
|
});
|
|
|
|
|
containers = mapAttrs (_: container:
|
|
|
|
|
mkSystem {
|
|
|
|
|
inherit (container) system;
|
|
|
|
|
modules = [
|
|
|
|
|
container.config
|
|
|
|
|
];
|
2022-01-14 09:19:01 +00:00
|
|
|
|
})
|
2024-10-28 09:51:44 +00:00
|
|
|
|
self.nixosContainers;
|
|
|
|
|
in
|
|
|
|
|
containers;
|
2024-10-28 09:56:58 +00:00
|
|
|
|
hydraJobs = {
|
|
|
|
|
inherit (self) checks nixosConfigurations;
|
|
|
|
|
};
|
2022-06-12 15:39:15 +00:00
|
|
|
|
};
|
2022-01-14 09:19:01 +00:00
|
|
|
|
}
|