diff --git a/config/zshrc b/config/zshrc index e15d2a8..0daeece 100755 --- a/config/zshrc +++ b/config/zshrc @@ -8,6 +8,9 @@ unsetopt PROMPT_SP bindkey -v # End of lines configured by zsh-newuser-install +# Temporary Rebuild shortcut +alias re-scarab="sudo nixos-rebuild --flake '/etc/nixos#scarab'" + export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" export XDG_DATA_HOME="$HOME/.local/share" diff --git a/flake.lock b/flake.lock index 9220a36..628c13a 100644 --- a/flake.lock +++ b/flake.lock @@ -38,11 +38,11 @@ ] }, "locked": { - "lastModified": 1713547570, - "narHash": "sha256-i8tNz47Lfsq5QWFLyE3rIm0gs2UUvXXAxfWTC24e370=", + "lastModified": 1712390667, + "narHash": "sha256-ebq+fJZfobqpsAdGDGpxNWSySbQejRwW9cdiil6krCo=", "owner": "nix-community", "repo": "home-manager", - "rev": "7c61e400a99f33cdff3118c1e4032bcb049e1a30", + "rev": "b787726a8413e11b074cde42704b4af32d95545c", "type": "github" }, "original": { @@ -55,11 +55,11 @@ "mobile-nixos": { "flake": false, "locked": { - "lastModified": 1713034591, - "narHash": "sha256-zEtSq4e1hsf5nPoTzsx+cvHTusQxFdyDpD3mOa360A0=", + "lastModified": 1711757427, + "narHash": "sha256-PqHK0J9YCRKlxpJp+UG+/xpwfIQRPVUPspvbbP3FB2M=", "owner": "nixos", "repo": "mobile-nixos", - "rev": "5455e4455b231218f6198b39383a0ad4c1d6638e", + "rev": "f7087f8fdbd1309af315ef8c92345320aadc5edf", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1713521961, - "narHash": "sha256-EwR8wW9AqJhSIY+0oxWRybUZ32BVKuZ9bjlRh8SJvQ8=", + "lastModified": 1712324865, + "narHash": "sha256-+BatEWd4HlMeK7Ora+gYIkarjxFVCg9oKrIeybHIIX4=", "owner": "Nixos", "repo": "nixos-hardware", - "rev": "5d48925b815fd202781bfae8fb6f45c07112fdb2", + "rev": "f3b959627bca46a9f7052b8fbc464b8323e68c2c", "type": "github" }, "original": { @@ -86,11 +86,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713297878, - "narHash": "sha256-hOkzkhLT59wR8VaMbh1ESjtZLbGi+XNaBN6h49SPqEc=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "66adc1e47f8784803f2deb6cacd5e07264ec2d5c", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 527b9f2..eb85aff 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,18 @@ } ]; }; + scarab = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + { _module.args = { inherit inputs; }; } + (import "${inputs.mobile-nixos}/lib/configuration.nix" { + device = "oneplus-enchilada"; + }) + ./packages/default.nix + ./hosts/scarab/default.nix + ./users/stitchynyan/default.nix + ]; + }; lappy = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -56,7 +68,6 @@ ./packages/default.nix ./hosts/gemini/default.nix ./users/nyadmin/default.nix - ./users/cirno/default.nix home-manager.nixosModules.home-manager { @@ -64,7 +75,6 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.nyadmin = import ./users/nyadmin/home.nix; - home-manager.users.cirno = import ./users/cirno/home.nix; } ]; }; diff --git a/hosts/default.nix b/hosts/default.nix index 84d0a96..9063f24 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -15,7 +15,7 @@ in }; boot = { - kernelPackages = lib.mkDefault pkgs.linuxPackages_zen; + #kernelPackages = lib.mkDefault pkgs.linuxPackages_zen; loader = { efi.canTouchEfiVariables = lib.mkDefault true; systemd-boot.enable = lib.mkDefault true; @@ -25,7 +25,6 @@ in security.sudo.wheelNeedsPassword = false; security.rtkit.enable = true; services = { - fstrim.enable = true; resolved = { enable = true; dnsovertls = "opportunistic"; diff --git a/hosts/lappy/default.nix b/hosts/lappy/default.nix index 1a30eab..123528c 100644 --- a/hosts/lappy/default.nix +++ b/hosts/lappy/default.nix @@ -70,7 +70,7 @@ PCIE_ASPM_ON_AC = "default"; PCIE_ASPM_ON_BAT = "powersupersave"; PLATFORM_PROFILE_ON_BAT = "low-power"; - RUNTIME_PM_ON_BAT = "auto"; + RUNTIME_PM_ON_BAT = true; WOL_DISABLE = true; SCHED_POWERSAVE_ON_BAT = true; diff --git a/hosts/malachite/default.nix b/hosts/malachite/default.nix index b546972..08a6ceb 100644 --- a/hosts/malachite/default.nix +++ b/hosts/malachite/default.nix @@ -1,75 +1,65 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, ... }: let - passthrough = pkgs.writeShellApplication { - name = "pasthrough.sh"; - runtimeInputs = lib.attrVals [ "coreutils" "kmod" "libvirt" "procps" ] pkgs; - text = '' - GUEST_NAME="$1" - HOOK_NAME="$2" - STATE_NAME="$3" + passthrough = pkgs.writeShellScript "pasthrough.sh" '' + GUEST_NAME="$1" + HOOK_NAME="$2" + STATE_NAME="$3" - echo 19>/home/stitchynyan/startlogfile - BASH_XTRACEFD=19 - set -x + set -e + set -x + + # For the windows 10 VM + if [[ "$GUEST_NAME" == "win10" ]]; then - # For the windows 10 VM - if [[ "$GUEST_NAME" == "win10" ]]; then + # Prepare hook + if [[ "$HOOK_NAME/$STATE_NAME" == "prepare/begin" ]]; then - # Prepare hook - if [[ "$HOOK_NAME/$STATE_NAME" == "prepare/begin" ]]; then + # Remove Hyprland + ${pkgs.busybox}/bin/pkill Hyprland - # Remove Hyprland - pkill Hyprland + # Unbind VTconsoles + ${pkgs.busybox}/bin/echo 0 > /sys/class/vtconsole/vtcon0/bind + ${pkgs.busybox}/bin/echo 0 > /sys/class/vtconsole/vtcon1/bind - # Unbind VTconsoles - echo 0 > /sys/class/vtconsole/vtcon0/bind - echo 0 > /sys/class/vtconsole/vtcon1/bind + # Unbind EFI-Framebuffer + ${pkgs.busybox}/bin/echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind - # Unbind EFI-Framebuffer - echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind + # Unload Modules + ${pkgs.busybox}/bin/modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia - # We love race conditions - sleep 2 + # Unbind the GPU from display driver + ${pkgs.libvirt}/bin/virsh nodedev-detach pci_0000_01_00_0 + ${pkgs.libvirt}/bin/virsh nodedev-detach pci_0000_01_00_1 - # Unload Modules - modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia + # Load VFIO Kernel Module + ${pkgs.busybox}/bin/modprobe vfio_pci - # Unbind the GPU from display driver - virsh nodedev-detach pci_0000_01_00_0 - virsh nodedev-detach pci_0000_01_00_1 + elif [[ "$HOOK_NAME/$STATE_NAME" == "release/end" ]]; then - # Load VFIO Kernel Module - modprobe vfio_pci + # Re-Bind GPU to Nvidia Driver (replace the pci addresses with yours) + ${pkgs.libvirt}/bin/virsh nodedev-reattach pci_0000_01_00_0 + ${pkgs.libvirt}/bin/virsh nodedev-reattach pci_0000_01_00_1 - sleep 2 + ${pkgs.busybox}/bin/modprobe -r vfio-pci - elif [[ "$HOOK_NAME/$STATE_NAME" == "release/end" ]]; then + #bind efi + ${pkgs.busybox}/bin/echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind - # Re-Bind GPU to Nvidia Driver (replace the pci addresses with yours) - virsh nodedev-reattach pci_0000_01_00_0 - virsh nodedev-reattach pci_0000_01_00_1 + # Reload nvidia modules + ${pkgs.busybox}/bin/modprobe nvidia_drm + ${pkgs.busybox}/bin/modprobe nvidia_modeset + ${pkgs.busybox}/bin/modprobe nvidia_uvm + ${pkgs.busybox}/bin/modprobe nvidia - modprobe -r vfio-pci - - #bind efi - echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind - - # Reload nvidia modules - modprobe nvidia_drm - modprobe nvidia_modeset - modprobe nvidia_uvm - modprobe nvidia - - # Rebind VT consoles - echo 1 > /sys/class/vtconsole/vtcon0/bind - bin/echo 1 > /sys/class/vtconsole/vtcon1/bind - - fi + # Rebind VT consoles + ${pkgs.busybox}/bin/echo 1 > /sys/class/vtconsole/vtcon0/bind + ${pkgs.busybox}/bin/echo 1 > /sys/class/vtconsole/vtcon1/bind fi - ''; - }; + fi + + ''; in { imports = [ @@ -89,15 +79,6 @@ in { steam-hardware.enable = true; }; - networking.networkmanager.enable = true; - services.syncthing = { - enable = true; - user = "stitchynyan"; - openDefaultPorts = true; - databaseDir = "/home/stitchynyan/.local/share/syncthing"; - dataDir = "/home/stitchynyan"; - }; - networking.hostName = "malachite"; time.timeZone = "America/Los_Angeles"; diff --git a/hosts/malachite/hardware-configuration.nix b/hosts/malachite/hardware-configuration.nix index 1cbe4bc..da77e9a 100644 --- a/hosts/malachite/hardware-configuration.nix +++ b/hosts/malachite/hardware-configuration.nix @@ -7,7 +7,7 @@ boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" "vfio-pci" ]; + boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; boot.kernelParams = [ diff --git a/hosts/scarab/default.nix b/hosts/scarab/default.nix new file mode 100644 index 0000000..06ca55b --- /dev/null +++ b/hosts/scarab/default.nix @@ -0,0 +1,101 @@ +{ config, inputs, lib, pkgs, ... }: +let + +in +{ + imports = [ + ../default.nix + #"${inputs.mobile-nixos}/modules/quirks/qualcomm/sdm845-modem.nix" + #"${inputs.mobile-nixos}/modules/quirks/audio.nix" + ]; + + stitchyconf.form = "handheld"; + + mobile = { + beautification = { + silentBoot = lib.mkDefault true; + splash = lib.mkDefault true; + }; + boot.stage-1 = { + kernel.useStrictKernelConfig = true; + networking.enable = true; + }; + quirks = { + audio.alsa-ucm-meld = true; + qualcomm.sdm845-modem.enable = true; + }; + }; + + boot.loader = { + efi.canTouchEfiVariables = false; + systemd-boot.enable = false; + }; + #services.openssh.enable = true; + services.xserver.desktopManager.phosh = { + enable = true; + user = "stitchynyan"; + group = "users"; + }; + + #services.xserver.desktopManager.plasma5 = { + # enable = true; + # mobile.enable = true; + #}; + + programs.firefox.enable = true; + programs.calls.enable = true; + + hardware = { + bluetooth.enable = true; + pulseaudio.enable = lib.mkForce false; + sensor.iio.enable = true; + }; + + networking.networkmanager = { + enable = true; + unmanaged = [ "rndis0" "usb0" ]; + }; + + /*services.pipewire.wireplumber.configPackages = [ + (pkgs.writeTextDir "share/wireplumber/quailcum.lua.d/51-qcom-sdm845.lua" '' + ${builtins.readFile (pkgs.fetchurl { + url = "https://gitlab.com/postmarketOS/pmaports/-/raw/0aa9524204e9c9c002c860b87c972bc2ebf025f3/device/community/soc-qcom-sdm845/51-qcom-sdm845.lua"; + hash = "sha256-56oNJJyuZZe1Iig1xskDuyazw3PbRZtmU/YRFUTqjwk="; + })} + '') + ];*/ + + services.pipewire.wireplumber.configPackages = [ + (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/51-qcom-sdm845.conf" '' + monitor.alsa.rules = [ + { + matches = [ + { + node.name = "~alsa_output.*" + } + ] + actions = { + update-props = { + audio.format = "S16LE" + audio.rate = 48000 + api.alsa.period-size = 4096 + api.alsa.period-num = 6 + api.alsa.headroom = 512 + } + } + } + ] + '') + ]; + + services.openssh = { + enable = true; + settings.PasswordAuthentication = true; + }; + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "oneplus-sdm845-firmware" + "oneplus-sdm845-firmware-xz" + ]; + system.stateVersion = "23.11"; +} diff --git a/packages/default.nix b/packages/default.nix index ffe07f9..4f7fe19 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -11,6 +11,8 @@ let ] pkgs; handheldPkgs = lib.attrVals [ "chatty" + "fluffychat" + "gnome-console" "gnome-text-editor" "megapixels" ] pkgs; diff --git a/users/cirno/default.nix b/users/cirno/default.nix deleted file mode 100644 index 4870a94..0000000 --- a/users/cirno/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - - - config = { - - programs = { - firefox.enable = true; - }; - - services = { - displayManager.sddm = { - enable = true; - wayland.enable = true; - }; - desktopManager.plasma6.enable = true; - }; - - users.users.cirno = { - isNormalUser = true; - shell = pkgs.zsh; - home = "/home/cirno"; - description = "user for guests/cirno people"; - extraGroups = [ "" ]; - initialHashedPassword = "$6$2f8vjQbdKyEBqPRT$FrZBZfzpJGqNqLlCyb7CzRNm0wuZwfRI7Qj/dUQlbtLixyJK5Im9AJT7GXmP5StfhZxSbH/wW8nDGPQm98NXV0"; - }; - }; -} diff --git a/users/cirno/home.nix b/users/cirno/home.nix deleted file mode 100644 index 2b43031..0000000 --- a/users/cirno/home.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, - nixosConfig, - pkgs, - lib, - inputs, - home-manager, - ... }: - let - - in - { - - home.stateVersion = "24.05"; - home.homeDirectory = "/home/cirno"; - } diff --git a/users/default.nix b/users/default.nix index ecc5e31..00303d3 100644 --- a/users/default.nix +++ b/users/default.nix @@ -6,5 +6,6 @@ mutableUsers = false; users.root.initialHashedPassword = "!"; }; + hardware.pulseaudio.enable = false; }; } diff --git a/users/stitchynyan/default.nix b/users/stitchynyan/default.nix index c91b878..51d9adf 100644 --- a/users/stitchynyan/default.nix +++ b/users/stitchynyan/default.nix @@ -4,51 +4,52 @@ imports = [ ../default.nix ]; nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem ( lib.getName pkg) [ - "cudatoolkit" - "nvidia-settings" - "nvidia-x11" "osu-lazer" "steam" "steam-original" "steam-run" + "nvidia-x11" + "nvidia-settings" + "cudatoolkit" ]; programs = { firefox.enable = true; - hyprland.enable = true; - openvpn3.enable = true; + hyprland.enable = config.stitchyconf.form == "pc"; + openvpn3.enable = config.stitchyconf.form == "pc"; steam = { - enable = true; + enable = config.stitchyconf.form == "pc"; remotePlay.openFirewall = true; }; }; - security.pam.services.swaylock = {}; - services = { avahi = { - enable = config.stitchyconf.form == "pc"; + enable = false; nssmdns4 = true; openFirewall = true; }; blueman.enable = true; - gnome.gnome-keyring.enable = true; + gnome.gnome-keyring.enable = lib.mkIf( config.stitchyconf.form == "pc") true; pipewire = { + enable = lib.mkForce true; alsa.enable = true; - enable = true; + jack.enable = true; pulse.enable = true; }; - printing.enable = true; - usbmuxd.enable = true; + printing.enable = false; + usbmuxd.enable = false; xserver.enable = true; }; + security.pam.services.swaylock = {}; + users.users.stitchynyan = { - description = "Personal user"; - extraGroups = [ "wheel" "networkmanager" "kvm" "libvirtd" "audio" "dialout" ]; - home = "/home/stitchynyan"; - initialHashedPassword = "$y$j9T$rvySCWHYE4AO4A9J0Vf20.$x5hpBNsOWovQFtNfFUIt17OAH5MJFwFBGjxbaEIagJ3"; isNormalUser = true; shell = pkgs.zsh; + home = "/home/stitchynyan"; + description = "Personal user"; + extraGroups = [ "wheel" "networkmanager" "kvm" "libvirtd" "audio" ]; + initialHashedPassword = "$y$j9T$rvySCWHYE4AO4A9J0Vf20.$x5hpBNsOWovQFtNfFUIt17OAH5MJFwFBGjxbaEIagJ3"; }; }