remove containers
This commit is contained in:
parent
f62e92ff98
commit
f2fabdec75
8 changed files with 1 additions and 180 deletions
46
flake.nix
46
flake.nix
|
@ -134,44 +134,9 @@
|
|||
};
|
||||
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;
|
||||
default = import ./modules/default.nix;
|
||||
};
|
||||
nixosContainers =
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
containerNames = [
|
||||
"default"
|
||||
"postgresql"
|
||||
];
|
||||
containerArches = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"riscv64-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
|
||||
)
|
||||
);
|
||||
in
|
||||
containers;
|
||||
nixosConfigurations =
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
|
@ -210,15 +175,6 @@
|
|||
system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
containers = mapAttrs (
|
||||
_: container:
|
||||
mkSystem {
|
||||
inherit (container) system;
|
||||
modules = [
|
||||
container.config
|
||||
];
|
||||
}
|
||||
) self.nixosContainers;
|
||||
systems = mapAttrs (
|
||||
_: system:
|
||||
mkSystem {
|
||||
|
@ -229,7 +185,7 @@
|
|||
}
|
||||
) systems';
|
||||
in
|
||||
containers // systems;
|
||||
systems;
|
||||
hydraJobs = {
|
||||
inherit (self) checks devShells packages;
|
||||
nixosConfigurations = nixpkgs.lib.mapAttrs (
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
badNames = [
|
||||
"system"
|
||||
"override"
|
||||
"overrideDerivation"
|
||||
];
|
||||
filterBad = filterAttrs (n: _: lib.all (m: n != m) badNames);
|
||||
in
|
||||
{
|
||||
options.autoContainers = mkOption {
|
||||
default = [ ];
|
||||
type = types.listOf types.str;
|
||||
description = "names of containers to automatically set up";
|
||||
};
|
||||
config = {
|
||||
containers = listToAttrs (
|
||||
map (container: {
|
||||
name = container;
|
||||
value = filterBad (pkgs.callPackage ../../containers/${container}-configuration.nix { }) // {
|
||||
specialArgs = inputs;
|
||||
};
|
||||
}) config.autoContainers
|
||||
);
|
||||
};
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
nixos-config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
nixos-config.nixosModules.default
|
||||
./hostName.nix
|
||||
./minimize.nix
|
||||
];
|
||||
|
||||
networking.hostName = lib.mkOverride 1100 "container";
|
||||
boot.isContainer = true;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./autoconfig.nix
|
||||
];
|
||||
networking.interfaces.containers = {
|
||||
ipv6.addresses = [
|
||||
{
|
||||
address = "fdc6:e7e5:0ba1:1::1";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
};
|
||||
networking.bridges.containers.interfaces = [ ];
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.networking = {
|
||||
rootHostName = mkOption {
|
||||
description = "Hostname of the running host";
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "rainbow-resort";
|
||||
};
|
||||
nodeID = mkOption {
|
||||
description = "Unique node ID";
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
};
|
||||
fullHostName = mkOption {
|
||||
description = "Full combined host name";
|
||||
type = types.str;
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
networking = rec {
|
||||
fullHostName =
|
||||
if config.networking.rootHostName == "" then
|
||||
config.networking.hostName
|
||||
else
|
||||
"${config.networking.rootHostName}-${config.networking.hostName}";
|
||||
nodeID = lib.substring 0 8 (builtins.hashString "sha256" fullHostName);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{ nixpkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(nixpkgs.outPath + "/nixos/modules/profiles/minimal.nix")
|
||||
(nixpkgs.outPath + "/nixos/modules/profiles/headless.nix")
|
||||
];
|
||||
nix.enable = false; # We don’t need the nix package manager inside of the container.
|
||||
}
|
|
@ -12,7 +12,6 @@ with lib;
|
|||
{
|
||||
imports = [
|
||||
./riscv.nix
|
||||
./containers/host.nix
|
||||
./nix
|
||||
./environment/impermanence.nix
|
||||
./secrets/sops.nix
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
testers,
|
||||
inputs,
|
||||
}:
|
||||
testers.runNixOSTest {
|
||||
name = "container-default-test";
|
||||
nodes.default =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
nixos-config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
nixos-config.nixosModules.default
|
||||
];
|
||||
autoContainers = [ "default" ];
|
||||
};
|
||||
node.specialArgs = inputs // {
|
||||
inTester = true;
|
||||
};
|
||||
testScript = ''
|
||||
machine.wait_for_unit("container@default.service")
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue