diff --git a/hosts/ayame.nix b/hosts/ayame.nix index 9ffec34..c1017d7 100644 --- a/hosts/ayame.nix +++ b/hosts/ayame.nix @@ -1,85 +1,24 @@ -{ config, pkgs, modulesPath, lib, ... }: +{ config, pkgs, lib, ... }: -{ - imports = [ - ./generic.nix - ../modules/hardware/generic.nix ../modules/hardware/bluetooth.nix ../modules/hardware/wifi.nix ../modules/hardware/video.nix ../modules/hardware/mobile.nix - ../modules/fonts.nix - ../modules/users - ../modules/users/alexander.nix - ../modules/programs/zsh ../modules/programs/mpv ../modules/programs/git ../modules/programs/tmux ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/nonvm - ../modules/programs/distributed-build/offload.nix +let + mkHost = import ../modules/host.nix { + config = config; + lib = lib; + pkgs = pkgs; + }; +in mkHost { + userName = "alexander"; + hostName = "ayame"; + wireless = true; + overlays = [ "nur" "unstable" ]; + hardwareImports = [ "intel" "wifi" "mobile" ]; + programImports = [ + "zsh" "mpv" "git" "tmux" "firefox" "gnome-terminal" "gnome" "nonvm" ]; - - nixpkgs.overlays = [ - # Unstable, NUR, ... - (import ../overlays/unstable.nix pkgs) - (import ../overlays/nur.nix pkgs) - (import ../overlays/custom.nix pkgs) + extraImports = [ "distributed-build/offload.nix" ]; + extraPackages = pkgs: with pkgs; [ + unstable.firmwareLinuxNonFree unstable.sof-firmware ]; - - environment = { - systemPackages = with pkgs; [ - unstable.firmwareLinuxNonfree - sof-firmware - ]; - }; - - # Disable dhcpcd as NetworkManager will do it for us - networking = { - interfaces.wlan0.useDHCP = false; - hostName = "ayame"; - }; - - boot = { - loader = { - efi.canTouchEfiVariables = false; - grub = { - enable = true; - efiInstallAsRemovable = true; - device = "nodev"; - efiSupport = true; - # The UEFI is pretty wonky - forcei686 = true; - }; - }; - extraModprobeConfig = ""; - initrd = { - availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ]; - kernelModules = [ - "kvm-intel" "i915" - ]; - }; - # This spams the console and takes up so much CPU time - kernelParams = [ "modprobe.blacklist=arizona_spi" ]; - kernelModules = []; - extraModulePackages = []; - kernelPackages = pkgs.linuxPackages_zen; - }; - - hardware = { - opengl = { - extraPackages = with pkgs; [ vaapiIntel intel-media-driver ]; - }; - }; - - services = { - xserver.videoDrivers = [ "modesetting" "fbdev" ]; - }; - - #systemd.services = { - # rfkill-workaround = { - # enable = true; - # description = "Work around rfkill having the Wifi blocked at boot"; - # before = [ "network.target" ]; - # wantedBy = [ "multi-user.target" ]; - # serviceConfig = { - # Type = "oneshot"; - # ExecStart = "rfkill unblock all"; - # }; - # }; - #}; - fileSystems = { "/" = { device = "/dev/disk/by-label/root"; @@ -93,4 +32,45 @@ swapDevices = [ { device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; } ]; + extraOptions = old: { + boot = { + loader = { + systemd-boot.enable = false; + efi.canTouchEfiVariables = false; + grub = { + enable = true; + efiInstallAsRemovable = true; + device = "nodev"; + efiSupport = true; + # The UEFI is pretty wonky + forcei686 = true; + }; + }; + extraModprobeConfig = ""; + initrd = { + availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ]; + kernelModules = [ + "kvm-intel" "i915" + ]; + }; + # This spams the console and takes up so much CPU time + kernelParams = [ "modprobe.blacklist=arizona_spi" ]; + kernelModules = []; + extraModulePackages = []; + kernelPackages = pkgs.linuxPackages_zen; + }; + + /*systemd.services = { + rfkill-workaround = { + enable = true; + description = "Work around rfkill having the Wifi blocked at boot"; + before = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "rfkill unblock all"; + }; + }; + };*/ + }; } diff --git a/hosts/generic.nix b/hosts/generic.nix deleted file mode 100644 index b875aa6..0000000 --- a/hosts/generic.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ config, lib, pkgs, python3Packages, ... }: - -let - home-manager = builtins.fetchGit { - url = "https://github.com/nix-community/home-manager.git"; - rev = "35a24648d155843a4d162de98c17b1afd5db51e4"; - ref = "release-21.05"; - }; -in -{ - # Install home-manager - imports = [ - "${home-manager}/nixos" - ../modules/users # For system.singleUser - ]; - home-manager.useGlobalPkgs = true; - - time.timeZone = "Europe/Berlin"; - - networking = { - useDHCP = false; # Done by the network manager - networkmanager.enable = false; - }; - - i18n.defaultLocale = "en_GB.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "de"; - }; - - users = { - mutableUsers = false; - - extraUsers = { - root = { - # Disable root login - hashedPassword = "*"; - }; - - # Users configured in vm.nix, nishimiya.nix or miku.nix - }; - }; - - environment = { - systemPackages = with pkgs; [ - htop - firejail - vim - git # Otherwise we cannot install home-manager - git-crypt - gnupg - python3 - ]; - - sessionVariables = { - # Prevent us from having to always type it out - NIXOS_CONFIG = "/home/${config.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix"; - }; - }; - - # We don't tolerate non-free software, except for Steam and Linux firmware - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "firmwareLinuxNonfree" "steam" "steam-original" "steam-runtime" "discord" ]; - - services = { - connman = { - enable = true; - extraFlags = [ "--nodnsproxy" ]; - }; - - # TODO: Is this correct? Maybe run once - timesyncd.enable = false; - - printing.enable = lib.mkDefault false; - avahi.enable = false; - }; - - # To allow users to use firejail - programs.firejail.enable = true; - - security.sudo.extraConfig = '' - Defaults env_keep += "NIXOS_CONFIG" - ''; - - system.stateVersion = "21.05"; -} diff --git a/hosts/miku.nix b/hosts/miku.nix index 8744979..791bb01 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -1,157 +1,93 @@ -{ config, pkgs, modulesPath, lib, fetchGit, fetchFromGitHub, ... }: +{ config, lib, pkgs, ... }: -{ - imports = [ - ./generic.nix - ../modules/hardware/generic.nix ../modules/hardware/video.nix ../modules/hardware/desktop.nix - ../modules/fonts.nix - ../modules/users/alexander.nix - ../modules/programs/zsh ../modules/programs/git ../modules/programs/mpv ../modules/programs/tmux ../modules/programs/emacs ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/i18n.nix ../modules/programs/gamemode ../modules/programs/nonvm - ../modules/virtualisation/gaming.nix - ../modules/programs/distributed-build/builder.nix - ../modules/programs/music +let + mkHost = import ../modules/host.nix { + config = config; + lib = lib; + pkgs = pkgs; + }; +in mkHost { + userName = "alexander"; + hostName = "miku"; + overlays = [ "nur" "steam" "unstable" "simple" "custom" "emacs" ]; + hardwareImports = [ "amdgpu" ]; + programImports = [ + "zsh" "git" "mpv" "tmux" "emacs" "firefox" "gnome-terminal" "gnome" "i18n" "gamemode" "nonvm" + "distributed-build/builder.nix" + "music" ]; - - nixpkgs.overlays = [ - (import (builtins.fetchGit { - url = "https://github.com/nix-community/emacs-overlay.git"; - ref = "master"; - rev = "ce0e9482d53d69bedc8416d8a984d00e17607826"; - })) - - # Steam overlay - (import ../overlays/steam.nix { - pkgs = pkgs; - lib = lib; - }) - - # Simple overrides - (final: prev: let - # NOTE: For some reason --fs-screen-name and --screen-name are not in - # 0.33.1. So wait and then remove this. - mpv-git = prev.mpv-unwrapped.overrideAttrs (old: { - version = "0.34.0"; - src = builtins.fetchGit { - url = "https://github.com/mpv-player/mpv.git"; - ref = "master"; - rev = "0b56e1c00a57fdb767674462c299a5c973a9e373"; - }; - patches = []; - }); - in { - mpv = prev.wrapMpv mpv-git { - # Prevent the need for prefixing mpv with DRI_PRIME=1 - extraMakeWrapperArgs = [ - "--set" "DRI_PRIME" "1" - ]; - }; - - gajim = prev.gajim.overrideAttrs (old: { - # Enable notification sounds - propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ]; - }); - - animedl = prev.animedl.overrideAttrs (old: { - extraPkgs = pkgs: with pkgs; [ mpv ]; - }); - }) - - # Unstable, NUR, ... - (import ../overlays/unstable.nix pkgs) - (import ../overlays/nur.nix pkgs) - (import ../overlays/custom.nix pkgs) - ]; - - security = { - pam.loginLimits = [ - { - domain = "@gamemode"; - item = "-"; - type = "nice"; - value = "-10"; - } - ]; - wrappers = { - gamemoded = { - source = "${pkgs.gamemode}/bin/gamemoded"; - capabilities = "cap_sys_nice+ep"; - }; + extraImports = [ "virtualisation/gaming.nix" ]; + fileSystems = { + "/" = { + device = "/dev/disk/by-label/root"; + fsType = "btrfs"; + }; + "/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + "/mnt/Storage" = { + device = "/dev/disk/by-label/storage"; + fsType = "ext4"; }; }; - - environment = { - systemPackages = with pkgs; [ - emacsPgtkGcc - unstable.firmwareLinuxNonfree - gajim - virt-manager unstable.qemu scream - gamemode # Custom package - key-mapper # Custom package - replaysorcery # Custom package - evdev-proxy # Custom package - vfio-isolate # Custom Package - steam - discord-system-electron-wrapped # Custom package - discord-wrapper # Custom package - superpaper # Custom package - mumble - ]; - }; - - programs.mpv.primaryScreen = "C27F398"; - - networking = { - interfaces.enp6s0.useDHCP = false; - hostName = "miku"; - # Nix otherwise has a conflict with this option - wireless.enable = lib.mkForce false; + extraPackages = pkgs: with pkgs; [ + emacsPgtkGcc + gajim + virt-manager unstable.qemu scream + gamemode # Custom package + key-mapper # Custom package + replaysorcery # Custom package + evdev-proxy # Custom package + vfio-isolate # Custom Package + steam + discord-system-electron-wrapped # Custom package + discord-wrapper # Custom package + superpaper # Custom package + mumble + piper + ]; + extraOptions = old: { + programs.mpv.primaryScreen = "C27F398"; + # TODO: Move to virtualisation/gaming.nix # Allow scream to connect to this host - firewall.allowedUDPPorts = [ 4010 ]; - }; + networking.firewall.allowedUDPPorts = [ 4010 ]; - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - extraModprobeConfig = '' - options kvm_amd nested=1 - options vfio-pci ids=1002:67df,1002:aaf0 - ''; - initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ]; - kernelModules = [ - "amdgpu" # GPU (duh) - "kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt - "uinput" # key-mapper - "vendor-reset" + boot = { + extraModprobeConfig = '' + options kvm_amd nested=1 + options vfio-pci ids=1002:67df,1002:aaf0 + ''; + initrd = { + availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ]; + kernelModules = [ + "amdgpu" # GPU (duh) + "kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt + "uinput" # key-mapper + "vendor-reset" + ]; + }; + kernelParams = [ + "amd_iommu=on" + "iommu=pt" + "sysrq_always_enabled=1" + "kvm.ignore_msrs=1" + "kvm.report_ignored_msrs=N" + "fbcon=rotate:1" + "quiet" ]; + extraModulePackages = [ pkgs.linuxPackages.vendor-reset ]; + # NOTE: A regression appears to have happend between 5.10 and 5.12 + # which leads to the RX590 to have the fence fallback timer on + # sdma0 time out (whatever this means). Maybe bisect? + #kernelPackages = pkgs.linuxPackages_zen; }; - kernelParams = [ - "amd_iommu=on" - "iommu=pt" - "sysrq_always_enabled=1" - "kvm.ignore_msrs=1" - "kvm.report_ignored_msrs=N" - "fbcon=rotate:1" - "quiet" - ]; - kernelModules = []; - extraModulePackages = [ pkgs.linuxPackages.vendor-reset ]; - # NOTE: A regression appears to have happend between 5.10 and 5.12 - # which leads to the RX590 to have the fence fallback timer on - # sdma0 time out (whatever this means). Maybe bisect? - #kernelPackages = pkgs.linuxPackages_zen; - }; - - services = { - # NOTE: key-mapper has a dbus policy file that we need to include - dbus.packages = [ pkgs.key-mapper ]; - emacs.package = pkgs.emacsPgtkGcc; - flatpak.enable = true; - xserver.videoDrivers = [ "amdgpu" ]; - udev.extraRules = '' + services = { + ratbagd.enable = true; + flatpak.enable = true; + # TODO: Move to hardware/ and the respective custom package + udev.extraRules = '' KERNEL=="uinput", GROUP="input" # This rule allows the input group to access /dev/uinput device to create virtual input devices @@ -159,17 +95,28 @@ # Create rules for your virtual devices to get persistent names KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="EvdevProxy*", SYMLINK+="input/by-id/virtual-event-$attr{name}" - ''; - - sshd.enable = true; - }; - - systemd = { - services = { - NetworkManager-wait-online.enable = false; + ''; }; - user.services = { + security = { + pam.loginLimits = [ + { + domain = "@gamemode"; + item = "-"; + type = "nice"; + value = "-10"; + } + ]; + wrappers = { + gamemoded = { + source = "${pkgs.gamemode}/bin/gamemoded"; + capabilities = "cap_sys_nice+ep"; + }; + }; + }; + + # TODO: Move into modules + systemd.user.services = { scream = { description = "Audio receiver for the Scream virtual network sound card"; #wantedBy = [ "default.target" ]; @@ -237,20 +184,4 @@ }; }; }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-label/root"; - fsType = "btrfs"; - }; - "/boot" = { - device = "/dev/disk/by-label/boot"; - fsType = "vfat"; - }; - "/mnt/Storage" = { - device = "/dev/disk/by-label/storage"; - fsType = "ext4"; - }; - }; - swapDevices = [ ]; } diff --git a/modules/hardware/amdgpu.nix b/modules/hardware/amdgpu.nix new file mode 100644 index 0000000..991934a --- /dev/null +++ b/modules/hardware/amdgpu.nix @@ -0,0 +1,11 @@ +{ + pkgs, ... +}: + +{ + environment.systemPackages = with pkgs; [ + unstable.mesa + unstable.firmwareLinuxNonfree + ]; + services.xserver.videoDrivers = [ "amdgpu" ]; +} diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix deleted file mode 100644 index fb6a06a..0000000 --- a/modules/hardware/bluetooth.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - hardware.bluetooth.enable = true; -} diff --git a/modules/hardware/desktop.nix b/modules/hardware/desktop.nix deleted file mode 100644 index 20cc913..0000000 --- a/modules/hardware/desktop.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ piper ]; - - services.ratbagd.enable = true; -} diff --git a/modules/hardware/generic.nix b/modules/hardware/generic.nix deleted file mode 100644 index eade124..0000000 --- a/modules/hardware/generic.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib, pkgs, ... }: - -{ - environment.systemPackages = [ pkgs.rtkit ]; - # NOTE: This assumes that the devices are x86_64 (cough i686 UEFI cough) - hardware = { - enableRedistributableFirmware = true; - # This is a Pipewire household! - pulseaudio.enable = false; - - opengl = { - enable = true; - driSupport32Bit = true; - driSupport = true; - extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ]; - }; - - # Only a subset of my devices have bluetooth - #bluetooth.enable = lib.mkDefault false; - }; - - services = { - # Everyone needs sound - pipewire = { - enable = true; - pulse.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - }; - - # On desktop: Monitor keyboards, mice, ... - # On portable devices: Monitor their battery - upower.enable = true; - - # What generated entropy? - haveged.enable = true; - }; -} diff --git a/modules/hardware/intel.nix b/modules/hardware/intel.nix new file mode 100644 index 0000000..52fcada --- /dev/null +++ b/modules/hardware/intel.nix @@ -0,0 +1,9 @@ +{ + pkgs, ... +}: + +{ + hardware.opengl.extraPackages = with pkgs; [ vaapiIntel intel-media-driver ]; + # TODO: Remove? + services.xserver.videoDrivers = [ "modesetting" "fbdev" ]; +} diff --git a/modules/hardware/video.nix b/modules/hardware/video.nix deleted file mode 100644 index 0d0de3f..0000000 --- a/modules/hardware/video.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ unstable.mesa ]; -} diff --git a/modules/hardware/wifi.nix b/modules/hardware/wifi.nix index 7d265fd..5c0e3dc 100644 Binary files a/modules/hardware/wifi.nix and b/modules/hardware/wifi.nix differ diff --git a/modules/host.nix b/modules/host.nix new file mode 100644 index 0000000..cc86cd8 --- /dev/null +++ b/modules/host.nix @@ -0,0 +1,168 @@ +{ config, lib, pkgs, ... }: + +{ + userName +, hostName +, wireless ? false +, overlays ? [] +, hardwareImports ? [ "generic" ] +, programImports ? [] +, extraImports ? [] +, fileSystems +, swapDevices ? [] +, extraPackages ? pkgs: [] +, extraOptions ? old: {} +}: + +let + overlaysSet = import ../overlays { pkgs = pkgs; lib = lib; }; + home-manager = builtins.fetchGit { + url = "https://github.com/nix-community/home-manager.git"; + rev = "35a24648d155843a4d162de98c17b1afd5db51e4"; + ref = "release-21.05"; + }; + baseConfig = { + # Install home-manager + imports = [ + "${home-manager}/nixos" + ./users # For system.singleUser + (./users + "/${userName}.nix") + ] ++ (map (item: ./programs + "/${item}") programImports) + ++ (map (item: ./hardware + "/${item}.nix") hardwareImports) + ++ (map (item: ./. + "/${item}") extraImports); + home-manager.useGlobalPkgs = true; + + nixpkgs.overlays = (map (item: lib.getAttr item overlaysSet) overlays); + + time.timeZone = "Europe/Berlin"; + networking = { + useDHCP = false; # Done by the network manager + networkmanager.enable = false; + + #interfaces.*.useDHCP = false; + + hostName = hostName; + wireless.enable = (if wireless then true else lib.mkForce false); + }; + + i18n.defaultLocale = "en_GB.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "de"; + }; + + users = { + mutableUsers = false; + + extraUsers = { + root = { + # Disable root login + hashedPassword = "*"; + }; + }; + }; + + environment = { + systemPackages = with pkgs; [ + htop + vim + git # Otherwise we cannot install home-manager + git-crypt + gnupg + python3 + + # CJK fonts + source-han-sans source-han-serif + + # RT scheduling + rtkit + ] ++ extraPackages pkgs; + + sessionVariables = { + # Prevent us from having to always type it out + NIXOS_CONFIG = "/home/${config.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix"; + }; + }; + + # We don't tolerate non-free software, except for Steam and Linux firmware + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "firmwareLinuxNonfree" + "steam" "steam-original" "steam-runtime" + "discord" + ]; + + services = { + connman = { + enable = true; + extraFlags = [ "--nodnsproxy" ]; + + wifi = lib.mkIf wireless { + # TODO: Maybe try out iwd + backend = "wpa_supplicant"; + }; + }; + + # TODO: Is this correct? Maybe run once + timesyncd.enable = false; + + # Everyone needs sound + pipewire = { + enable = true; + pulse.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + }; + + # On desktop: Monitor keyboards, mice, ... + # On portable devices: Monitor their battery + upower.enable = true; + + # What generated entropy? + haveged.enable = true; + + printing.enable = lib.mkDefault false; + avahi.enable = false; + + # For debugging. + # TODO: Lock to known IPs and keys + sshd.enable = true; + }; + + # Don't wait for a network connection + systemd.services.NetworkManager-wait-online.enable = false; + + security.sudo.extraConfig = '' + Defaults env_keep += "NIXOS_CONFIG" + ''; + + hardware = { + enableRedistributableFirmware = true; + # This is a Pipewire household! + pulseaudio.enable = false; + + opengl = { + enable = true; + driSupport32Bit = true; + driSupport = true; + extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ]; + }; + + # Only a subset of my devices have bluetooth + bluetooth = lib.mkIf wireless { + enable = true; + }; + }; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; + + fileSystems = fileSystems; + swapDevices = swapDevices; + + system.stateVersion = "21.05"; + }; +in lib.attrsets.recursiveUpdate baseConfig (extraOptions baseConfig) diff --git a/modules/programs/emacs/default.nix b/modules/programs/emacs/default.nix index ee737bd..2c8ed90 100644 --- a/modules/programs/emacs/default.nix +++ b/modules/programs/emacs/default.nix @@ -1,7 +1,9 @@ -{ config, ... }: +{ config, pkgs, ... }: { - config.home-manager.users."${config.system.singleUser}".home.file = { + services.emacs.package = pkgs.emacsPgtkGcc; + + home-manager.users."${config.system.singleUser}".home.file = { ".emacs".source = ./dotemacs; ".emacs.d/early-init.el".source = ./early-init.el; ".emacs.d/mu4e.el".source = ./mu4e.el; diff --git a/modules/programs/emacs/dotemacs b/modules/programs/emacs/dotemacs index bd0a7e9..53c5a1b 100644 --- a/modules/programs/emacs/dotemacs +++ b/modules/programs/emacs/dotemacs @@ -259,12 +259,29 @@ (setq mode-line-format saved-mode-line-format) (redraw-display)))) +;; Development +(use-package tide + :straight t + :config + (defun setup-tide-mode () + (interactive) + (tide-setup) + (tide-hl-identifier-mode +1)) + (add-hook 'typescript-mode-hook #'setup-tide-mode) + (add-hook 'web-mode-hook + (lambda () + (when (string-equal "tsx" (file-name-extension buffer-file-name)) + (setup-tide-mode)))) + (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))) (use-package nix-mode :straight t) (use-package json-mode :straight t) +(use-package rust-mode + :straight t) + ;; Debugging (use-package explain-pause-mode :straight diff --git a/modules/programs/i18n.nix b/modules/programs/i18n/default.nix similarity index 100% rename from modules/programs/i18n.nix rename to modules/programs/i18n/default.nix diff --git a/modules/programs/music/default.nix b/modules/programs/music/default.nix index 0539c04..187a021 100644 --- a/modules/programs/music/default.nix +++ b/modules/programs/music/default.nix @@ -1,24 +1,28 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ - environment.systemPackages = with pkgs; [ - mpdevil - mopidy mopidy-mpd mopidy-funkwhale - ]; +let + secrets = import ../../../secrets; + funkwhale = secrets.funkwhale.applications."${config.networking.hostName}"; +in { + config = { + environment.systemPackages = with pkgs; [ cantata ]; - # TODO - services.mopidy = { - enable = true; - configuration = '' -[funkwhale] -enabled = true -url = https://audio.polynom.me -client_id = -client_secret = -cache_duration = 600 + services.mopidy = { + #enable = true; + configuration = '' + [funkwhale] + enabled = true + url = https://audio.polynom.me + client_id = ${funkwhale.client_id} + client_secret = ${funkwhale.client_secret} + cache_duration = 600 + + [mpd] + enabled = true; ''; - extensionPackages = with pkgs; [ - mopidy-mpd mopidy-funkwhale - ]; + extensionPackages = with pkgs; [ + mopidy-mpd mopidy-funkwhale + ]; + }; }; } diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..1e7e42f --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,17 @@ +{ + pkgs +, lib +}: + +{ + emacs = import (builtins.fetchGit { + url = "https://github.com/nix-community/emacs-overlay.git"; + ref = "master"; + rev = "ce0e9482d53d69bedc8416d8a984d00e17607826"; + }); + steam = import ./steam.nix { pkgs = pkgs; lib = lib; }; + nur = import ./nur.nix pkgs; + unstable = import ./unstable.nix pkgs; + custom = import ./custom.nix pkgs; + simple = import ./simple.nix pkgs; +} diff --git a/overlays/simple.nix b/overlays/simple.nix new file mode 100644 index 0000000..9ea2236 --- /dev/null +++ b/overlays/simple.nix @@ -0,0 +1,31 @@ +pkgs: final: prev: + +let + # NOTE: For some reason --fs-screen-name and --screen-name are not in + # 0.33.1. So wait and then remove this. + mpv-git = prev.mpv-unwrapped.overrideAttrs (old: { + version = "0.34.0"; + src = builtins.fetchGit { + url = "https://github.com/mpv-player/mpv.git"; + ref = "master"; + rev = "0b56e1c00a57fdb767674462c299a5c973a9e373"; + }; + patches = []; + }); +in { + mpv = prev.wrapMpv mpv-git { + # Prevent the need for prefixing mpv with DRI_PRIME=1 + extraMakeWrapperArgs = [ + "--set" "DRI_PRIME" "1" + ]; + }; + + gajim = prev.gajim.overrideAttrs (old: { + # Enable notification sounds + propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ]; + }); + + animedl = prev.animedl.overrideAttrs (old: { + extraPkgs = pkgs: with pkgs; [ mpv ]; + }); +}