From f2fabdec75bead85017523509d1dcec4a993b74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 16 Nov 2024 09:35:19 +0100 Subject: [PATCH] remove containers --- flake.nix | 46 +------------------------------ modules/containers/autoconfig.nix | 33 ---------------------- modules/containers/default.nix | 15 ---------- modules/containers/host.nix | 15 ---------- modules/containers/hostName.nix | 37 ------------------------- modules/containers/minimize.nix | 8 ------ modules/default.nix | 1 - tests/containers-default.nix | 26 ----------------- 8 files changed, 1 insertion(+), 180 deletions(-) delete mode 100644 modules/containers/autoconfig.nix delete mode 100644 modules/containers/default.nix delete mode 100644 modules/containers/host.nix delete mode 100644 modules/containers/hostName.nix delete mode 100644 modules/containers/minimize.nix delete mode 100644 tests/containers-default.nix diff --git a/flake.nix b/flake.nix index 20523548..efbda3f4 100644 --- a/flake.nix +++ b/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 ( diff --git a/modules/containers/autoconfig.nix b/modules/containers/autoconfig.nix deleted file mode 100644 index e4727299..00000000 --- a/modules/containers/autoconfig.nix +++ /dev/null @@ -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 - ); - }; -} diff --git a/modules/containers/default.nix b/modules/containers/default.nix deleted file mode 100644 index 22f96d68..00000000 --- a/modules/containers/default.nix +++ /dev/null @@ -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; -} diff --git a/modules/containers/host.nix b/modules/containers/host.nix deleted file mode 100644 index 43a2a518..00000000 --- a/modules/containers/host.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: -{ - imports = [ - ./autoconfig.nix - ]; - networking.interfaces.containers = { - ipv6.addresses = [ - { - address = "fdc6:e7e5:0ba1:1::1"; - prefixLength = 64; - } - ]; - }; - networking.bridges.containers.interfaces = [ ]; -} diff --git a/modules/containers/hostName.nix b/modules/containers/hostName.nix deleted file mode 100644 index 6b12a191..00000000 --- a/modules/containers/hostName.nix +++ /dev/null @@ -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); - }; - }; -} diff --git a/modules/containers/minimize.nix b/modules/containers/minimize.nix deleted file mode 100644 index 661dc081..00000000 --- a/modules/containers/minimize.nix +++ /dev/null @@ -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. -} diff --git a/modules/default.nix b/modules/default.nix index 1d1b26bc..56f92712 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -12,7 +12,6 @@ with lib; { imports = [ ./riscv.nix - ./containers/host.nix ./nix ./environment/impermanence.nix ./secrets/sops.nix diff --git a/tests/containers-default.nix b/tests/containers-default.nix deleted file mode 100644 index 6828e35e..00000000 --- a/tests/containers-default.nix +++ /dev/null @@ -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") - ''; -}