dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit 87ab679cfe49d9b2e07bcd04fb6ce1da8743b045 parent 912a37ec4e35b7b5d9ffce437a0a91d473790e84 Author: maydayv7 <maydayv7@gmail.com> Date: Thu, 11 Jan 2024 10:30:00 +0530 fix: Android Virtualisation + Add `base.kernel` options + Fix `sql` shell
Diffstat:
| M | devices/futura.nix | | | 2 | +- |
| M | devices/vortex.nix | | | 18 | +++++++++--------- |
| M | files/gnome/menu.json | | | 12 | ++++++++++-- |
| M | modules/README.md | | | 5 | ++++- |
| M | modules/base/default.nix | | | 37 | ++++++++++++++++++++++++++++++++++++- |
| M | modules/configuration.nix | | | 13 | +------------ |
| M | modules/hardware/virtualisation/android.nix | | | 37 | ++++++++++++++++++++++++++++++------- |
| M | shells/sql.nix | | | 3 | +-- |
8 files changed, 92 insertions(+), 35 deletions(-)
diff --git a/devices/futura.nix b/devices/futura.nix @@ -7,7 +7,7 @@ locale = "IN"; update = "weekly"; - kernel = "6_5"; + kernel = "lts"; hardware = { boot = "efi"; cores = 4; diff --git a/devices/vortex.nix b/devices/vortex.nix @@ -6,7 +6,7 @@ timezone = "Asia/Kolkata"; locale = "IN"; - kernel = "lqx"; + kernel = "xanmod"; kernelModules = ["nvme" "thunderbolt"]; hardware = { @@ -15,12 +15,13 @@ filesystem = "advanced"; support = ["laptop" "mobile" "printer" "virtualisation"]; modules = ["dell-inspiron-5509"]; - vm.android.enable = true; + vm.android.enable = false; }; - gui = { - desktop = "gnome"; - wallpaper = "Nix"; + shell.utilities = true; + apps = { + list = ["discord" "firefox" "git" "office" "vscode" "wine"]; + wine.utilities = true; }; nix = { @@ -28,10 +29,9 @@ tools = true; }; - shell.utilities = true; - apps = { - list = ["discord" "firefox" "git" "office" "vscode" "wine"]; - wine.utilities = true; + gui = { + desktop = "gnome"; + wallpaper = "Nix"; }; # User V7 diff --git a/files/gnome/menu.json b/files/gnome/menu.json @@ -50,8 +50,16 @@ }, { "type": "command", + "title": "Documentation", + "command": "xdg-open /run/current-system/sw/share/gnome-shell/extensions/guillotine@fopdoodle.net/README.md", + "instancing": "singleInstance", + "icon": "guillotine-symbolic", + "killOnDisable": false + }, + { + "type": "command", "title": "Log", - "command": "gnome-terminal -e 'journalctl -f GNOME_SHELL_EXTENSION_UUID=guillotine@fopdoodle.net' ", + "command": "kgx -e 'journalctl -f GNOME_SHELL_EXTENSION_UUID=guillotine@fopdoodle.net' ", "instancing": "singleInstance", "icon": "emblem-documents-symbolic", "killOnDisable": false @@ -59,7 +67,7 @@ { "type": "command", "title": "Log gnome-shell", - "command": "gnome-terminal -e 'journalctl -f _COMM=gnome-shell' ", + "command": "kgx -e 'journalctl -f _COMM=gnome-shell' ", "instancing": "singleInstance", "icon": "emblem-documents-symbolic", "killOnDisable": false diff --git a/modules/README.md b/modules/README.md @@ -19,7 +19,10 @@ Configuration [Builder](./configuration.nix) - `enable`: Install Utility Windows apps - `true / false` - `package`: Package to use for `wine` - Ex. `pkgs.winePackages.staging` -- [`base`](./base): Module that contains the base common/shared configuration +- [`base`](./base): Module that contains the base common/shared configuration - + + - `kernel`: Linux Kernel Variant to be used - `"zfs" / "lts" / "variant"` + - `kernelModules`: Linux Kernel Modules to load - [`gui`](./gui): Module that configures GUI Desktops/Environments and the like - diff --git a/modules/base/default.nix b/modules/base/default.nix @@ -1,13 +1,48 @@ { + config, + options, + lib, util, inputs, pkgs, ... -}: { +}: let + inherit (lib) mkOption optionals types; + cfg = config.base; +in { imports = util.map.modules.list ./. ++ [inputs.generators.nixosModules.all-formats]; + options.base = { + kernel = mkOption { + description = "Linux Kernel Variant to be used"; + type = types.str; + default = "zfs"; + }; + + kernelModules = mkOption { + description = "Linux Kernel Modules to load"; + type = with types; listOf str; + default = []; + }; + }; + ## Base Configuration ## config = { + # Kernel Configuration + boot = { + kernelPackages = + if (cfg.kernel == "zfs") + then pkgs.zfs.latestCompatibleLinuxPackages + else if (cfg.kernel == "lts") + then options.boot.kernelPackages.default + else pkgs.linuxKernel.packages."${"linux_" + cfg.kernel}"; + + initrd.availableKernelModules = + optionals (cfg.kernelModules != []) + (cfg.kernelModules + ++ ["ahci" "sd_mod" "usbhid" "usb_storage" "xhci_pci"]); + }; + # Documentation documentation = { dev.enable = true; diff --git a/modules/configuration.nix b/modules/configuration.nix @@ -110,6 +110,7 @@ in ); inherit apps gui hardware shell; + base = {inherit kernel kernelModules;}; # Device Name networking = { @@ -121,18 +122,6 @@ in time.timeZone = timezone; i18n.defaultLocale = "en_${locale}"; - # Kernel Configuration - boot = { - initrd.availableKernelModules = - if (kernelModules != null) - then kernelModules ++ ["ahci" "sd_mod" "usbhid" "usb_storage" "xhci_pci"] - else []; - kernelPackages = - if (kernel == "zfs") - then pkgs.zfs.latestCompatibleLinuxPackages - else pkgs.linuxKernel.packages."${"linux_" + kernel}"; - }; - # Package Configuration nixpkgs = {inherit pkgs;}; nix = diff --git a/modules/hardware/virtualisation/android.nix b/modules/hardware/virtualisation/android.nix @@ -1,26 +1,49 @@ { config, + options, lib, pkgs, ... -}: { - options.hardware.vm.android.enable = lib.mkEnableOption "Enable Android Virtualisation"; +}: let + inherit (lib) mkEnableOption mkIf optional; + inherit (config.hardware.vm.android) enable; +in { + options.hardware.vm.android.enable = mkEnableOption "Enable Android Virtualisation"; ## Android Virtualisation ## - config = lib.mkIf config.hardware.vm.android.enable { - virtualisation.waydroid.enable = true; - environment.systemPackages = [pkgs.wl-clipboard]; + config = mkIf enable { + assertions = [ + { + assertion = config.gui.wayland.enable; + message = '' + Wayland support is required + - Use a DE that supports Wayland + ''; + } + ]; + + warnings = optional (config.boot.kernelPackages != options.boot.kernelPackages.default) '' + Android Virtualisation may not work + - Kernel may not have requisite 'binder' module + - Use the mainline/LTS kernel for assured support + ''; #!# Run the following command to install the image: #!# sudo waydroid init -s GAPPS -f + virtualisation.waydroid.enable = true; + environment.systemPackages = [pkgs.wl-clipboard]; # Environment Setup - user.groups = ["android"]; users.groups.android = { name = "android"; gid = 1000; }; - user.persist.directories = [".local/share/waydroid"]; + + user = { + groups = ["android"]; + persist.directories = [".local/share/waydroid"]; + }; + environment.persist.directories = [ { directory = "/var/lib/waydroid"; diff --git a/shells/sql.nix b/shells/sql.nix @@ -4,7 +4,6 @@ pkgs: { shellHook = '' MYSQL_BASEDIR=${pkgs.mariadb} MYSQL_HOME=$HOME/.mysql - mkdir -p $MYSQL_HOME MYSQL_DATADIR=$MYSQL_HOME/data export MYSQL_UNIX_PORT=$MYSQL_HOME/mysql.sock MYSQL_PID_FILE=$MYSQL_HOME/mysql.pid @@ -12,7 +11,7 @@ pkgs: { if [ ! -d "$MYSQL_HOME" ]; then # Make sure to use normal authentication method otherwise we can only - # connect with unix account. But users do not actually exist in NixOS + # connect with unix account, but users do not actually exist in NixOS mysql_install_db --auth-root-authentication-method=normal \ --datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR \ --pid-file=$MYSQL_PID_FILE