diff --git a/nixos/android.nix b/nixos/android.nix index ff9db1cc..c31a14f1 100644 --- a/nixos/android.nix +++ b/nixos/android.nix @@ -1,8 +1,12 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - android-udev-rules - ]; - nixpkgs.config.android_sdk.accept_license = true; - programs.adb.enable = true; + options = { + }; + config = { + environment.systemPackages = with pkgs; [ + android-udev-rules + ]; + nixpkgs.config.android_sdk.accept_license = true; + programs.adb.enable = true; + }; } diff --git a/nixos/base.nix b/nixos/base.nix index 281ec836..9485c94b 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -1,13 +1,5 @@ -{ config, pkgs, options, inputs, ... }: -{ - imports = [ - ./environment.nix - ./essential.nix - ./nix.nix - ./ssh.nix - ./users.nix - ]; - +{ config, pkgs, options, inputs, makeEnable, ... }: +makeEnable config "modules.base" true { nixpkgs.config.permittedInsecurePackages = [ "openssl-1.0.2u" "electron-12.2.3" @@ -67,10 +59,6 @@ services.tzupdate.enable = true; # TODO: Add a comment explaining what this does. - services.gnome.at-spi2-core.enable = true; - - services.gnome.gnome-keyring.enable = true; - services.locate.enable = true; virtualisation.docker.enable = true; diff --git a/nixos/code.nix b/nixos/code.nix index 0b9af084..3fb488fe 100644 --- a/nixos/code.nix +++ b/nixos/code.nix @@ -1,5 +1,5 @@ -{ pkgs, config, ... }: -{ +{ pkgs, config, makeEnable, ... }: +makeEnable config "modules.code" true { programs.direnv = { enable = true; nix-direnv.enable = true; diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 00000000..4265106a --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,39 @@ +{ config, lib, ... }: +{ + imports = [ + ./android.nix + ./base.nix + ./code.nix + ./desktop.nix + ./environment.nix + ./essential.nix + ./extra.nix + ./games.nix + ./git-sync.nix + ./internet-computer.nix + ./keybase.nix + ./nix.nix + ./nixified.ai.nix + ./ssh.nix + ./syncthing.nix + ./users.nix + ./wsl.nix + ./xmonad.nix + ]; + + options = { + features.full.enable = lib.mkEnableOption "Do everything"; + }; + + config = lib.mkIf config.features.full.enable { + modules.base.enable = true; + modules.desktop.enable = true; + modules.xmonad.enable = true; + modules.extra.enable = true; + modules.code.enable = true; + modules.games.enable = true; + modules.syncthing.enable = true; + modules.fonts.enable = true; + modules.nixified-ai.enable = true; + }; +} diff --git a/nixos/desktop.nix b/nixos/desktop.nix index f80f9e9a..c7b6ffe1 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -1,5 +1,5 @@ -{ config, pkgs, options, inputs, ... }: -{ +{ config, pkgs, options, inputs, makeEnable, ... }: +makeEnable config "modules.desktop" true { imports = [ ./fonts.nix ]; @@ -43,6 +43,10 @@ # This is for the benefit of VSCODE running natively in wayland environment.sessionVariables.NIXOS_OZONE_WL = "1"; + services.gnome.at-spi2-core.enable = true; + + services.gnome.gnome-keyring.enable = true; + environment.systemPackages = with pkgs; [ # Appearance gnome.adwaita-icon-theme diff --git a/nixos/extra.nix b/nixos/extra.nix index 3a978c3e..2b794869 100644 --- a/nixos/extra.nix +++ b/nixos/extra.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: -{ +{ config, pkgs, makeEnable, ... }: +makeEnable config "modules.extra" false { services.expressvpn.enable = true; programs.hyprland.enable = true; diff --git a/nixos/fonts.nix b/nixos/fonts.nix index 7aa036d1..b6d38d80 100644 --- a/nixos/fonts.nix +++ b/nixos/fonts.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: -{ +{ pkgs, makeEnable, config, ... }: +makeEnable config "modules.fonts" true { # Enable the gtk icon cache gtk.iconCache.enable = true; diff --git a/nixos/full.nix b/nixos/full.nix deleted file mode 100644 index 061a411d..00000000 --- a/nixos/full.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, ... }: -{ - imports = [ - ./android.nix - ./base.nix - ./code.nix - ./desktop.nix - ./extra.nix - ./games.nix - ./git-sync.nix - ./internet-computer.nix - ./keybase.nix - ./nixified.ai.nix - ./syncthing.nix - ./xmonad.nix - ]; -} diff --git a/nixos/games.nix b/nixos/games.nix index aba7ebb6..acb5c69f 100644 --- a/nixos/games.nix +++ b/nixos/games.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: -{ +{ config, pkgs, makeEnable, ... }: +makeEnable config "modules.games" false { environment.systemPackages = with pkgs; [ steam heroic diff --git a/nixos/git-sync.nix b/nixos/git-sync.nix index cb0345eb..05d9861a 100644 --- a/nixos/git-sync.nix +++ b/nixos/git-sync.nix @@ -37,6 +37,10 @@ uri = "ssh://gitea@1896Folsom.duckdns.org:1123/kkathuang/org.git"; interval = 45; }; + katnivan = { + path = config.home.homeDirectory + "/katnivan"; + uri = "ssh://gitea@1896Folsom.duckdns.org:1123/colonelpanic/katnivan.git"; + }; }; }; }); diff --git a/nixos/home-manager.nix b/nixos/home-manager.nix index 88fd5969..24d3524c 100644 --- a/nixos/home-manager.nix +++ b/nixos/home-manager.nix @@ -1,4 +1,4 @@ -username: { pkgs, config, specialArgs, ... }: +{ pkgs, config, specialArgs, ... }: { xsession = { enable = true; diff --git a/nixos/kat.nix b/nixos/kat.nix index 35bcb74e..8d99d8a7 100644 --- a/nixos/kat.nix +++ b/nixos/kat.nix @@ -1,12 +1,8 @@ -{ pkgs, inputs, ... }: -{ - imports = [ - inputs.home-manager.nixosModule - ]; +{ pkgs, inputs, config, makeEnable, ... }: +makeEnable config "modules.kat" false { environment.systemPackages = with pkgs; [ bitwarden obsidian - vlc obs-studio ffmpeg ]; @@ -14,36 +10,4 @@ environment.extraInit = '' export PAGER=cat ''; - - home-manager.users.kat = { pkgs, config, ... }: { - services.gpg-agent = { - enable = true; - defaultCacheTtl = 8 * 60 * 60; - maxCacheTtl = 8 * 60 * 60; - enableSshSupport = true; - pinentryFlavor = "qt"; - }; - - services.kdeconnect = { - enable = true; - indicator = true; - }; - - services.git-sync = { - enable = true; - repositories = { - obsidian = { - path = config.home.homeDirectory + "/obsidian"; - uri = "git@github.com:katandtonic/obsidian.git"; - interval = 60; - }; - org = { - path = config.home.homeDirectory + "/org"; - uri = "ssh://gitea@1896Folsom.duckdns.org:1123/kkathuang/org.git"; - interval = 45; - }; - }; - }; - home.stateVersion = "23.11"; - }; } diff --git a/nixos/laptop.nix b/nixos/laptop.nix deleted file mode 100644 index 64c33fc1..00000000 --- a/nixos/laptop.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: -{ - imports = [ - ./base.nix - ./code.nix - ./desktop.nix - ./internet-computer.nix - ./syncthing.nix - ./xmonad.nix - ]; -} diff --git a/nixos/machines/adele.nix b/nixos/machines/adele.nix index f07a1ca5..6c2d1b80 100644 --- a/nixos/machines/adele.nix +++ b/nixos/machines/adele.nix @@ -2,10 +2,20 @@ { imports = [ - ../laptop.nix + ../configuration.nix inputs.nixos-hardware.nixosModules.dell-xps-17-9700-intel ]; + modules.base.enable = true; + modules.desktop.enable = true; + modules.xmonad.enable = true; + modules.extra.enable = false; + modules.code.enable = true; + modules.games.enable = false; + modules.syncthing.enable = true; + modules.fonts.enable = true; + modules.nixified-ai.enable = false; + hardware.enableRedistributableFirmware = true; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; diff --git a/nixos/machines/biskcomp.nix b/nixos/machines/biskcomp.nix index 9b415b20..7ae7f632 100644 --- a/nixos/machines/biskcomp.nix +++ b/nixos/machines/biskcomp.nix @@ -1,14 +1,21 @@ { imports = [ - ../internet-computer.nix + ../configuration.nix ../raspberry-pi.nix - ../base.nix - ../syncthing.nix - ../desktop.nix - ../code.nix - # ../xmonad.nix ]; + modules.raspberry-pi.enable = true; + + modules.base.enable = true; + modules.desktop.enable = true; + modules.xmonad.enable = true; + modules.extra.enable = false; + modules.code.enable = true; + modules.games.enable = false; + modules.syncthing.enable = true; + modules.fonts.enable = true; + modules.nixified-ai.enable = false; + services.plex = { enable = true; }; diff --git a/nixos/machines/ivanm-dfinity-razer.nix b/nixos/machines/ivanm-dfinity-razer.nix index 09f7488e..1d79eeb2 100644 --- a/nixos/machines/ivanm-dfinity-razer.nix +++ b/nixos/machines/ivanm-dfinity-razer.nix @@ -1,13 +1,20 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. { config, lib, pkgs, ... }: { imports = [ - ../full.nix + ../configuration.nix ]; + modules.base.enable = true; + modules.desktop.enable = true; + modules.xmonad.enable = true; + modules.extra.enable = false; + modules.code.enable = true; + modules.games.enable = false; + modules.syncthing.enable = true; + modules.fonts.enable = true; + modules.nixified-ai.enable = false; + hardware.enableRedistributableFirmware = true; # disable card with bbswitch by default since we turn it on only on demand! diff --git a/nixos/machines/jay-lenovo-wsl.nix b/nixos/machines/jay-lenovo-wsl.nix index 376e912f..fd2a674d 100644 --- a/nixos/machines/jay-lenovo-wsl.nix +++ b/nixos/machines/jay-lenovo-wsl.nix @@ -1,12 +1,10 @@ { lib, pkgs, config, inputs, ... }: { imports = [ - ../syncthing.nix - ../wsl.nix - ../kat.nix + ../configuration.nix ]; - networking.hostName = "jay-lenovo-wsl"; + modules.wls.enable = true;tworking.hostName = "jay-lenovo-wsl"; wsl.defaultUser = "kat"; system.stateVersion = "22.05"; diff --git a/nixos/machines/jay-lenovo.nix b/nixos/machines/jay-lenovo.nix index 58e0b64a..47cea373 100644 --- a/nixos/machines/jay-lenovo.nix +++ b/nixos/machines/jay-lenovo.nix @@ -2,10 +2,11 @@ { imports = [ - ../full.nix - ../kat.nix + ../configuration.nix ]; + features.full.enable = true; + environment.systemPackages = with pkgs; [ linuxPackages_latest.perf zenmonitor diff --git a/nixos/machines/nixquick.nix b/nixos/machines/nixquick.nix index 30ad5e60..4ec4fcbb 100644 --- a/nixos/machines/nixquick.nix +++ b/nixos/machines/nixquick.nix @@ -1,11 +1,11 @@ { config, lib, pkgs, inputs, ... }: { imports = [ - ../full.nix - ../kat.nix - ../nixified.ai.nix + ../configuration.nix ]; + features.full.enable = true; + networking.hostName = "nixquick"; hardware.enableRedistributableFirmware = true; diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index 44ce75c0..eb4eefed 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -2,10 +2,10 @@ { imports = [ - ../full.nix + ../configuration.nix ]; - modules.nixified-ai.enable = true; + features.full.enable = true; boot.loader.systemd-boot.configurationLimit = 5; diff --git a/nixos/machines/stevie-nixos.nix b/nixos/machines/stevie-nixos.nix deleted file mode 100644 index f792b7a8..00000000 --- a/nixos/machines/stevie-nixos.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -{ - imports = [ - ../full.nix - ../base.nix - ]; - - hardware.enableRedistributableFirmware = true; - - boot.initrd.availableKernelModules = [ - "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" - ]; - - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = with config.boot.kernelPackages; [ ]; - - services.xserver = { - videoDrivers = [ "modesetting ""nvidia" ]; - }; - - services.thermald.enable = true; - - boot.kernelPackages = pkgs.linuxPackages_latest; - - boot.kernelPatches = [{ - name = "enable-soundwire-drivers"; - patch = null; - extraConfig = '' - SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES y - SND_SOC_INTEL_SOUNDWIRE_SOF_MACH m - SND_SOC_RT1308 m - ''; - ignoreConfigErrors = true; - }]; - - hardware.nvidia.prime = { - sync.enable = true; - - # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA - nvidiaBusId = "PCI:1:0:0"; - - # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA - intelBusId = "PCI:0:2:0"; - }; - - services.xserver.screenSection = '' - Option "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}" - Option "AllowIndirectGLXProtocol" "off" - Option "TripleBuffer" "on" - ''; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - services.xserver.libinput.enable = true; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/7c999009-1ff1-42f7-a64a-3fa91fc777a8"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/97c1eee7-b161-4186-9c14-6b1771d49afb"; - - fileSystems."/boot" = - { device = "/dev/disk/by-label/ESP"; - fsType = "vfat"; - }; - - - swapDevices = [ ]; - - networking.hostName = "stevie-nixos"; - - nix.settings.maxJobs = lib.mkDefault 16; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - - hardware.video.hidpi.enable = true; - services.xserver.dpi = 180; - - system.stateVersion = "21.05"; -} diff --git a/nixos/machines/uber-loaner.nix b/nixos/machines/uber-loaner.nix deleted file mode 100644 index 9b8eb355..00000000 --- a/nixos/machines/uber-loaner.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - imports = [ - ../full.nix - ../games.nix - ../extra.nix - ]; - - hardware.enableRedistributableFirmware = true; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ pkgs.linuxPackages.rtl8814au ]; - boot.loader.grub.efiSupport = true; - boot.loader.grub.device = "nodev"; - boot.loader.grub.enable = true; - services.xserver = { - libinput.enable = true; - }; - hardware.facetimehd.enable = true; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/EFI"; - fsType = "vfat"; - }; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/2958f04b-8387-4a0c-abc1-f12036c53581"; - fsType = "ext4"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/33c38b23-af1a-4bc4-913e-c774f1030817"; } - ]; - - fileSystems."/tmp" = - { device = "tmpfs"; - fsType = "tmpfs"; - }; - - networking.hostName = "uber-loaner"; - - nix.settings.maxJobs = lib.mkDefault 4; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - users.extraUsers.root.initialHashedPassword = ""; -} diff --git a/nixos/make-enable.nix b/nixos/make-enable.nix index 2b87da84..35f99efc 100644 --- a/nixos/make-enable.nix +++ b/nixos/make-enable.nix @@ -17,7 +17,7 @@ let }; }; - cfg = lib.attrByPath (lib.splitString "." pathStr) { enable = false; defaulted = true; } config; + cfg = lib.attrByPath (lib.splitString "." pathStr) { enable = false; } config; # Extract 'imports' from configAttrs, if it exists importsAttr = if configAttrs ? imports then configAttrs.imports else []; diff --git a/nixos/raspberry-pi.nix b/nixos/raspberry-pi.nix index 5f98284a..e059846b 100644 --- a/nixos/raspberry-pi.nix +++ b/nixos/raspberry-pi.nix @@ -1,6 +1,6 @@ -{ config, pkgs, inputs, ... }: +{ config, pkgs, inputs, makeEnable, ... }: -{ +makeEnable config "modules.raspberry-pi" false { imports = [ inputs.nixos-hardware.nixosModules.raspberry-pi-4 ]; diff --git a/nixos/syncthing.nix b/nixos/syncthing.nix index c961845c..c9462b7f 100644 --- a/nixos/syncthing.nix +++ b/nixos/syncthing.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, makeEnable, config, ... }: let devices = { biskcomp = { @@ -13,7 +13,7 @@ let }; allDevices = builtins.attrNames devices; in -{ +makeEnable config "modules.syncthing" true { system.activationScripts.syncthingPermissions = { text = '' chown -R syncthing:syncthing /var/lib/syncthing diff --git a/nixos/wsl.nix b/nixos/wsl.nix index b5f5661a..149bac9b 100644 --- a/nixos/wsl.nix +++ b/nixos/wsl.nix @@ -1,31 +1,18 @@ -{ inputs, pkgs, ... }: -{ +{ config, inputs, pkgs, makeEnable, ... }: +makeEnable config "modules.wsl" false { imports = [ inputs.nixos-wsl.nixosModules.wsl - ./ssh.nix - ./environment.nix - ./essential.nix - ./fonts.nix - ./nix.nix - ./users.nix - ./code.nix ]; - programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; - - environment.variables = { - SHELL = "${pkgs.zsh}/bin/zsh"; - }; + modules.base.enable = false; + modules.desktop.enable = false; + modules.xmonad.enable = false; wsl = { enable = true; automountPath = "/mnt"; startMenuLaunchers = true; nativeSystemd = true; - docker-native.enable = true; - - # Enable integration with Docker Desktop (needs to be installed) - # docker-desktop.enable = true; }; }