From 01ab610f5c6195c8eee633f10909f332a2d28a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kugland?= Date: Sat, 30 Mar 2024 04:05:09 -0300 Subject: [PATCH] Remove buggy qemu-user-static module ... --- README.md | 30 ------------------------ modules/default.nix | 1 - modules/qemu-user-static.nix | 45 ------------------------------------ 3 files changed, 76 deletions(-) delete mode 100644 modules/qemu-user-static.nix diff --git a/README.md b/README.md index 937df9b..cc4322c 100644 --- a/README.md +++ b/README.md @@ -20,36 +20,6 @@ # Modules -## qemu-user-static - -[**qemu-user-static**](./modules/qemu-user-static.nix) enables executing foreign-architecture -containers with QEMU and binfmt_misc (only available on `x86_64-linux`). This module pulls an OCI -container that automagically sets up the necessary configuration, and sets up an one-shot systemd -service to start the container on boot. - -To use this module, add the following to your `configuration.nix`: - -```nix -{ - imports = [ pkgs.nur.repos.kugland.modules.qemu-user-static ]; - virtualisation.qemu-user-static = { - enable = true; - autoStart = true; # If you want the container to start on boot - }; -} -``` - -To check if the module is working, try: - -```sh -$ docker run --rm -it --platform linux/s390x alpine uname -m -``` - -If everything is set up correctly, you should see `s390x` printed to the terminal, which, unless -you actually have a s390x machine, means that the container is being executed with QEMU. - -For more information, check out `qemu-user-static`’s [GitHub repository](https://github.com/multiarch/qemu-user-static). - ## google-authenticator-singlesecret **I’m not a security expert, so use this at your own risk.** diff --git a/modules/default.nix b/modules/default.nix index 783f6e8..b4898ef 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,6 +2,5 @@ # Add your NixOS modules here # # my-module = ./my-module; - qemu-user-static = ./qemu-user-static.nix; google-authenticator-singlesecret = ./google-authenticator-singlesecret; } diff --git a/modules/qemu-user-static.nix b/modules/qemu-user-static.nix deleted file mode 100644 index b516f04..0000000 --- a/modules/qemu-user-static.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - cfg = config.virtualisation.qemu-user-static; -in { - options = { - virtualisation.qemu-user-static = { - enable = lib.mkEnableOption '' - qemu-user-static enables the execution of foreign architecture containers with - QEMU and binfmt_misc (only available on x86_64-linux) - ''; - autoStart = lib.mkOption { - type = lib.types.bool; - default = true; - description = "Automatically start the qemu-user-static service on boot"; - }; - }; - }; - config = lib.mkIf cfg.enable { - virtualisation.oci-containers.containers.qemu-user-static = { - autoStart = cfg.autoStart; - extraOptions = ["--rm" "--privileged"]; - cmd = ["--reset" "-p" "yes"]; - image = "docker.io/multiarch/qemu-user-static:latest"; - imageFile = pkgs.dockerTools.pullImage { - imageName = "docker.io/multiarch/qemu-user-static"; - imageDigest = "sha256:fe60359c92e86a43cc87b3d906006245f77bfc0565676b80004cc666e4feb9f0"; - sha256 = "sha256-Fes4LJIDubvplytbujCgmR+eLMstsXSIg4JaHZk3Pko="; - }; - }; - systemd.services.podman-qemu-user-static.serviceConfig = { - Type = lib.mkForce "oneshot"; - Restart = lib.mkForce "no"; - }; - assertions = [ - { - assertion = with config.nixpkgs.hostPlatform; (isx86_64 && isLinux); - message = "qemu-user-static is only available on x86_64-linux"; - } - ]; - }; -}