From 90b9e9d32b7e5ad912f043d032d8b6155b8623ed Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Thu, 6 Oct 2022 00:43:34 +0300 Subject: [PATCH] wayland-vm --- machines/Wayland-VM/default.nix | 103 ++++++++++++------ machines/Wayland-VM/imports/qemu-vm.nix | 17 +++ .../Wayland-VM/{ => imports}/system-path.nix | 0 machines/Wayland-VM/qemu-vm.nix | 11 -- 4 files changed, 88 insertions(+), 43 deletions(-) create mode 100644 machines/Wayland-VM/imports/qemu-vm.nix rename machines/Wayland-VM/{ => imports}/system-path.nix (100%) delete mode 100644 machines/Wayland-VM/qemu-vm.nix diff --git a/machines/Wayland-VM/default.nix b/machines/Wayland-VM/default.nix index e629f47..b6e2f0a 100644 --- a/machines/Wayland-VM/default.nix +++ b/machines/Wayland-VM/default.nix @@ -1,10 +1,10 @@ { modulesPath, inputs, lib, pkgs, ... }: { imports = [ - ./hardware-configuration.nix + # ./hardware-configuration.nix "${modulesPath}/profiles/qemu-guest.nix" "${modulesPath}/profiles/minimal.nix" - ./system-path.nix - ./qemu-vm.nix + ./imports/system-path.nix + ./imports/qemu-vm.nix ]; disabledModules = [ "config/system-path.nix" ]; @@ -66,14 +66,51 @@ environment.etc.nixpkgs.source = inputs.nixpkgs; environment.etc.self.source = inputs.self; - environment.systemPackages = [ - pkgs.labwc.overrideAttrs (old: { - mesonFlags = [ "-Dxwayland=disabled" ]; + nixpkgs.overlays = [ + (self: super: { + labwc = super.labwc.overrideAttrs (old: { + mesonFlags = [ "-Dxwayland=disabled" ]; + }); + waydroid-script = let + py = super.python3.withPackages (pythonPackages: with pythonPackages; [ + tqdm + requests + ]); + in super.stdenv.mkDerivation { + name = "myscript"; + version = "git"; + + src = super.fetchFromGitHub { + repo = "waydroid_script"; + owner = "AlukardBF"; + rev = "d8eaf667220c5ef72519280354d373a149e041a3"; + sha256 = "1m15x87c7pc7ag624zccjjb19ixki01c0pfr78myc8nbavi56lfz"; + }; + + buildInputs = [ + py + super.lzip + super.sqlite + super.util-linux + ]; + installPhase = '' + mkdir -p $out/bin + cp waydroid_extras.py $out/bin/waydroid-script + chmod +x $out/bin/waydroid-script + sed -i '1i #!${py}/bin/python' $out/bin/waydroid-script + ''; + }; }) + ]; + + environment.systemPackages = [ + # pkgs.util-linux + pkgs.labwc pkgs.nano - pkgs.foot + pkgs.havoc pkgs.gnused pkgs.ncftp + pkgs.waydroid-script ]; environment.sessionVariables = { @@ -84,25 +121,12 @@ console.font = "cyr-sun16"; console.keyMap = "ruwin_cplk-UTF-8"; - fonts = { - fonts = [ pkgs.ibm-plex ]; - fontconfig = { - enable = true; - defaultFonts = { - monospace = [ "IBM Plex Mono 12" ]; - sansSerif = [ "IBM Plex Sans 12" ]; - serif = [ "IBM Plex Serif 12" ]; - }; - }; - enableDefaultFonts = false; - }; + fonts.enableDefaultFonts = lib.mkForce false; environment.noXlibs = lib.mkForce false; security.polkit.enable = true; - system.stateVersion = "22.11"; - services.getty.autologinUser = "alukard"; environment.etc."gbinder.d/waydroid.conf".source = let @@ -115,22 +139,26 @@ environment.loginShellInit = lib.mkAfter '' [[ "$(tty)" == /dev/tty1 ]] && { - labwc -s foot + labwc -s havoc } ''; system.userActivationScripts.linktosharedfolder.text = let - foot = pkgs.writeText "foot.ini" '' - font=IBM Plex Mono:size=12 + havoc = pkgs.writeText "havoc.cfg" '' + [child] + program=bash + [font] + size=18 + path=${pkgs.ibm-plex}/share/fonts/truetype/VictorMono-Regular.ttf ''; in '' - if [[ ! -d "$HOME/.config/foot" ]]; then - mkdir -p $HOME/.config/foot + if [[ ! -d "$HOME/.config" ]]; then + mkdir -p $HOME/.config fi - if [[ -h "$HOME/.config/foot/foot.ini" ]]; then - rm -f "$HOME/.config/foot/foot.ini" + if [[ -h "$HOME/.config/havoc.cfg" ]]; then + rm -f "$HOME/.config/havoc.cfg" fi - ln -s "${foot}" "$HOME/.config/foot/foot.ini" + ln -s "${havoc}" "$HOME/.config/havoc.cfg" ''; environment.etc."xdg/labwc/environment".text = '' @@ -167,7 +195,7 @@ - foot + havoc @@ -200,8 +228,17 @@ - - foot + + + + + havoc + + + + + + @@ -257,5 +294,7 @@ window.active.button.close.unpressed.image.color: #ef6b7b window.inactive.button.close.unpressed.image.color: #bf616a ''; + + system.stateVersion = "22.11"; }; } diff --git a/machines/Wayland-VM/imports/qemu-vm.nix b/machines/Wayland-VM/imports/qemu-vm.nix new file mode 100644 index 0000000..c6324b7 --- /dev/null +++ b/machines/Wayland-VM/imports/qemu-vm.nix @@ -0,0 +1,17 @@ +{ modulesPath, config, ... }: { + imports = [ + "${modulesPath}/virtualisation/qemu-vm.nix" + ]; + virtualisation = { + qemu.options = [ "-vga none" "-device virtio-vga-gl" "-display gtk,gl=on" ]; + cores = 4; + memorySize = 6044; + msize = 131072; + diskSize = 20480; + diskImage = "./vm-images/${config.device}.qcow2"; + # resolution = { x = 1920; y = 1080; }; + + useNixStoreImage = true; + writableStore = false; + }; +} diff --git a/machines/Wayland-VM/system-path.nix b/machines/Wayland-VM/imports/system-path.nix similarity index 100% rename from machines/Wayland-VM/system-path.nix rename to machines/Wayland-VM/imports/system-path.nix diff --git a/machines/Wayland-VM/qemu-vm.nix b/machines/Wayland-VM/qemu-vm.nix deleted file mode 100644 index d0d2b08..0000000 --- a/machines/Wayland-VM/qemu-vm.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ modulesPath, ... }: { - imports = [ - "${modulesPath}/virtualisation/qemu-vm.nix" - ]; - virtualisation = { - qemu.options = ["-vga none" "-device virtio-vga-gl" "-display gtk,gl=on"]; - cores = 4; - memorySize = 4096; - diskSize = 20480; - }; -} \ No newline at end of file