diff --git a/system/base.nix b/system/base.nix index aa55cee..8301dd4 100644 --- a/system/base.nix +++ b/system/base.nix @@ -1,7 +1,90 @@ -{ config, lib, pkgs, ...}: +{ config, lib, pkgs, options, inputs, ...}@args: +let + cfg = config.nixfiles.profile.base; +in { - imports = [ - ./fragments/base.nix - ./fragments/me.nix + options.nixfiles.profile.base = { + enable = lib.mkEnableOption "base config"; + }; + # TODO was gonna add something but i forgor and now i'm too lazy + # to delete this + config = lib.mkMerge [ + (lib.mkIf cfg.enable { + + # Enable my account + nixfiles.common.me = lib.mkDefault true; + + # locale settings + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ALL = "en_US.UTF-8"; + }; + }; + + # Enable flakes + nix.settings.experimental-features = ["nix-command" "flakes" ]; + + # fallback to building locally if binary cache fails (home-manager should be + # able to handle simple rebuilds offline) + nix.settings.fallback = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = lib.mkDefault true; # Easiest to use and most distros use this by default. + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + curl + git + git-lfs + stow + zsh + ntfs3g + openssh + sshfs + file + + fd + ripgrep + sbctl # TODO move this elsewhere + comma + nil + + # network utilities + inetutils + socat + nmap + hping + + # system utilities + htop + lshw + pciutils + ]; + + # this makes comma and legacy nix utils use the flake nixpkgs for ABI + # compatibility becasue once `, vkcube` couldn't find the correct opengl + # driver or something (also it reduces the download size of temporary shell + # closures) + nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default; + + programs.ssh.enableAskPassword = false; + programs.fuse.userAllowOther = true; + + programs.gnupg.agent = { + enable = lib.mkDefault true; + enableSSHSupport = lib.mkDefault true; + }; + + boot.loader.systemd-boot.configurationLimit = lib.mkDefault 15; + }) ]; } diff --git a/system/default.nix b/system/default.nix index 0927272..09dcd6a 100644 --- a/system/default.nix +++ b/system/default.nix @@ -4,7 +4,6 @@ let in { imports = [ - ./temp-new ]; config = {}; options.nixfiles = { diff --git a/system/desktop-common.nix b/system/desktop-common.nix index 49aa07e..6449a28 100644 --- a/system/desktop-common.nix +++ b/system/desktop-common.nix @@ -1,37 +1,58 @@ { config, lib, pkgs, outputs, ...}: - +let + cfg = config.nixfiles.common.desktop; + inherit (lib) mkIf mkDefault mkForce mkEnableOption; +in { - imports = [ - ./base.nix - ./fragments/sound.nix - ./fragments/multimedia.nix - ./fragments/software/syncthing.nix - ./fragments/hardware/bluetooth.nix - ]; - - # Enable the X11 windowing system. - services.xserver.enable = true; + # imports = [ + # ./base.nix + # ./fragments/sound.nix + # ./fragments/multimedia.nix + # ./fragments/software/syncthing.nix + # ./fragments/hardware/bluetooth.nix + # ]; - environment.systemPackages = with pkgs; [ - arc-theme - wl-clipboard - ]; + options.nixfiles.common.desktop = { + enable = mkEnableOption "common desktop options"; + }; - # Enable flatpak - services.flatpak.enable = true; + config = mkIf cfg.enable { + # enable option sets + nixfiles = { + packageSets.multimedia.enable = true; + common = { + syncthing.enable = true; + bluetooth.enable = true; + sound.enable = true; + }; + }; - # Enable CUPS to print documents. - services.printing.enable = true; + # Enable the X11 windowing system. + services.xserver.enable = true; - fonts.packages = with pkgs; [ - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - noto-fonts-cjk - (outputs.packages.${pkgs.system}.google-fonts.override { fonts = [ "NovaSquare" ];}) - ]; - - users.users.nullbite = { - packages = with pkgs; [ - firefox + environment.systemPackages = with pkgs; [ + arc-theme + wl-clipboard ]; + + # Enable flatpak + services.flatpak.enable = mkDefault true; + + # Enable CUPS to print documents. + services.printing.enable = mkDefault true; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + noto-fonts-cjk + (outputs.packages.${pkgs.system}.google-fonts.override { fonts = [ "NovaSquare" ];}) + ]; + + # TODO this should be defined in home-manager or not at all probably + # FIXME also my name is hardcoded + users.users.nullbite = { + packages = with pkgs; [ + firefox + ]; + }; }; } diff --git a/system/fragments/base.nix b/system/fragments/base.nix deleted file mode 100644 index de4d18b..0000000 --- a/system/fragments/base.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ config, lib, pkgs, options, inputs, ...}@args: -{ - # locale settings - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ALL = "en_US.UTF-8"; - }; - }; - - # Enable flakes - nix.settings.experimental-features = ["nix-command" "flakes" ]; - - # fallback to building locally if binary cache fails (home-manager should be - # able to handle simple rebuilds offline) - nix.settings.fallback = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = lib.mkDefault true; # Easiest to use and most distros use this by default. - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - curl - git - git-lfs - stow - zsh - ntfs3g - openssh - sshfs - file - - fd - ripgrep - sbctl # TODO move this elsewhere - comma - nil - - # network utilities - inetutils - socat - nmap - hping - - # system utilities - htop - lshw - pciutils - ]; - - # this makes comma and legacy nix utils use the flake nixpkgs for ABI - # compatibility becasue once `, vkcube` couldn't find the correct opengl - # driver or something (also it reduces the download size of temporary shell - # closures) - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default; - - programs.ssh.enableAskPassword = false; - programs.fuse.userAllowOther = true; - - programs.gnupg.agent = { - enable = lib.mkDefault true; - enableSSHSupport = lib.mkDefault true; - }; - - boot.loader.systemd-boot.configurationLimit = lib.mkDefault 15; -} diff --git a/system/fragments/cli-multimedia.nix b/system/fragments/cli-multimedia.nix deleted file mode 100644 index 370aac0..0000000 --- a/system/fragments/cli-multimedia.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, lib, pkgs, ...}: -{ - environment.systemPackages = with pkgs; [ - yt-dlp - imagemagick - ffmpeg - ]; -} diff --git a/system/fragments/hardware/bluetooth.nix b/system/fragments/hardware/bluetooth.nix index dd84452..1a8c7fb 100644 --- a/system/fragments/hardware/bluetooth.nix +++ b/system/fragments/hardware/bluetooth.nix @@ -1,7 +1,16 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.common.bluetooth; +in { - hardware.bluetooth = { - enable = lib.mkDefault true; - powerOnBoot = lib.mkDefault true; + options.nixfiles.common.bluetooth = { + enable = lib.mkEnableOption "Bluetooth"; + }; + + config = lib.mkIf cfg.enable { + hardware.bluetooth = { + enable = lib.mkDefault true; + powerOnBoot = lib.mkDefault true; + }; }; } diff --git a/system/fragments/hardware/nvidia-modeset.nix b/system/fragments/hardware/nvidia-modeset.nix index 2f9c44b..1011b96 100644 --- a/system/fragments/hardware/nvidia-modeset.nix +++ b/system/fragments/hardware/nvidia-modeset.nix @@ -1,37 +1,47 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.common.nvidia; +in { - imports = [ - ../opengl.nix - ]; + # imports = [ + # ../opengl.nix + # ]; # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; + options.nixfiles.common.nvidia = { + modesetting.enable = lib.mkEnableOption "NVIDIA configuration with modesetting"; + }; + config = lib.mkIf cfg.modesetting.enable { + services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia = { + nixfiles.common.opengl.enable = true; - # Modesetting is required. - modesetting.enable = lib.mkDefault true; + hardware.nvidia = { - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = lib.mkDefault false; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = lib.mkDefault false; + # Modesetting is required. + modesetting.enable = lib.mkDefault true; - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = lib.mkDefault false; + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + powerManagement.enable = lib.mkDefault false; + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = lib.mkDefault false; - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = lib.mkDefault true; + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = lib.mkDefault false; - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.production; + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = lib.mkDefault true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.production; + }; }; } diff --git a/system/fragments/me.nix b/system/fragments/me.nix index 5a74daa..c60924d 100644 --- a/system/fragments/me.nix +++ b/system/fragments/me.nix @@ -1,20 +1,25 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.common.me; +in { - users.users.nullbite = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ - keychain - ]; - initialPassword = "changeme"; - shell = pkgs.zsh; - }; + options.nixfiles.common.me = lib.mkEnableOption "my user account"; + config = lib.mkIf cfg.enable { + users.users.nullbite = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + keychain + ]; + initialPassword = "changeme"; + shell = pkgs.zsh; + }; - # shell config - programs.zsh.enable = true; - programs.fzf = { - keybindings = true; - fuzzyCompletion = true; + # shell config + programs.zsh.enable = true; + programs.fzf = { + keybindings = true; + fuzzyCompletion = true; + }; }; - } diff --git a/system/fragments/multimedia.nix b/system/fragments/multimedia.nix index 7120919..ab6f5fc 100644 --- a/system/fragments/multimedia.nix +++ b/system/fragments/multimedia.nix @@ -1,8 +1,22 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.packageSets.multimedia; + inherit (lib) optionals mkEnableOption mkIf; +in { - imports = [ ./cli-multimedia.nix ]; - environment.systemPackages = with pkgs; [ - mpv - gimp-with-plugins - ]; + options.nixfiles.packageSets.multimedia = { + enable = mkEnableOption "multimedia packages"; + }; + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; optionals config.services.xserver.enable [ + mpv + gimp-with-plugins + krita + inkscape + ] ++ [ + yt-dlp + imagemagick + ffmpeg + ]; + }; } diff --git a/system/fragments/opengl.nix b/system/fragments/opengl.nix index 79ee5d2..afad162 100644 --- a/system/fragments/opengl.nix +++ b/system/fragments/opengl.nix @@ -1,11 +1,15 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.common.opengl; +in { - - # Enable OpenGL - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; + options.nixfiles.common.opengl.enable = lib.mkEnableOption "OpenGL configuration"; + config = lib.mkIf cfg.enable { + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = lib.mkDefault true; + driSupport32Bit = lib.mkDefault config.hardware.opengl.driSupport; + }; }; - } diff --git a/system/fragments/software/syncthing.nix b/system/fragments/software/syncthing.nix index da6d2da..e17fad4 100644 --- a/system/fragments/software/syncthing.nix +++ b/system/fragments/software/syncthing.nix @@ -1,9 +1,19 @@ { config, lib, pkgs, ...}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nixfiles.programs.syncthing; +in { - services.syncthing = { - enable = lib.mkDefault true; - user = lib.mkDefault "nullbite"; - dataDir = lib.mkDefault "/home/nullbite/Documents"; - configDir = lib.mkDefault "/home/nullbite/.config/syncthing"; + options.nixfiles.programs.syncthing = { + enable = mkEnableOption "Syncthing configuration"; + }; + + config = mkIf cfg.enable { + services.syncthing = { + enable = lib.mkDefault true; + user = lib.mkDefault "nullbite"; + dataDir = lib.mkDefault "/home/nullbite/Documents"; + configDir = lib.mkDefault "/home/nullbite/.config/syncthing"; + }; }; } diff --git a/system/fragments/sound.nix b/system/fragments/sound.nix index a4e606a..cf52088 100644 --- a/system/fragments/sound.nix +++ b/system/fragments/sound.nix @@ -1,22 +1,34 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.common.sound; + inherit (lib) mkEnableOption mkIf mkDefault; +in { # Enable sound. # sound.enable = true; # hardware.pulseaudio.enable = true; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; + + options.nixfiles.common.sound = { + enable = mkEnableOption "sound configuration"; + }; + + config = mkIf cfg.enable { + security.rtkit.enable = mkDefault true; + services.pipewire = { + enable = true; + alsa.enable = mkDefault true; + alsa.support32Bit = mkDefault config.services.pipewire.alsa.enable; + pulse.enable = mkDefault true; + jack.enable = mkDefault true; + }; + + environment.systemPackages = with pkgs; [ + qpwgraph + easyeffects + ] ++ optionals config.services.pipewire.pulse.enable [ + pavucontrol + ncpamixer + pulsemixer + ]; }; - - environment.systemPackages = with pkgs; [ - qpwgraph - pavucontrol - ncpamixer - pulsemixer - easyeffects - ]; } diff --git a/system/gaming.nix b/system/gaming.nix index 258d158..a332b65 100644 --- a/system/gaming.nix +++ b/system/gaming.nix @@ -1,32 +1,40 @@ { config, lib, pkgs, ...}: +let + cfg = config.nixfiles.packageSets.gaming; +in { # oopsies this is for home-manager # programs.mangohud.enable = lib.mkDefault true; - programs.steam = { - enable = lib.mkDefault true; - gamescopeSession = { + options.nixfiles.packageSets.gaming = { + enable = lib.mkEnableOption "gaming package set"; + }; + config = lib.mkIf cfg.enable { + programs.steam = { enable = lib.mkDefault true; + gamescopeSession = { + enable = lib.mkDefault true; + }; }; - }; - programs.gamemode = { - enable = lib.mkDefault true; - enableRenice = lib.mkDefault true; - }; + programs.gamemode = { + enable = lib.mkDefault true; + enableRenice = lib.mkDefault true; + }; - programs.gamescope = { - enable = lib.mkDefault true; - capSysNice = lib.mkDefault false; - }; + programs.gamescope = { + enable = lib.mkDefault true; + capSysNice = lib.mkDefault false; + }; - environment.systemPackages = with pkgs; [ - mangohud - goverlay - prismlauncher - glxinfo - vulkan-tools - legendary-gl - heroic - ]; + environment.systemPackages = with pkgs; [ + mangohud + goverlay + prismlauncher + glxinfo + vulkan-tools + legendary-gl + heroic + ]; + }; } diff --git a/system/hyprland.nix b/system/hyprland.nix index a71426e..a9a9598 100644 --- a/system/hyprland.nix +++ b/system/hyprland.nix @@ -1,35 +1,45 @@ { lib, pkgs, config, ... }: +let + cfg = config.nixfiles.sessions.hyprland; +in { - imports = [ - ./desktop-common.nix - # FIXME make this into an option - ./wm-common.nix - ]; + # imports = [ + # ./desktop-common.nix + # # FIXME make this into an option + # ./wm-common.nix + # ]; - services.xserver.displayManager.sddm.enable = true; - - programs.hyprland = { - enable = true; - enableNvidiaPatches = true; - xwayland.enable = true; + options.nixfiles.sessions.hyprland = { + enable = lib.mkEnableOption "hyprland configuration"; }; - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk + config = lib.mkIf cfg.enable { + services.xserver.displayManager.sddm.enable = true; + + programs.hyprland = { + enable = true; + # TODO base this on if nvidia is enabled + enableNvidiaPatches = lib.mkDefault true; + xwayland.enable = true; + }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + ]; + }; + + environment.systemPackages = with pkgs; [ + kitty + dunst + polkit-kde-agent + eww + hyprpaper + rofi + hyprpicker + udiskie + polkit-kde-agent ]; }; - - environment.systemPackages = with pkgs; [ - kitty - dunst - polkit-kde-agent - eww - hyprpaper - rofi - hyprpicker - udiskie - polkit-kde-agent - ]; } diff --git a/system/fragments/README.md b/system/new-fragments/README.md similarity index 100% rename from system/fragments/README.md rename to system/new-fragments/README.md diff --git a/system/android.nix b/system/new-fragments/android.nix similarity index 100% rename from system/android.nix rename to system/new-fragments/android.nix diff --git a/system/debugging.nix b/system/new-fragments/debugging.nix similarity index 100% rename from system/debugging.nix rename to system/new-fragments/debugging.nix diff --git a/system/plasma.nix b/system/plasma.nix index 5e69c8d..f1dc0f4 100644 --- a/system/plasma.nix +++ b/system/plasma.nix @@ -2,38 +2,48 @@ let sleep = "${pkgs.coreutils}/bin/sleep"; systemctl = "${pkgs.systemd}/bin/systemctl"; + inherit (lib) mkIf mkEnableOption mkForce mkDefault; + cfg = config.nixfiles.session.plasma; in { - imports = [ - ./desktop-common.nix - ]; + # imports = [ + # ./desktop-common.nix + # ]; - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - services.xserver.displayManager.defaultSession = "plasmawayland"; - programs.kdeconnect.enable = true; - - systemd.user = { - services.restart-xdg-desktop-portal-kde = { - enable = true; - description = "hack to fix xdg-desktop-portal on kde"; - wantedBy = [ "graphical-session.target" ]; - after = [ "plasma-core.target" "xdg-desktop-portal.service" ]; - requisite = [ "plasma-core.target" ]; - - serviceConfig = { - ExecStart = [ - "${sleep} 5" - "${systemctl} --user restart xdg-desktop-portal.service" - ]; - Type = "oneshot"; - RemainAfterExit = "yes"; - }; - }; + options.nixfiles.session.plasma = { + enable = mkEnableOption "KDE Plasma session"; }; - environment.systemPackages = with pkgs; [ - # this fixes tiny file dialogs for Minecraft - libsForQt5.kdialog - ]; + config = mkIf cfg.enable { + nixfiles.common.desktop.enable = true; + + services.xserver.displayManager.sddm.enable = mkDefault true; + services.xserver.desktopManager.plasma5.enable = true; + services.xserver.displayManager.defaultSession = "plasmawayland"; + programs.kdeconnect.enable = mkDefault true; + + systemd.user = { + services.restart-xdg-desktop-portal-kde = { + enable = true; + description = "hack to fix xdg-desktop-portal on kde"; + wantedBy = [ "graphical-session.target" ]; + after = [ "plasma-core.target" "xdg-desktop-portal.service" ]; + requisite = [ "plasma-core.target" ]; + + serviceConfig = { + ExecStart = [ + "${sleep} 5" + "${systemctl} --user restart xdg-desktop-portal.service" + ]; + Type = "oneshot"; + RemainAfterExit = "yes"; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + # this fixes tiny file dialogs for Minecraft + libsForQt5.kdialog + ]; + }; } diff --git a/system/remote.nix b/system/remote.nix index 86d20e3..78acb17 100644 --- a/system/remote.nix +++ b/system/remote.nix @@ -1,16 +1,23 @@ { config, lib, pkgs, ... }: +with lib; let + cfg = config.nixfiles.common.remoteAccess; +in { - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - services.openssh = { - enable = true; - openFirewall = true; - settings = { + config = lib.mkIf cfg.enable { + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + services.openssh = { + enable = true; + openFirewall = true; + settings = { + }; }; + + services.tailscale.enable = true; + + networking.wireguard.enable = true; }; - - services.tailscale.enable = true; - - networking.wireguard.enable = true; + options = { + nixfiles.common.remoteAccess = mkEnbaleOption "remote access options" ; }; } diff --git a/system/temp-new/README.md b/system/temp-new/README.md deleted file mode 100644 index e91ba36..0000000 --- a/system/temp-new/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# system -This directory contains modules and configuration specific to my NixOS configuration. `default.nix` is the entrypoint to my module set; it can safely be loaded without making any configuration changes by default. diff --git a/system/temp-new/base.nix b/system/temp-new/base.nix deleted file mode 100644 index 8301dd4..0000000 --- a/system/temp-new/base.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ config, lib, pkgs, options, inputs, ...}@args: -let - cfg = config.nixfiles.profile.base; -in -{ - options.nixfiles.profile.base = { - enable = lib.mkEnableOption "base config"; - }; - # TODO was gonna add something but i forgor and now i'm too lazy - # to delete this - config = lib.mkMerge [ - (lib.mkIf cfg.enable { - - # Enable my account - nixfiles.common.me = lib.mkDefault true; - - # locale settings - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ALL = "en_US.UTF-8"; - }; - }; - - # Enable flakes - nix.settings.experimental-features = ["nix-command" "flakes" ]; - - # fallback to building locally if binary cache fails (home-manager should be - # able to handle simple rebuilds offline) - nix.settings.fallback = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = lib.mkDefault true; # Easiest to use and most distros use this by default. - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - curl - git - git-lfs - stow - zsh - ntfs3g - openssh - sshfs - file - - fd - ripgrep - sbctl # TODO move this elsewhere - comma - nil - - # network utilities - inetutils - socat - nmap - hping - - # system utilities - htop - lshw - pciutils - ]; - - # this makes comma and legacy nix utils use the flake nixpkgs for ABI - # compatibility becasue once `, vkcube` couldn't find the correct opengl - # driver or something (also it reduces the download size of temporary shell - # closures) - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default; - - programs.ssh.enableAskPassword = false; - programs.fuse.userAllowOther = true; - - programs.gnupg.agent = { - enable = lib.mkDefault true; - enableSSHSupport = lib.mkDefault true; - }; - - boot.loader.systemd-boot.configurationLimit = lib.mkDefault 15; - }) - ]; -} diff --git a/system/temp-new/default.nix b/system/temp-new/default.nix deleted file mode 100644 index 09dcd6a..0000000 --- a/system/temp-new/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, config, lib, options, ... }@args: -let - cfg = config.nixfiles; -in -{ - imports = [ - ]; - config = {}; - options.nixfiles = { - }; -} diff --git a/system/temp-new/desktop-common.nix b/system/temp-new/desktop-common.nix deleted file mode 100644 index 6449a28..0000000 --- a/system/temp-new/desktop-common.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, pkgs, outputs, ...}: -let - cfg = config.nixfiles.common.desktop; - inherit (lib) mkIf mkDefault mkForce mkEnableOption; -in -{ - # imports = [ - # ./base.nix - # ./fragments/sound.nix - # ./fragments/multimedia.nix - # ./fragments/software/syncthing.nix - # ./fragments/hardware/bluetooth.nix - # ]; - - options.nixfiles.common.desktop = { - enable = mkEnableOption "common desktop options"; - }; - - config = mkIf cfg.enable { - # enable option sets - nixfiles = { - packageSets.multimedia.enable = true; - common = { - syncthing.enable = true; - bluetooth.enable = true; - sound.enable = true; - }; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - environment.systemPackages = with pkgs; [ - arc-theme - wl-clipboard - ]; - - # Enable flatpak - services.flatpak.enable = mkDefault true; - - # Enable CUPS to print documents. - services.printing.enable = mkDefault true; - - fonts.packages = with pkgs; [ - (nerdfonts.override { fonts = [ "FiraCode" ]; }) - noto-fonts-cjk - (outputs.packages.${pkgs.system}.google-fonts.override { fonts = [ "NovaSquare" ];}) - ]; - - # TODO this should be defined in home-manager or not at all probably - # FIXME also my name is hardcoded - users.users.nullbite = { - packages = with pkgs; [ - firefox - ]; - }; - }; -} diff --git a/system/temp-new/fragments/hardware/bluetooth.nix b/system/temp-new/fragments/hardware/bluetooth.nix deleted file mode 100644 index 1a8c7fb..0000000 --- a/system/temp-new/fragments/hardware/bluetooth.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.common.bluetooth; -in -{ - options.nixfiles.common.bluetooth = { - enable = lib.mkEnableOption "Bluetooth"; - }; - - config = lib.mkIf cfg.enable { - hardware.bluetooth = { - enable = lib.mkDefault true; - powerOnBoot = lib.mkDefault true; - }; - }; -} diff --git a/system/temp-new/fragments/hardware/nvidia-modeset.nix b/system/temp-new/fragments/hardware/nvidia-modeset.nix deleted file mode 100644 index 1011b96..0000000 --- a/system/temp-new/fragments/hardware/nvidia-modeset.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.common.nvidia; -in -{ - # imports = [ - # ../opengl.nix - # ]; - - # Load nvidia driver for Xorg and Wayland - options.nixfiles.common.nvidia = { - modesetting.enable = lib.mkEnableOption "NVIDIA configuration with modesetting"; - }; - config = lib.mkIf cfg.modesetting.enable { - services.xserver.videoDrivers = ["nvidia"]; - - nixfiles.common.opengl.enable = true; - - hardware.nvidia = { - - # Modesetting is required. - modesetting.enable = lib.mkDefault true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = lib.mkDefault false; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = lib.mkDefault false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = lib.mkDefault false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = lib.mkDefault true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.production; - }; - }; -} diff --git a/system/temp-new/fragments/me.nix b/system/temp-new/fragments/me.nix deleted file mode 100644 index c60924d..0000000 --- a/system/temp-new/fragments/me.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.common.me; -in -{ - options.nixfiles.common.me = lib.mkEnableOption "my user account"; - config = lib.mkIf cfg.enable { - users.users.nullbite = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ - keychain - ]; - initialPassword = "changeme"; - shell = pkgs.zsh; - }; - - # shell config - programs.zsh.enable = true; - programs.fzf = { - keybindings = true; - fuzzyCompletion = true; - }; - }; -} diff --git a/system/temp-new/fragments/multimedia.nix b/system/temp-new/fragments/multimedia.nix deleted file mode 100644 index ab6f5fc..0000000 --- a/system/temp-new/fragments/multimedia.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.packageSets.multimedia; - inherit (lib) optionals mkEnableOption mkIf; -in -{ - options.nixfiles.packageSets.multimedia = { - enable = mkEnableOption "multimedia packages"; - }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; optionals config.services.xserver.enable [ - mpv - gimp-with-plugins - krita - inkscape - ] ++ [ - yt-dlp - imagemagick - ffmpeg - ]; - }; -} diff --git a/system/temp-new/fragments/opengl.nix b/system/temp-new/fragments/opengl.nix deleted file mode 100644 index afad162..0000000 --- a/system/temp-new/fragments/opengl.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.common.opengl; -in -{ - options.nixfiles.common.opengl.enable = lib.mkEnableOption "OpenGL configuration"; - config = lib.mkIf cfg.enable { - # Enable OpenGL - hardware.opengl = { - enable = true; - driSupport = lib.mkDefault true; - driSupport32Bit = lib.mkDefault config.hardware.opengl.driSupport; - }; - }; -} diff --git a/system/temp-new/fragments/software/syncthing.nix b/system/temp-new/fragments/software/syncthing.nix deleted file mode 100644 index e17fad4..0000000 --- a/system/temp-new/fragments/software/syncthing.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib, pkgs, ...}: -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nixfiles.programs.syncthing; -in -{ - options.nixfiles.programs.syncthing = { - enable = mkEnableOption "Syncthing configuration"; - }; - - config = mkIf cfg.enable { - services.syncthing = { - enable = lib.mkDefault true; - user = lib.mkDefault "nullbite"; - dataDir = lib.mkDefault "/home/nullbite/Documents"; - configDir = lib.mkDefault "/home/nullbite/.config/syncthing"; - }; - }; -} diff --git a/system/temp-new/fragments/sound.nix b/system/temp-new/fragments/sound.nix deleted file mode 100644 index cf52088..0000000 --- a/system/temp-new/fragments/sound.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.common.sound; - inherit (lib) mkEnableOption mkIf mkDefault; -in -{ - # Enable sound. - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - options.nixfiles.common.sound = { - enable = mkEnableOption "sound configuration"; - }; - - config = mkIf cfg.enable { - security.rtkit.enable = mkDefault true; - services.pipewire = { - enable = true; - alsa.enable = mkDefault true; - alsa.support32Bit = mkDefault config.services.pipewire.alsa.enable; - pulse.enable = mkDefault true; - jack.enable = mkDefault true; - }; - - environment.systemPackages = with pkgs; [ - qpwgraph - easyeffects - ] ++ optionals config.services.pipewire.pulse.enable [ - pavucontrol - ncpamixer - pulsemixer - ]; - }; -} diff --git a/system/temp-new/gaming.nix b/system/temp-new/gaming.nix deleted file mode 100644 index a332b65..0000000 --- a/system/temp-new/gaming.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, lib, pkgs, ...}: -let - cfg = config.nixfiles.packageSets.gaming; -in -{ - # oopsies this is for home-manager - # programs.mangohud.enable = lib.mkDefault true; - - options.nixfiles.packageSets.gaming = { - enable = lib.mkEnableOption "gaming package set"; - }; - config = lib.mkIf cfg.enable { - programs.steam = { - enable = lib.mkDefault true; - gamescopeSession = { - enable = lib.mkDefault true; - }; - }; - - programs.gamemode = { - enable = lib.mkDefault true; - enableRenice = lib.mkDefault true; - }; - - programs.gamescope = { - enable = lib.mkDefault true; - capSysNice = lib.mkDefault false; - }; - - environment.systemPackages = with pkgs; [ - mangohud - goverlay - prismlauncher - glxinfo - vulkan-tools - legendary-gl - heroic - ]; - }; -} diff --git a/system/temp-new/hyprland.nix b/system/temp-new/hyprland.nix deleted file mode 100644 index a9a9598..0000000 --- a/system/temp-new/hyprland.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ lib, pkgs, config, ... }: -let - cfg = config.nixfiles.sessions.hyprland; -in -{ - # imports = [ - # ./desktop-common.nix - # # FIXME make this into an option - # ./wm-common.nix - # ]; - - options.nixfiles.sessions.hyprland = { - enable = lib.mkEnableOption "hyprland configuration"; - }; - - config = lib.mkIf cfg.enable { - services.xserver.displayManager.sddm.enable = true; - - programs.hyprland = { - enable = true; - # TODO base this on if nvidia is enabled - enableNvidiaPatches = lib.mkDefault true; - xwayland.enable = true; - }; - - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - ]; - }; - - environment.systemPackages = with pkgs; [ - kitty - dunst - polkit-kde-agent - eww - hyprpaper - rofi - hyprpicker - udiskie - polkit-kde-agent - ]; - }; -} diff --git a/system/temp-new/new-fragments/README.md b/system/temp-new/new-fragments/README.md deleted file mode 100644 index 3031dac..0000000 --- a/system/temp-new/new-fragments/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Fragments -These are Nix modules which aim to configure only one aspect of the system. -This can include installing and configuring single programs such as Steam, -MangoHud, Syncthing, or OpenSSH, as well as setting generic options for certain -hardware setups, such as NVIDIA PRIME Offloading. - -## TODO -These are some fragments that I want to create: -- hardware/nvidia -- hardware/nvidia-supergfxd -- hardware/printing - - CUPS - - QZTray (maybe?) -- software/steam -- software/syncthing -- software/libreoffice -- software/ssh -- software/gnupg -- software/pam-gnupg (dep. software/gnupg) diff --git a/system/temp-new/new-fragments/android.nix b/system/temp-new/new-fragments/android.nix deleted file mode 100644 index 39a069c..0000000 --- a/system/temp-new/new-fragments/android.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, outputs, vars, ...}@args: -{ - imports = [ outputs.nixosModules.adb ]; - - config = { - programs.adb.enable = true; - users.users.${vars.username}.extraGroups = [ "adbusers" ]; - }; -} diff --git a/system/temp-new/new-fragments/debugging.nix b/system/temp-new/new-fragments/debugging.nix deleted file mode 100644 index 0bde8b4..0000000 --- a/system/temp-new/new-fragments/debugging.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ...}: -{ - environment = { - enableDebugInfo = true; - systemPackages = with pkgs; [ - gdb - ]; - }; -} diff --git a/system/temp-new/plasma.nix b/system/temp-new/plasma.nix deleted file mode 100644 index f1dc0f4..0000000 --- a/system/temp-new/plasma.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ config, lib, pkgs, ...}: -let - sleep = "${pkgs.coreutils}/bin/sleep"; - systemctl = "${pkgs.systemd}/bin/systemctl"; - inherit (lib) mkIf mkEnableOption mkForce mkDefault; - cfg = config.nixfiles.session.plasma; -in -{ - # imports = [ - # ./desktop-common.nix - # ]; - - options.nixfiles.session.plasma = { - enable = mkEnableOption "KDE Plasma session"; - }; - - config = mkIf cfg.enable { - nixfiles.common.desktop.enable = true; - - services.xserver.displayManager.sddm.enable = mkDefault true; - services.xserver.desktopManager.plasma5.enable = true; - services.xserver.displayManager.defaultSession = "plasmawayland"; - programs.kdeconnect.enable = mkDefault true; - - systemd.user = { - services.restart-xdg-desktop-portal-kde = { - enable = true; - description = "hack to fix xdg-desktop-portal on kde"; - wantedBy = [ "graphical-session.target" ]; - after = [ "plasma-core.target" "xdg-desktop-portal.service" ]; - requisite = [ "plasma-core.target" ]; - - serviceConfig = { - ExecStart = [ - "${sleep} 5" - "${systemctl} --user restart xdg-desktop-portal.service" - ]; - Type = "oneshot"; - RemainAfterExit = "yes"; - }; - }; - }; - - environment.systemPackages = with pkgs; [ - # this fixes tiny file dialogs for Minecraft - libsForQt5.kdialog - ]; - }; -} diff --git a/system/temp-new/remote.nix b/system/temp-new/remote.nix deleted file mode 100644 index 78acb17..0000000 --- a/system/temp-new/remote.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; let - cfg = config.nixfiles.common.remoteAccess; -in -{ - config = lib.mkIf cfg.enable { - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - services.openssh = { - enable = true; - openFirewall = true; - settings = { - - }; - }; - - services.tailscale.enable = true; - - networking.wireguard.enable = true; - }; - options = { - nixfiles.common.remoteAccess = mkEnbaleOption "remote access options" ; }; -} diff --git a/system/temp-new/wm-common.nix b/system/temp-new/wm-common.nix deleted file mode 100644 index d3bd487..0000000 --- a/system/temp-new/wm-common.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, lib, config, options, ...}: -let - inherit (lib) mkDefault mkIf mkEnableOption; - cfg = config.nixfiles.common.window-manager; -in -{ - config = mkIf cfg.enable { - # Common options for standalone window managers; many of these (or - # alternatives thereof) are pulled in by desktop environments. - services = { - power-profiles-daemon.enable = mkDefault true; - blueman.enable = mkDefault config.hardware.bluetooth.enable; - }; - programs = { - nm-applet.enable = mkDefault config.networking.networkmanager.enable; - }; - }; - options = { - nixfiles.common.window-manager.enable = mkEnableOption "common window manager configuration"; - }; -} diff --git a/system/wm-common.nix b/system/wm-common.nix index 606f19b..d3bd487 100644 --- a/system/wm-common.nix +++ b/system/wm-common.nix @@ -1,15 +1,21 @@ { pkgs, lib, config, options, ...}: let - inherit (lib) mkDefault; + inherit (lib) mkDefault mkIf mkEnableOption; + cfg = config.nixfiles.common.window-manager; in { - # Common options for standalone window managers; many of these (or - # alternatives thereof) are pulled in by desktop environments. - services = { - power-profiles-daemon.enable = mkDefault true; - blueman.enable = mkDefault config.hardware.bluetooth.enable; + config = mkIf cfg.enable { + # Common options for standalone window managers; many of these (or + # alternatives thereof) are pulled in by desktop environments. + services = { + power-profiles-daemon.enable = mkDefault true; + blueman.enable = mkDefault config.hardware.bluetooth.enable; + }; + programs = { + nm-applet.enable = mkDefault config.networking.networkmanager.enable; + }; }; - programs = { - nm-applet.enable = mkDefault config.networking.networkmanager.enable; + options = { + nixfiles.common.window-manager.enable = mkEnableOption "common window manager configuration"; }; }