diff --git a/extras/cmd.nix b/extras/cmd.nix index a407dca..9396002 100644 --- a/extras/cmd.nix +++ b/extras/cmd.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { auth = "doas"; nixcfg = "ranger /etc/nixos"; } diff --git a/extras/displays.nix b/extras/displays.nix index b111d6b..2322b16 100644 --- a/extras/displays.nix +++ b/extras/displays.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { d1 = "DP-3"; d2 = "DP-1"; d3 = "DP-2"; diff --git a/extras/ips.nix b/extras/ips.nix index 0d30dfe..89356b2 100644 --- a/extras/ips.nix +++ b/extras/ips.nix @@ -1,4 +1,4 @@ -rec { +{ ... }: rec { netInt = "eno1"; localSpan = "10.0.0"; server = "${localSpan}.2"; diff --git a/extras/look.nix b/extras/look.nix index 0a2dad5..5ff11c4 100644 --- a/extras/look.nix +++ b/extras/look.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { colors = { prime = ''3823C4''; #3823C4 accent = ''1B1F59''; #1B1F59 diff --git a/extras/overlays.nix b/extras/overlays.nix index f048cce..a278a90 100644 --- a/extras/overlays.nix +++ b/extras/overlays.nix @@ -1,5 +1,4 @@ -{inputs, ...}: { - # This one brings our custom packages from the 'pkgs' directory +{ inputs, ... }: { additions = final: _prev: import ./pkgs {pkgs = final;}; selfsuper = (self: super: { diff --git a/extras/pkgs/default.nix b/extras/pkgs/default.nix index 3e3edab..4bff294 100644 --- a/extras/pkgs/default.nix +++ b/extras/pkgs/default.nix @@ -1,5 +1,4 @@ -# Custom packages, that can be defined similarly to nixpkgs -{pkgs, ...}: { +{ pkgs, ... }: { xash3d = pkgs.callPackage ./xash/xash3d.nix {}; hlsdk = pkgs.callPackage ./xash/hlsdk.nix {}; } diff --git a/extras/secrets-template.nix b/extras/secrets-template.nix index e102331..743d577 100644 --- a/extras/secrets-template.nix +++ b/extras/secrets-template.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { # Define domains jimDomain = ""; diff --git a/extras/secrets.nix b/extras/secrets.nix index 0d7d38b..0bbdb5c 100644 Binary files a/extras/secrets.nix and b/extras/secrets.nix differ diff --git a/extras/workspaces.nix b/extras/workspaces.nix index 4615a49..8df530a 100644 --- a/extras/workspaces.nix +++ b/extras/workspaces.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { w0 = ''0:0''; w1 = ''1:1''; w2 = ''2:2''; diff --git a/flake.nix b/flake.nix index 0b46cb3..3a05b01 100644 --- a/flake.nix +++ b/flake.nix @@ -55,27 +55,27 @@ JimDesktop = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ - ./system/hosts/JimDesktop/configuration.nix + ./hosts/JimDesktop/configuration.nix ]; }; JimServer = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ - ./system/hosts/JimServer/configuration.nix + ./JimServer/configuration.nix mailserver.nixosModule ]; }; JimPine = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ - ./system/hosts/JimPine/configuration.nix + ./hosts/JimPine/configuration.nix hardware.nixosModules.pine64-pinebook-pro ]; }; JimLenovo = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ - ./system/hosts/JimLenovo/configuration.nix + ./hosts/JimLenovo/configuration.nix ]; }; }; @@ -86,7 +86,7 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./home/hosts/JimDesktop/home.nix + ./hosts/JimDesktop/home.nix nur.nixosModules.nur ]; }; @@ -94,14 +94,14 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./home/hosts/JimServer/home.nix + ./hosts/JimServer/home.nix ]; }; "jimbo@JimPine" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.aarch64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./home/hosts/JimPine/home.nix + ./hosts/JimPine/home.nix nur.nixosModules.nur ]; }; @@ -109,7 +109,7 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./home/hosts/JimLenovo/home.nix + ./hosts/JimLenovo/home.nix nur.nixosModules.nur ]; }; @@ -118,7 +118,7 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ - ./home/hosts/JimTerminal/home.nix + ./hosts/JimTerminal/home.nix ]; }; }; diff --git a/home/base.nix b/home/base.nix deleted file mode 100644 index 053fdac..0000000 --- a/home/base.nix +++ /dev/null @@ -1,41 +0,0 @@ -# This is your home-manager configuration file -# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{pkgs, inputs, outputs, ...}: { - imports = [ - # Terminal apps - ./utils/zsh.nix - ./utils/fastfetch.nix - ./utils/neovim.nix - ./utils/ranger.nix - ./utils/tmux.nix - - # Services - ./services/reloadunits.nix - ]; - - nixpkgs = { - config.allowUnfree = true; - overlays = [ - outputs.overlays.additions - outputs.overlays.selfsuper - outputs.overlays.finalprev - inputs.blender-bin.overlays.default - ]; - }; - - # Common programs I'll need everywhere - home.packages = with pkgs; [ - home-manager - gotop - tcptrack - p7zip - vimv - dua - pciutils - usbutils - protonvpn-cli_2 - ]; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "24.05"; -} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..d31929a --- /dev/null +++ b/home/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./users + ]; + + # Allow unfree + nixpkgs.config.allowUnfree = true; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "24.05"; +} diff --git a/home/hosts/JimDesktop/home.nix b/home/hosts/JimDesktop/home.nix deleted file mode 100644 index 3055040..0000000 --- a/home/hosts/JimDesktop/home.nix +++ /dev/null @@ -1,46 +0,0 @@ -{config, ...}: { - imports = [ - # Common modules - ./../../base.nix - ./../../users/jimbo.nix - ./../../utils/git.nix - - # GUI Apps - ./../../misc/guifiles.nix - ./../../sway/sway.nix - ./../../sway/swaylock.nix - ./../../programs/gtk.nix - ./../../programs/foot.nix - ./../../programs/librewolf.nix - ./../../programs/mangohud.nix - ./../../programs/mpv.nix - ./../../programs/obs.nix - ./../../programs/pcmanfm-qt.nix - ./../../programs/rofi.nix - ./../../programs/swappy.nix - ./../../programs/easyeffects.nix - ./../../utils/ncmpcpp.nix - - # Misc apps and tools - ./../../misc/useful.nix - ./../../misc/avtools.nix - ./../../misc/filemanager.nix - ./../../misc/production.nix - ./../../misc/gaming.nix - ./../../misc/xash3d.nix - #./../../misc/emulators.nix - #./../../misc/remotedesktop.nix - ./../../misc/school.nix - ./../../misc/variables.nix - - # Services - ./../../services/gnome-keyring.nix - ./../../services/mako.nix - ./../../services/udiskie.nix - ]; - - # Symlinks - home.file = { - "VMs".source = config.lib.file.mkOutOfStoreSymlink "/etc/libvirt/VMs"; - }; -} diff --git a/home/hosts/JimLenovo/home.nix b/home/hosts/JimLenovo/home.nix deleted file mode 100644 index 007f786..0000000 --- a/home/hosts/JimLenovo/home.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - imports = [ - # Common modules - ./../../base.nix - ./../../users/jimbo.nix - ./../../utils/git.nix - - # GUI Apps - ./../../misc/guifiles.nix - ./../../sway/sway.nix - ./../../sway/swaylock.nix - ./../../programs/gtk.nix - ./../../programs/foot.nix - ./../../programs/librewolf.nix - ./../../programs/mangohud.nix - ./../../programs/mpv.nix - ./../../programs/obs.nix - ./../../programs/pcmanfm-qt.nix - ./../../programs/rofi.nix - ./../../programs/swappy.nix - ./../../programs/easyeffects.nix - ./../../utils/ncmpcpp.nix - - # Misc apps and tools - ./../../misc/useful.nix - ./../../misc/avtools.nix - ./../../misc/filemanager.nix - ./../../misc/gaming.nix - ./../../misc/xash3d.nix - ./../../misc/remotedesktop.nix - ./../../misc/school.nix - ./../../misc/variables.nix - - # Services - ./../../services/gnome-keyring.nix - ./../../services/mako.nix - ./../../services/udiskie.nix - ]; -} diff --git a/home/hosts/JimPine/home.nix b/home/hosts/JimPine/home.nix deleted file mode 100644 index ba5e93b..0000000 --- a/home/hosts/JimPine/home.nix +++ /dev/null @@ -1,42 +0,0 @@ -{pkgs, outputs, ...}: { - imports = [ - # Common modules - ./../../base.nix - ./../../users/jimbo.nix - ./../../utils/git.nix - - # GUI Apps - ./../../misc/guifiles.nix - ./../../sway/sway.nix - ./../../sway/swaylock.nix - ./../../programs/gtk.nix - ./../../programs/foot.nix - ./../../programs/librewolf.nix - ./../../programs/mangohud.nix - ./../../programs/mpv.nix - ./../../programs/pcmanfm-qt.nix - ./../../programs/rofi.nix - ./../../programs/swappy.nix - ./../../programs/easyeffects.nix - ./../../utils/ncmpcpp.nix - - # Misc apps and tools - ./../../misc/useful.nix - ./../../misc/avtools.nix - ./../../misc/filemanager.nix - ./../../misc/remotedesktop.nix - ./../../misc/variables.nix - - # Services - ./../../services/gnome-keyring.nix - ./../../services/mako.nix - ./../../services/udiskie.nix - ]; - - # Needed to make the speaker work - home.packages = with pkgs; [ - alsa-utils - ]; - - wayland.windowManager.sway.config.output.${outputs.displays.dI}.scale = "1.3"; -} diff --git a/home/hosts/JimServer/home.nix b/home/hosts/JimServer/home.nix deleted file mode 100644 index 8f71646..0000000 --- a/home/hosts/JimServer/home.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - # Common modules - ./../../base.nix - ./../../users/jimbo.nix - ./../../utils/git.nix - ]; -} diff --git a/home/misc/avtools.nix b/home/misc/avtools.nix deleted file mode 100644 index baffc4b..0000000 --- a/home/misc/avtools.nix +++ /dev/null @@ -1,9 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - yt-dlp - spotdl - playerctl - ffmpeg - pulsemixer - ]; -} diff --git a/home/misc/emulators.nix b/home/misc/emulators.nix deleted file mode 100644 index 931f46d..0000000 --- a/home/misc/emulators.nix +++ /dev/null @@ -1,10 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - dolphin-emu - cemu - ryujinx - duckstation - pcsx2 - unstable.lime3ds - ]; -} diff --git a/home/misc/filemanager.nix b/home/misc/filemanager.nix deleted file mode 100644 index f6b18f9..0000000 --- a/home/misc/filemanager.nix +++ /dev/null @@ -1,7 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - gnome.file-roller - imagemagick - poppler_utils - ]; -} diff --git a/home/misc/gaming.nix b/home/misc/gaming.nix deleted file mode 100644 index 8bc4040..0000000 --- a/home/misc/gaming.nix +++ /dev/null @@ -1,8 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - steam - steam-run - heroic - prismlauncher - ]; -} diff --git a/home/misc/production.nix b/home/misc/production.nix deleted file mode 100644 index c5a8967..0000000 --- a/home/misc/production.nix +++ /dev/null @@ -1,9 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - krita - inkscape - audacity - blender_4_2 - sunvox - ]; -} diff --git a/home/misc/remotedesktop.nix b/home/misc/remotedesktop.nix deleted file mode 100644 index 4d18c48..0000000 --- a/home/misc/remotedesktop.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - moonlight-qt - rustdesk-flutter - ]; -} diff --git a/home/misc/school.nix b/home/misc/school.nix deleted file mode 100644 index 9b4630f..0000000 --- a/home/misc/school.nix +++ /dev/null @@ -1,9 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - remmina - freerdp - globalprotect-openconnect - python3 - zoom-us - ]; -} diff --git a/home/misc/useful.nix b/home/misc/useful.nix deleted file mode 100644 index e6f4d7f..0000000 --- a/home/misc/useful.nix +++ /dev/null @@ -1,13 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - imv - qbittorrent - libreoffice-fresh - vesktop - fractal - ffmpegthumbnailer - thunderbird - protonvpn-cli_2 - bc - ]; -} diff --git a/home/misc/variables.nix b/home/misc/variables.nix deleted file mode 100644 index e353e65..0000000 --- a/home/misc/variables.nix +++ /dev/null @@ -1,30 +0,0 @@ -{pkgs, inputs, ...}: { - # Select default apps - xdg.mimeApps.defaultApplications = { - "inode/directory" = ["pcmanfm-qt.desktop"]; - "text/plain" = ["nvim.desktop"]; - "image/png" = ["imv.desktop"]; - "image/jpeg" = ["imv.desktop"]; - "video/*" = ["mpv.desktop"]; - }; - - # Set dconf settings - dconf.settings = { - "org/gnome/desktop/interface/color-scheme" = { - color-scheme = "prefer-dark"; - }; - "org/virt-manager/virt-manager/connections" = { - autoconnect = ["qemu:///system"]; - uris = ["qemu:///system"]; - }; - }; - - home.file = let - alsoftConf = '' - drivers=pulse - ''; - in { - # Alsoft config - ".alsoftrc".text = alsoftConf; - }; -} diff --git a/home/misc/xash3d.nix b/home/misc/xash3d.nix deleted file mode 100644 index 714944c..0000000 --- a/home/misc/xash3d.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - xash3d - hlsdk - ]; -} diff --git a/home/modules/default.nix b/home/modules/default.nix new file mode 100644 index 0000000..a375307 --- /dev/null +++ b/home/modules/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./files + ./settings + ]; +} diff --git a/home/assets/user-icon.png b/home/modules/files/assets/user-icon.png similarity index 100% rename from home/assets/user-icon.png rename to home/modules/files/assets/user-icon.png diff --git a/home/assets/wallpapers/1.png b/home/modules/files/assets/wallpapers/1.png similarity index 100% rename from home/assets/wallpapers/1.png rename to home/modules/files/assets/wallpapers/1.png diff --git a/home/assets/wallpapers/2.png b/home/modules/files/assets/wallpapers/2.png similarity index 100% rename from home/assets/wallpapers/2.png rename to home/modules/files/assets/wallpapers/2.png diff --git a/home/assets/wallpapers/3.png b/home/modules/files/assets/wallpapers/3.png similarity index 100% rename from home/assets/wallpapers/3.png rename to home/modules/files/assets/wallpapers/3.png diff --git a/home/assets/wallpapers/lock.png b/home/modules/files/assets/wallpapers/lock.png similarity index 100% rename from home/assets/wallpapers/lock.png rename to home/modules/files/assets/wallpapers/lock.png diff --git a/home/misc/guifiles.nix b/home/modules/files/default.nix similarity index 61% rename from home/misc/guifiles.nix rename to home/modules/files/default.nix index dc85cc1..1a101b7 100644 --- a/home/misc/guifiles.nix +++ b/home/modules/files/default.nix @@ -1,15 +1,17 @@ {pkgs, ...}: { - # Files that only make sense with a GUI home.file = { ".face" = { - source = ../assets/user-icon.png; + source = ./assets/user-icon.png; }; ".wallpapers" = { - source = ../assets/wallpapers; + source = ./assets/wallpapers; recursive = true; }; ".icons/default" = { source = "${pkgs.simp1e-cursors}/share/icons/Simp1e-Dark"; }; + ".alsoftrc" = { + text = ''drivers=pulse''; + }; }; } diff --git a/home/modules/overlays/default.nix b/home/modules/overlays/default.nix new file mode 100644 index 0000000..d4212c6 --- /dev/null +++ b/home/modules/overlays/default.nix @@ -0,0 +1,8 @@ +{ ... }: { + nixpkgs.overlays = [ + outputs.overlays.additions + outputs.overlays.selfsuper + outputs.overlays.finalprev + inputs.blender-bin.overlays.default + ]; +} diff --git a/home/modules/settings/dconf/default.nix b/home/modules/settings/dconf/default.nix new file mode 100644 index 0000000..e346e07 --- /dev/null +++ b/home/modules/settings/dconf/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + dconf.settings = { + "org/gnome/desktop/interface/color-scheme" = { + color-scheme = "prefer-dark"; + }; + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; +} diff --git a/home/modules/settings/default.nix b/home/modules/settings/default.nix new file mode 100644 index 0000000..71fc7e4 --- /dev/null +++ b/home/modules/settings/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./dconf + ./gtk + ./xdg + ]; +} diff --git a/home/programs/gtk.nix b/home/modules/settings/gtk/default.nix similarity index 95% rename from home/programs/gtk.nix rename to home/modules/settings/gtk/default.nix index fcf97ed..3c8c612 100644 --- a/home/programs/gtk.nix +++ b/home/modules/settings/gtk/default.nix @@ -1,5 +1,4 @@ -{pkgs, outputs, ...}: { - # Define GTK theme settings +{ pkgs, outputs, ... }: { gtk = { enable = true; font = { @@ -24,7 +23,6 @@ name = "Simp1e-Dark"; }; - # GTK app bookmarks gtk3 = { bookmarks = [ # Local diff --git a/home/modules/settings/xdg/default.nix b/home/modules/settings/xdg/default.nix new file mode 100644 index 0000000..e86b521 --- /dev/null +++ b/home/modules/settings/xdg/default.nix @@ -0,0 +1,9 @@ +{ ... }: { + xdg.mimeApps.defaultApplications = { + "inode/directory" = ["pcmanfm-qt.desktop"]; + "text/plain" = ["nvim.desktop"]; + "image/png" = ["imv.desktop"]; + "image/jpeg" = ["imv.desktop"]; + "video/*" = ["mpv.desktop"]; + }; +} diff --git a/home/pc.nix b/home/pc.nix new file mode 100644 index 0000000..3ab8ead --- /dev/null +++ b/home/pc.nix @@ -0,0 +1,10 @@ +{ ... }: { + imports = [ + ./default.nix + ./modules + ./profiles + ./programs + ./sway + ./utils + ]; +} diff --git a/home/programs/default.nix b/home/programs/default.nix new file mode 100644 index 0000000..b927eb5 --- /dev/null +++ b/home/programs/default.nix @@ -0,0 +1,20 @@ +{ ... }: { + imports = [ + ./easyeffects + ./fastfetch + ./foot + ./gaming + ./git + ./librewolf + ./mako + ./mangohud + ./misc + ./mpv + ./ncmpcpp + ./neovim + ./pcmanfm-qt + ./ranger + ./rofi + ./tmux + ]; +} diff --git a/home/programs/easyeffects.nix b/home/programs/easyeffects.nix deleted file mode 100644 index bffaa3e..0000000 --- a/home/programs/easyeffects.nix +++ /dev/null @@ -1,309 +0,0 @@ -{pkgs, ...}: { - home = { - packages = with pkgs; [ - easyeffects - ]; - file = let - # An Easyeffects equalizer profile that sounds good to me - easyEffectsProfile = '' - { - "output": { - "blocklist": [], - "crystalizer#0": { - "band0": { - "bypass": false, - "intensity": 0.0, - "mute": false - }, - "band1": { - "bypass": false, - "intensity": -1.0, - "mute": false - }, - "band2": { - "bypass": false, - "intensity": -2.0, - "mute": false - }, - "band3": { - "bypass": false, - "intensity": -3.0, - "mute": false - }, - "band4": { - "bypass": false, - "intensity": -4.0, - "mute": false - }, - "band5": { - "bypass": false, - "intensity": -5.0, - "mute": false - }, - "band6": { - "bypass": false, - "intensity": -6.0, - "mute": false - }, - "band7": { - "bypass": false, - "intensity": -7.0, - "mute": false - }, - "band8": { - "bypass": false, - "intensity": -8.0, - "mute": false - }, - "band9": { - "bypass": false, - "intensity": -9.0, - "mute": false - }, - "band10": { - "bypass": false, - "intensity": -10.0, - "mute": false - }, - "band11": { - "bypass": false, - "intensity": -11.0, - "mute": false - }, - "band12": { - "bypass": false, - "intensity": -12.0, - "mute": false - }, - "bypass": false, - "input-gain": 0.0, - "output-gain": 0.0 - }, - "equalizer#0": { - "balance": 0.0, - "bypass": false, - "input-gain": 0.0, - "left": { - "band0": { - "frequency": 32.0, - "gain": 1.1, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band1": { - "frequency": 64.0, - "gain": 1.16, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band2": { - "frequency": 125.0, - "gain": 3.33, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band3": { - "frequency": 250.0, - "gain": 1.53, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band4": { - "frequency": 500.0, - "gain": -1.83, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band5": { - "frequency": 1000.0, - "gain": -0.58, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band6": { - "frequency": 2000.0, - "gain": 1.42, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band7": { - "frequency": 4000.0, - "gain": 4.73, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band8": { - "frequency": 16000.0, - "gain": 7.62, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band9": { - "frequency": 156.38, - "gain": 2.84, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - } - }, - "mode": "IIR", - "num-bands": 10, - "output-gain": 0.0, - "pitch-left": 0.0, - "pitch-right": 0.0, - "right": { - "band0": { - "frequency": 32.0, - "gain": 1.1, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band1": { - "frequency": 64.0, - "gain": 1.16, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band2": { - "frequency": 125.0, - "gain": 3.33, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band3": { - "frequency": 250.0, - "gain": 1.53, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band4": { - "frequency": 500.0, - "gain": -1.83, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band5": { - "frequency": 1000.0, - "gain": -0.58, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band6": { - "frequency": 2000.0, - "gain": 1.42, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band7": { - "frequency": 4000.0, - "gain": 4.73, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band8": { - "frequency": 16000.0, - "gain": 7.62, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - }, - "band9": { - "frequency": 156.38, - "gain": 2.84, - "mode": "RLC (BT)", - "mute": false, - "q": 4.36, - "slope": "x1", - "solo": false, - "type": "Bell" - } - }, - "split-channels": false - }, - "plugins_order": [ - "equalizer#0", - "crystalizer#0" - ] - } - } - ''; - in { - # Easyeffects profile - ".config/easyeffects/output/JimHeadphones.json".text = easyEffectsProfile; - }; - }; -} diff --git a/home/programs/easyeffects/JimHeadphones.json b/home/programs/easyeffects/JimHeadphones.json new file mode 100644 index 0000000..1a075ae --- /dev/null +++ b/home/programs/easyeffects/JimHeadphones.json @@ -0,0 +1,294 @@ +{ + "output": { + "blocklist": [], + "crystalizer#0": { + "band0": { + "bypass": false, + "intensity": 0.0, + "mute": false + }, + "band1": { + "bypass": false, + "intensity": -1.0, + "mute": false + }, + "band2": { + "bypass": false, + "intensity": -2.0, + "mute": false + }, + "band3": { + "bypass": false, + "intensity": -3.0, + "mute": false + }, + "band4": { + "bypass": false, + "intensity": -4.0, + "mute": false + }, + "band5": { + "bypass": false, + "intensity": -5.0, + "mute": false + }, + "band6": { + "bypass": false, + "intensity": -6.0, + "mute": false + }, + "band7": { + "bypass": false, + "intensity": -7.0, + "mute": false + }, + "band8": { + "bypass": false, + "intensity": -8.0, + "mute": false + }, + "band9": { + "bypass": false, + "intensity": -9.0, + "mute": false + }, + "band10": { + "bypass": false, + "intensity": -10.0, + "mute": false + }, + "band11": { + "bypass": false, + "intensity": -11.0, + "mute": false + }, + "band12": { + "bypass": false, + "intensity": -12.0, + "mute": false + }, + "bypass": false, + "input-gain": 0.0, + "output-gain": 0.0 + }, + "equalizer#0": { + "balance": 0.0, + "bypass": false, + "input-gain": 0.0, + "left": { + "band0": { + "frequency": 32.0, + "gain": 1.1, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band1": { + "frequency": 64.0, + "gain": 1.16, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band2": { + "frequency": 125.0, + "gain": 3.33, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band3": { + "frequency": 250.0, + "gain": 1.53, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band4": { + "frequency": 500.0, + "gain": -1.83, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band5": { + "frequency": 1000.0, + "gain": -0.58, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band6": { + "frequency": 2000.0, + "gain": 1.42, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band7": { + "frequency": 4000.0, + "gain": 4.73, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band8": { + "frequency": 16000.0, + "gain": 7.62, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band9": { + "frequency": 156.38, + "gain": 2.84, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + } + }, + "mode": "IIR", + "num-bands": 10, + "output-gain": 0.0, + "pitch-left": 0.0, + "pitch-right": 0.0, + "right": { + "band0": { + "frequency": 32.0, + "gain": 1.1, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band1": { + "frequency": 64.0, + "gain": 1.16, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band2": { + "frequency": 125.0, + "gain": 3.33, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band3": { + "frequency": 250.0, + "gain": 1.53, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band4": { + "frequency": 500.0, + "gain": -1.83, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band5": { + "frequency": 1000.0, + "gain": -0.58, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band6": { + "frequency": 2000.0, + "gain": 1.42, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band7": { + "frequency": 4000.0, + "gain": 4.73, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band8": { + "frequency": 16000.0, + "gain": 7.62, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + }, + "band9": { + "frequency": 156.38, + "gain": 2.84, + "mode": "RLC (BT)", + "mute": false, + "q": 4.36, + "slope": "x1", + "solo": false, + "type": "Bell" + } + }, + "split-channels": false + }, + "plugins_order": [ + "equalizer#0", + "crystalizer#0" + ] + } +} diff --git a/home/programs/easyeffects/default.nix b/home/programs/easyeffects/default.nix new file mode 100644 index 0000000..5af4571 --- /dev/null +++ b/home/programs/easyeffects/default.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: { + home = { + packages = with pkgs; [ + easyeffects + ]; + file = { + ".config/easyeffects/output/JimHeadphones.json".source = ./JimHeadphones.json; + }; + }; +} diff --git a/home/utils/fastfetch.nix b/home/programs/fastfetch/default.nix similarity index 99% rename from home/utils/fastfetch.nix rename to home/programs/fastfetch/default.nix index 44a1013..30f75c8 100644 --- a/home/utils/fastfetch.nix +++ b/home/programs/fastfetch/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { home = { file = let fastConf = '' diff --git a/home/programs/foot.nix b/home/programs/foot/default.nix similarity index 100% rename from home/programs/foot.nix rename to home/programs/foot/default.nix diff --git a/home/programs/gaming/default.nix b/home/programs/gaming/default.nix new file mode 100644 index 0000000..d38017d --- /dev/null +++ b/home/programs/gaming/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./general + ./emulators + ./xash3d + ]; +} diff --git a/home/programs/gaming/emulators/default.nix b/home/programs/gaming/emulators/default.nix new file mode 100644 index 0000000..8a8024c --- /dev/null +++ b/home/programs/gaming/emulators/default.nix @@ -0,0 +1,16 @@ +{pkgs, lib, config, ...}: { + options = { + gaming.emulators.enable = lib.mkEnableOption "Enable console emulators"; + }; + + config = mkIf config.gaming.emulators.enable; { + home.packages = with pkgs; [ + dolphin-emu + cemu + ryujinx + duckstation + pcsx2 + unstable.lime3ds + ]; + }; +} diff --git a/home/programs/gaming/general/default.nix b/home/programs/gaming/general/default.nix new file mode 100644 index 0000000..1a1699f --- /dev/null +++ b/home/programs/gaming/general/default.nix @@ -0,0 +1,14 @@ +{pkgs, lib, config, ...}: { + options = { + gaming.general.enable = lib.mkEnableOption "Enable PC gaming apps"; + }; + + config = mkIf config.gaming.general.enable; { + home.packages = with pkgs; [ + steam + steam-run + heroic + prismlauncher + ]; + }; +} diff --git a/home/programs/gaming/xash3d/default.nix b/home/programs/gaming/xash3d/default.nix new file mode 100644 index 0000000..d232a9b --- /dev/null +++ b/home/programs/gaming/xash3d/default.nix @@ -0,0 +1,12 @@ +{pkgs, lib, config, ...}: { + options = { + gaming.xash3d.enable = lib.mkEnableOption "Enable Xash3d for Half-Life"; + }; + + config = mkIf config.gaming.xash3d.enable; { + home.packages = with pkgs; [ + xash3d + hlsdk + ]; + }; +} diff --git a/home/utils/git.nix b/home/programs/git/git.nix similarity index 85% rename from home/utils/git.nix rename to home/programs/git/git.nix index b10c56d..b8cad19 100644 --- a/home/utils/git.nix +++ b/home/programs/git/git.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { programs.git = { enable = true; lfs.enable = true; diff --git a/home/programs/librewolf.nix b/home/programs/librewolf/default.nix similarity index 100% rename from home/programs/librewolf.nix rename to home/programs/librewolf/default.nix diff --git a/home/services/mako.nix b/home/programs/mako/default.nix similarity index 94% rename from home/services/mako.nix rename to home/programs/mako/default.nix index 050bdf3..a320948 100644 --- a/home/services/mako.nix +++ b/home/programs/mako/default.nix @@ -1,5 +1,4 @@ {pkgs, outputs, ...}: { - # Notification daemon services.mako = { enable = true; borderColor = "#${outputs.look.colors.accent}"; @@ -17,7 +16,6 @@ extraConfig = "on-button-right=dismiss-all\nouter-margin=10\n[mode=do-not-disturb]\ninvisible=1"; }; - # Script to toggle notifications using mako home.packages = let makoToggle = pkgs.writeScriptBin "makotoggle" '' # Run makoctl mode and store the output in a variable diff --git a/home/programs/mangohud.nix b/home/programs/mangohud/default.nix similarity index 81% rename from home/programs/mangohud.nix rename to home/programs/mangohud/default.nix index f7160d7..c947388 100644 --- a/home/programs/mangohud.nix +++ b/home/programs/mangohud/default.nix @@ -3,9 +3,9 @@ packages = with pkgs; [ mangohud ]; - file = let - # Mangohud config file - mangoConf = '' + file = { + # Mangohud config + ".config/MangoHud/MangoHud.conf".text = '' table_columns=2 frametime=0 legacy_layout=0 @@ -24,9 +24,6 @@ gpu_load_change frame_timing ''; - in { - # Mangohud config - ".config/MangoHud/MangoHud.conf".text = mangoConf; }; }; } diff --git a/home/programs/misc/avtools/default.nix b/home/programs/misc/avtools/default.nix new file mode 100644 index 0000000..ac41595 --- /dev/null +++ b/home/programs/misc/avtools/default.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, config, ... }: { + options = { + misc.avtools.enable = lib.mkEnableOption "Enable audio video tools"; + }; + + imports = mkIf config.misc.avtools.enable [ + ./obs + ]; + + config = mkIf config.misc.avtools.enable; { + home.packages = with pkgs; [ + yt-dlp + spotdl + playerctl + ffmpeg + pulsemixer + ]; + }; +} diff --git a/home/programs/obs.nix b/home/programs/misc/avtools/obs/obs.nix similarity index 86% rename from home/programs/obs.nix rename to home/programs/misc/avtools/obs/obs.nix index f8da5fe..536249b 100644 --- a/home/programs/obs.nix +++ b/home/programs/misc/avtools/obs/obs.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: { - # OBS with plugins +{pkgs, lib, config, ...}: { programs.obs-studio = { enable = true; plugins = with pkgs.obs-studio-plugins; [ diff --git a/home/programs/misc/chat/default.nix b/home/programs/misc/chat/default.nix new file mode 100644 index 0000000..a429194 --- /dev/null +++ b/home/programs/misc/chat/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: { + options = { + misc.chat.enable = lib.mkEnableOption "Enable chat clients"; + }; + + config = mkIf config.misc.chat.enable; { + home.packages = with pkgs; [ + vesktop + fractal + ]; + }; +} diff --git a/home/programs/misc/default.nix b/home/programs/misc/default.nix new file mode 100644 index 0000000..fe044fd --- /dev/null +++ b/home/programs/misc/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./avtools + ./chat + ./general + ./headless + ./production + ./remote-desktop + ./school + ]; +} diff --git a/home/programs/misc/general/default.nix b/home/programs/misc/general/default.nix new file mode 100644 index 0000000..f5e89d1 --- /dev/null +++ b/home/programs/misc/general/default.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, config, ... }: { + options = { + misc.general.enable = lib.mkEnableOption "Enable general use apps"; + }; + + config = mkIf config.misc.general.enable; { + home.packages = with pkgs; [ + imv + qbittorrent + libreoffice-fresh + ffmpegthumbnailer + thunderbird + protonvpn-cli_2 + bc + ]; + }; +} diff --git a/home/programs/misc/headless/default.nix b/home/programs/misc/headless/default.nix new file mode 100644 index 0000000..1df8a2c --- /dev/null +++ b/home/programs/misc/headless/default.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, config, ... }: { + options = { + misc.headless.enable = lib.mkEnableOption "Enable apps that can be used headlessly"; + }; + + config = mkIf config.misc.headless.enable; { + home.packages = with pkgs; [ + home-manager + gotop + tcptrack + p7zip + vimv + dua + pciutils + usbutils + protonvpn-cli_2 + ]; + }; +} diff --git a/home/programs/misc/production/default.nix b/home/programs/misc/production/default.nix new file mode 100644 index 0000000..6f9610e --- /dev/null +++ b/home/programs/misc/production/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: { + options = { + production.enable = lib.mkEnableOption "Enable apps used for production"; + }; + + config = mkIf config.misc.production.enable; { + home.packages = with pkgs; [ + krita + inkscape + audacity + blender_4_2 + sunvox + ]; + }; +} diff --git a/home/programs/misc/remote-desktop/default.nix b/home/programs/misc/remote-desktop/default.nix new file mode 100644 index 0000000..3c6c253 --- /dev/null +++ b/home/programs/misc/remote-desktop/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: { + options = { + remote-desktop.enable = lib.mkEnableOption "Enable remote desktop related apps"; + }; + + config = mkIf misc.remote-desktop.nvidia.enable; { + home.packages = with pkgs; [ + moonlight-qt + rustdesk-flutter + ]; + }; +} diff --git a/home/programs/misc/school/default.nix b/home/programs/misc/school/default.nix new file mode 100644 index 0000000..7f21bd8 --- /dev/null +++ b/home/programs/misc/school/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: { + options = { + school.enable = lib.mkEnableOption "Enable apps needed for school"; + }; + + config = mkIf config.misc.school.enable; { + home.packages = with pkgs; [ + remmina + freerdp + globalprotect-openconnect + zoom-us + ]; + }; +} diff --git a/home/programs/mpv.nix b/home/programs/mpv/default.nix similarity index 88% rename from home/programs/mpv.nix rename to home/programs/mpv/default.nix index 0fec58b..f1f3e3d 100644 --- a/home/programs/mpv.nix +++ b/home/programs/mpv/default.nix @@ -1,5 +1,4 @@ { - # MPV settings programs.mpv = { enable = true; config = { diff --git a/home/utils/ncmpcpp.nix b/home/programs/ncmpcpp/default.nix similarity index 75% rename from home/utils/ncmpcpp.nix rename to home/programs/ncmpcpp/default.nix index 37019ac..c3e78fd 100644 --- a/home/utils/ncmpcpp.nix +++ b/home/programs/ncmpcpp/default.nix @@ -1,5 +1,4 @@ {pkgs, ...}: { - # Enable NCMPCPP programs.ncmpcpp = { enable = true; settings = { @@ -8,10 +7,8 @@ }; }; - # Enable Discord Music RPC services.mpd-discord-rpc.enable = true; - # Allow terminal control of mpd home.packages = with pkgs; [ mpc-cli ]; diff --git a/home/utils/neovim.nix b/home/programs/neovim/neovim.nix similarity index 97% rename from home/utils/neovim.nix rename to home/programs/neovim/neovim.nix index e5f924a..e00cc5c 100644 --- a/home/utils/neovim.nix +++ b/home/programs/neovim/neovim.nix @@ -1,5 +1,4 @@ -{pkgs, outputs, ...}: { - # Install Neovim and plugins +{ pkgs, outputs, ... }: { programs.neovim = { enable = true; defaultEditor = true; diff --git a/home/programs/pcmanfm-qt.nix b/home/programs/pcmanfm-qt/default.nix similarity index 83% rename from home/programs/pcmanfm-qt.nix rename to home/programs/pcmanfm-qt/default.nix index e8e4838..0b71ace 100644 --- a/home/programs/pcmanfm-qt.nix +++ b/home/programs/pcmanfm-qt/default.nix @@ -1,12 +1,11 @@ -{pkgs, ...}: { - # Swappy config file +{ pkgs, ... }: { home = { packages = with pkgs; [ pcmanfm-qt + gnome.file-roller ]; - file = let - # File manager config - pcmanConf = '' + file = { + ".config/pcmanfm-qt/default/settings.conf".text = '' [Behavior] BookmarkOpenMethod=current_tab ConfirmDelete=true @@ -53,9 +52,6 @@ SwitchToNewTab=true TabPaths=@Invalid() ''; - in { - # PCManFM config - ".config/pcmanfm-qt/default/settings.conf".text = pcmanConf; }; }; } diff --git a/home/utils/ranger.nix b/home/programs/ranger/default.nix similarity index 77% rename from home/utils/ranger.nix rename to home/programs/ranger/default.nix index 338952c..8c9f9d4 100644 --- a/home/utils/ranger.nix +++ b/home/programs/ranger/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { # Enable Ranger programs.ranger = { enable = true; @@ -100,28 +100,34 @@ ''; }; - # Ranger's bookmarks - home.file = let - rangerBookmarks = '' - # Local files - h:/home/jimbo/ - k:/home/jimbo/Downloads - v:/home/jimbo/Videos - c:/home/jimbo/.config - L:/home/jimbo/.local - D:/mnt - n:/etc/nixos + # Ranger's bookmarks and necessary tools + home = { + file = let + rangerBookmarks = '' + # Local files + h:/home/jimbo/ + k:/home/jimbo/Downloads + v:/home/jimbo/Videos + c:/home/jimbo/.config + L:/home/jimbo/.local + D:/mnt + n:/etc/nixos - # Remote files - a:/home/jimbo/JimboNFS - K:/home/jimbo/JimboNFS/Downloads - p:/home/jimbo/JimboNFS/Photos - P:/home/jimbo/JimboNFS/Projects - V:/home/jimbo/JimboNFS/Videos/Random - m:/home/jimbo/JimboNFS/Music - s:/home/jimbo/JimboNFS/School - ''; - in { - ".local/share/ranger/bookmarks".text = rangerBookmarks; + # Remote files + a:/home/jimbo/JimboNFS + K:/home/jimbo/JimboNFS/Downloads + p:/home/jimbo/JimboNFS/Photos + P:/home/jimbo/JimboNFS/Projects + V:/home/jimbo/JimboNFS/Videos/Random + m:/home/jimbo/JimboNFS/Music + s:/home/jimbo/JimboNFS/School + ''; + in { + ".local/share/ranger/bookmarks".text = rangerBookmarks; + }; + packages = with pkgs; [ + imagemagick + poppler_utils + ]; }; } diff --git a/home/programs/rofi.nix b/home/programs/rofi/default.nix similarity index 98% rename from home/programs/rofi.nix rename to home/programs/rofi/default.nix index f84a2c3..a66b213 100644 --- a/home/programs/rofi.nix +++ b/home/programs/rofi/default.nix @@ -1,5 +1,4 @@ -{pkgs, config, outputs, ...}: { - # Enable Rofi +{ pkgs, config, outputs, ... }: { programs.rofi = { enable = true; package = pkgs.rofi-wayland; @@ -124,7 +123,7 @@ }; }; home.packages = let - # All my rofi scripts in one file + # A script to execute commands with Rofi rofiScripts = pkgs.writeScriptBin "rofiscripts" '' # Scratchpad function handle_scratchpads() { diff --git a/home/programs/swappy.nix b/home/programs/swappy.nix deleted file mode 100644 index 917bc40..0000000 --- a/home/programs/swappy.nix +++ /dev/null @@ -1,19 +0,0 @@ -{pkgs, ...}: { - # Swappy config file - home = { - packages = with pkgs; [ - swappy - ]; - file = let - # Swappy config, for screenshot editing - swappyConfig = '' - [Default] - early_exit=true - save_dir=$HOME/Pictures/Screenshots - ''; - in { - # Swappy's config - ".config/swappy/config".text = swappyConfig; - }; - }; -} diff --git a/home/utils/tmux.nix b/home/programs/tmux/default.nix similarity index 98% rename from home/utils/tmux.nix rename to home/programs/tmux/default.nix index 3ff224a..9249fd4 100644 --- a/home/utils/tmux.nix +++ b/home/programs/tmux/default.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { # Enable tmux programs.tmux = { enable = true; diff --git a/home/server.nix b/home/server.nix new file mode 100644 index 0000000..a39efb2 --- /dev/null +++ b/home/server.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./default.nix + ./utils/zsh + ./utils/git + ./programs/fastfetch + ./programs/neovim + ./programs/ranger + ./programs/tmux + ]; +} diff --git a/home/services/gnome-keyring.nix b/home/services/gnome-keyring.nix deleted file mode 100644 index 9b45e0d..0000000 --- a/home/services/gnome-keyring.nix +++ /dev/null @@ -1,13 +0,0 @@ -{pkgs, ...}: { - services.gnome-keyring = { - enable = true; - components = [ - "ssh" - ]; - }; - - home.packages = with pkgs; [ - gnome.gnome-keyring - gnome.libgnome-keyring - ]; -} diff --git a/home/services/reloadunits.nix b/home/services/reloadunits.nix deleted file mode 100644 index 2cd1837..0000000 --- a/home/services/reloadunits.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - # Nicely reload system units when changing configs - systemd.user = { - enable = true; - startServices = "sd-switch"; - }; -} diff --git a/home/sway/autostart.nix b/home/sway/autostart/default.nix similarity index 89% rename from home/sway/autostart.nix rename to home/sway/autostart/default.nix index 7de28da..8e45797 100644 --- a/home/sway/autostart.nix +++ b/home/sway/autostart/default.nix @@ -1,8 +1,6 @@ -{config, pkgs, ...}: { - # Enable Sway and write some scripts +{ pkgs, ... }: { wayland.windowManager.sway = { config = { - # Use Waybar rather than Sway's bars = [{command = "waybar";}]; startup = [ diff --git a/home/sway/sway.nix b/home/sway/default.nix similarity index 80% rename from home/sway/sway.nix rename to home/sway/default.nix index 5d8d716..d875d44 100644 --- a/home/sway/sway.nix +++ b/home/sway/default.nix @@ -1,14 +1,14 @@ -{config, pkgs, outputs, ...}: { - # Import modules +{ config, pkgs, outputs, ... }: { imports = [ - #"./swayfx.nix" - ./hardware.nix - ./theme.nix - ./hotkeys.nix - ./rules.nix - ./autostart.nix - ./waybar.nix - ./swayshot.nix + ./hardware + ./theme + ./hotkeys + ./rules + ./autostart + ./waybar + ./swayshot + ./swaylock + ./swayfx ]; # Enable Sway and write some scripts diff --git a/home/sway/hardware.nix b/home/sway/hardware/default.nix similarity index 97% rename from home/sway/hardware.nix rename to home/sway/hardware/default.nix index dc0b332..9eea045 100644 --- a/home/sway/hardware.nix +++ b/home/sway/hardware/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { wayland.windowManager.sway = { config = { # Define monitors diff --git a/home/sway/README.md b/home/sway/hotkeys/README.md similarity index 100% rename from home/sway/README.md rename to home/sway/hotkeys/README.md diff --git a/home/sway/hotkeys.nix b/home/sway/hotkeys/default.nix similarity index 99% rename from home/sway/hotkeys.nix rename to home/sway/hotkeys/default.nix index 84756de..cce54d3 100644 --- a/home/sway/hotkeys.nix +++ b/home/sway/hotkeys/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { wayland.windowManager.sway = { config = let # Set default modifier and variables diff --git a/home/sway/rules.nix b/home/sway/rules/default.nix similarity index 94% rename from home/sway/rules.nix rename to home/sway/rules/default.nix index 992619a..130d3d1 100644 --- a/home/sway/rules.nix +++ b/home/sway/rules/default.nix @@ -1,5 +1,4 @@ -{config, pkgs, outputs, ...}: { - # Enable Sway and write some scripts +{ pkgs, outputs, ... }: { wayland.windowManager.sway = { config = { # Assign workspaces to outputs @@ -112,8 +111,8 @@ }; assigns = { # Brooutputs.wsers - "${outputs.ws.w1}" = [{app_id = "JimBrooutputs.wser";}]; - "${outputs.ws.w1a}" = [{app_id = "AltBrooutputs.wser";}]; + "${outputs.ws.w1}" = [{app_id = "JimBrowser";}]; + "${outputs.ws.w1a}" = [{app_id = "AltBrowser";}]; # Communication "${outputs.ws.w3a}" = [{class = "zoom";}]; diff --git a/home/sway/swayfx.nix b/home/sway/swayfx/default.nix similarity index 85% rename from home/sway/swayfx.nix rename to home/sway/swayfx/default.nix index 5390490..82dd538 100644 --- a/home/sway/swayfx.nix +++ b/home/sway/swayfx/default.nix @@ -1,9 +1,8 @@ -{config, pkgs, ...}: { +{ pkgs, ... }: { # Enable Sway and write some scripts wayland.windowManager.sway = { package = pkgs.unstable.sway; extraConfig = '' - # SwayFX specific options blur enable blur_passes 3 blur_radius 5 diff --git a/home/sway/swaylock.nix b/home/sway/swaylock/default.nix similarity index 97% rename from home/sway/swaylock.nix rename to home/sway/swaylock/default.nix index 8a8fb35..c6e985e 100644 --- a/home/sway/swaylock.nix +++ b/home/sway/swaylock/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, outputs, ...}: let +{ pkgs, outputs, ... }: let swayLock = pkgs.writeScriptBin "swaylock" '' # Set the lock script lockscript() { diff --git a/home/sway/swayshot.nix b/home/sway/swayshot/default.nix similarity index 95% rename from home/sway/swayshot.nix rename to home/sway/swayshot/default.nix index 4d01872..f52eb29 100644 --- a/home/sway/swayshot.nix +++ b/home/sway/swayshot/default.nix @@ -1,6 +1,9 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { + imports = [ + ./swappy + ]; + home.packages = let - # Use grim and slurp to take screenshots in multiple ways swayShot = pkgs.writeScriptBin "swayshot" '' # Swappy handle_swappy() { diff --git a/home/sway/swayshot/swappy/default.nix b/home/sway/swayshot/swappy/default.nix new file mode 100644 index 0000000..e946529 --- /dev/null +++ b/home/sway/swayshot/swappy/default.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + home = { + packages = with pkgs; [ + swappy + ]; + file = { + ".config/swappy/config".text = '' + [Default] + early_exit=true + save_dir=$HOME/Pictures/Screenshots + ''; + }; + }; +} diff --git a/home/sway/theme.nix b/home/sway/theme/default.nix similarity index 92% rename from home/sway/theme.nix rename to home/sway/theme/default.nix index 6cf24e4..87dc758 100644 --- a/home/sway/theme.nix +++ b/home/sway/theme/default.nix @@ -1,12 +1,9 @@ -{config, pkgs, outputs, ...}: { - # Enable Sway and write some scripts +{ config, pkgs, outputs, ... }: { wayland.windowManager.sway = { enable = true; - #package = pkgs.unstable.sway; wrapperFeatures.gtk = true; checkConfig = false; config = { - # Theming settings colors = { focused = { border = "#${outputs.look.colors.prime}"; diff --git a/home/sway/waybar.nix b/home/sway/waybar/default.nix similarity index 99% rename from home/sway/waybar.nix rename to home/sway/waybar/default.nix index f4d2bd4..ca03ca4 100644 --- a/home/sway/waybar.nix +++ b/home/sway/waybar/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { programs.waybar = let swayWorkspacesModule = { format = "{name}"; diff --git a/home/users/default.nix b/home/users/default.nix new file mode 100644 index 0000000..8373bb1 --- /dev/null +++ b/home/users/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ + ./jimbo + ]; +} diff --git a/home/users/jimbo.nix b/home/users/jimbo/default.nix similarity index 95% rename from home/users/jimbo.nix rename to home/users/jimbo/default.nix index 0547df5..3b75f9d 100644 --- a/home/users/jimbo.nix +++ b/home/users/jimbo/default.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { home = { username = "jimbo"; homeDirectory = "/home/jimbo"; diff --git a/home/utils/default.nix b/home/utils/default.nix new file mode 100644 index 0000000..7a6e543 --- /dev/null +++ b/home/utils/default.nix @@ -0,0 +1,7 @@ +{ ... }: { + imports = [ + ./gnome-keyring + ./udiskie + ./zsh + ]; +} diff --git a/home/utils/gnome-keyring/default.nix b/home/utils/gnome-keyring/default.nix new file mode 100644 index 0000000..d9893d7 --- /dev/null +++ b/home/utils/gnome-keyring/default.nix @@ -0,0 +1,3 @@ +{ ... }: { + services.gnome-keyring.enable = true; +} diff --git a/home/services/udiskie.nix b/home/utils/udiskie/default.nix similarity index 69% rename from home/services/udiskie.nix rename to home/utils/udiskie/default.nix index 8469804..33eb59f 100644 --- a/home/services/udiskie.nix +++ b/home/utils/udiskie/default.nix @@ -1,5 +1,4 @@ -{ - # Mount as user with udisk2 +{ ... }: { services.udiskie = { enable = true; automount = false; diff --git a/home/utils/zsh.nix b/home/utils/zsh/default.nix similarity index 98% rename from home/utils/zsh.nix rename to home/utils/zsh/default.nix index f619a52..ffbc57c 100644 --- a/home/utils/zsh.nix +++ b/home/utils/zsh/default.nix @@ -1,4 +1,4 @@ -{pkgs, config, outputs, ...}: { +{ pkgs, config, outputs, ... }: { programs.zsh = { enable = true; autosuggestion.enable = true; diff --git a/hosts/JimDesktop/configuration.nix b/hosts/JimDesktop/configuration.nix new file mode 100644 index 0000000..adeba1a --- /dev/null +++ b/hosts/JimDesktop/configuration.nix @@ -0,0 +1,23 @@ +{ + imports = [ + # Base configs + ./../../system + ./../../system/pc.nix + + # Hardware + ./hardware-configuration.nix + ./../../system/modules/boot/systemd + ]; + + # Enable Nvidia drivers + drivers.nvidia.enable = true; + + # Set hostname + networking.hostName = "JimDesktop"; + + # Force Electron to use Wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "24.05"; +} diff --git a/system/hosts/JimDesktop/hardware-configuration.nix b/hosts/JimDesktop/hardware-configuration.nix similarity index 100% rename from system/hosts/JimDesktop/hardware-configuration.nix rename to hosts/JimDesktop/hardware-configuration.nix diff --git a/hosts/JimDesktop/home.nix b/hosts/JimDesktop/home.nix new file mode 100644 index 0000000..f37661a --- /dev/null +++ b/hosts/JimDesktop/home.nix @@ -0,0 +1,26 @@ +{config, ...}: { + imports = [ + # Common modules + ./../../home + ./../../home/pc.nix + ]; + + # Useful + general.enable = true; + chat.enable = true; + avtools.enable = true; + production.enable = true; + obs.enable = true; + remotedesktop.enable = false; + school.enable = true; + + # Gaming + pcgaming.enable = true; + emulators.enable = false; + xash3d.enable = true; + + # Symlinks + home.file = { + "VMs".source = config.lib.file.mkOutOfStoreSymlink "/etc/libvirt/VMs"; + }; +} diff --git a/system/hosts/JimLenovo/configuration.nix b/hosts/JimLenovo/configuration.nix similarity index 100% rename from system/hosts/JimLenovo/configuration.nix rename to hosts/JimLenovo/configuration.nix diff --git a/system/hosts/JimLenovo/hardware-configuration.nix b/hosts/JimLenovo/hardware-configuration.nix similarity index 100% rename from system/hosts/JimLenovo/hardware-configuration.nix rename to hosts/JimLenovo/hardware-configuration.nix diff --git a/hosts/JimLenovo/home.nix b/hosts/JimLenovo/home.nix new file mode 100644 index 0000000..7c2f738 --- /dev/null +++ b/hosts/JimLenovo/home.nix @@ -0,0 +1,17 @@ +{config, ...}: { + imports = [ + # Common modules + ./../../home/base.nix + ./../../home/pc.nix + ./../../home/users/jimbo.nix + ]; + + # Useful + general.enable = true; + chat.enable = true; + avtools.enable = true; + remotedesktop.enable = true; + + # Gaming + pcgaming.enable = true; +} diff --git a/system/hosts/JimPine/configuration.nix b/hosts/JimPine/configuration.nix similarity index 97% rename from system/hosts/JimPine/configuration.nix rename to hosts/JimPine/configuration.nix index 797a8f0..71bfa10 100644 --- a/system/hosts/JimPine/configuration.nix +++ b/hosts/JimPine/configuration.nix @@ -42,7 +42,7 @@ hardware.opengl.driSupport32Bit = lib.mkForce false; # Set the VPN IP per machine - networking.wireguard.interfaces."${outputs.ips.wgInt}".ips = [ "${outputs.ips.wgSpan}.17/24" ]; + networking.wireguard.interfaces."${outputs.ips.wgInt}".ips = [ "${outputs.ips.wgSpan}.17/32" ]; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "24.05"; diff --git a/system/hosts/JimPine/hardware-configuration.nix b/hosts/JimPine/hardware-configuration.nix similarity index 100% rename from system/hosts/JimPine/hardware-configuration.nix rename to hosts/JimPine/hardware-configuration.nix diff --git a/hosts/JimPine/home.nix b/hosts/JimPine/home.nix new file mode 100644 index 0000000..bc49b50 --- /dev/null +++ b/hosts/JimPine/home.nix @@ -0,0 +1,21 @@ +{config, ...}: { + imports = [ + # Common modules + ./../../home/base.nix + ./../../home/pc.nix + ./../../home/users/jimbo.nix + ]; + + # Useful + general.enable = true; + chat.enable = true; + avtools.enable = true; + remotedesktop.enable = true; + + # Needed to make the speaker work + home.packages = with pkgs; [ + alsa-utils + ]; + + wayland.windowManager.sway.config.output.${outputs.displays.dI}.scale = "1.3"; +} diff --git a/hosts/JimServer/configuration.nix b/hosts/JimServer/configuration.nix new file mode 100644 index 0000000..7452d0e --- /dev/null +++ b/hosts/JimServer/configuration.nix @@ -0,0 +1,20 @@ +{ + imports = [ + # Base configs + ./../../system + ./../../system/profiles/server + + # Hardware + ./hardware-configuration.nix + ./../../system/modules/boot/systemd + ]; + + # Set custom openssh port + services.openssh.ports = [ 2222 ]; + + # Set hostname + networking.hostName = "JimServer"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "24.05"; +} diff --git a/system/hosts/JimServer/hardware-configuration.nix b/hosts/JimServer/hardware-configuration.nix similarity index 97% rename from system/hosts/JimServer/hardware-configuration.nix rename to hosts/JimServer/hardware-configuration.nix index 2c1f544..18e5f8f 100644 --- a/system/hosts/JimServer/hardware-configuration.nix +++ b/hosts/JimServer/hardware-configuration.nix @@ -1,7 +1,9 @@ { config, outputs, lib, pkgs, modulesPath, ... }: { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; # Set all boot options boot = { @@ -42,13 +44,13 @@ fsType = "ext4"; noCheck = true; }; + + # Atrocity of bindmounts "/home/jimbo/JimboNFS" = { device = "/export/JimboNFS"; fsType = "none"; options = [ "bind" ]; }; - - # Atrocity of bindmounts "/mnt/nextcloud/data/JimboNFS" = { device = "/export/JimboNFS"; fsType = "none"; diff --git a/hosts/JimServer/home.nix b/hosts/JimServer/home.nix new file mode 100644 index 0000000..02a60c7 --- /dev/null +++ b/hosts/JimServer/home.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./../../home + ./../../home/server.nix + ]; +} diff --git a/home/hosts/JimTerminal/home.nix b/hosts/JimTerminal/home.nix similarity index 100% rename from home/hosts/JimTerminal/home.nix rename to hosts/JimTerminal/home.nix diff --git a/system/accounts/default.nix b/system/accounts/default.nix new file mode 100644 index 0000000..5c525dd --- /dev/null +++ b/system/accounts/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./users + ./groups + ]; +} diff --git a/system/accounts/groups/default.nix b/system/accounts/groups/default.nix new file mode 100644 index 0000000..10474ae --- /dev/null +++ b/system/accounts/groups/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ + ./nfsShare + ]; +} diff --git a/system/accounts/groups/nfsShare/default.nix b/system/accounts/groups/nfsShare/default.nix new file mode 100644 index 0000000..34722ff --- /dev/null +++ b/system/accounts/groups/nfsShare/default.nix @@ -0,0 +1,3 @@ +{ ... }: { + users.groups.nfsShare = {}; +} diff --git a/system/accounts/users/default.nix b/system/accounts/users/default.nix new file mode 100644 index 0000000..cb8fb96 --- /dev/null +++ b/system/accounts/users/default.nix @@ -0,0 +1,8 @@ +{ ... }: { + imports = [ + ./jimbo + ./liquidsoap + ./nextcloud + ./nginx + ]; +} diff --git a/system/users/jimbo.nix b/system/accounts/users/jimbo/default.nix similarity index 95% rename from system/users/jimbo.nix rename to system/accounts/users/jimbo/default.nix index 21dce74..c9a8b8c 100644 --- a/system/users/jimbo.nix +++ b/system/accounts/users/jimbo/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { users.users = { jimbo = { description = "Jimbo"; diff --git a/system/users/liquidsoap.nix b/system/accounts/users/liquidsoap/default.nix similarity index 100% rename from system/users/liquidsoap.nix rename to system/accounts/users/liquidsoap/default.nix diff --git a/system/users/nextcloud.nix b/system/accounts/users/nextcloud/default.nix similarity index 100% rename from system/users/nextcloud.nix rename to system/accounts/users/nextcloud/default.nix diff --git a/system/users/nginx.nix b/system/accounts/users/nginx/default.nix similarity index 100% rename from system/users/nginx.nix rename to system/accounts/users/nginx/default.nix diff --git a/system/base.nix b/system/base.nix deleted file mode 100644 index 3e1ce6e..0000000 --- a/system/base.nix +++ /dev/null @@ -1,68 +0,0 @@ -# This is your system's configuration file (it replaces /etc/nixos/configuration.nix) -{inputs, outputs, lib, config, pkgs, ...}: { - # You can import other NixOS modules here - imports = [ - ./modules/networking.nix - ./modules/gpg.nix - ]; - - nixpkgs = { - # You can add overlays here - overlays = [ - outputs.overlays.additions - outputs.overlays.selfsuper - outputs.overlays.finalprev - ]; - - # Allow unfree apps - config.allowUnfree = true; - }; - - # Enable flakes and garbage collection - nix = { - settings = { - experimental-features = "nix-command flakes"; - auto-optimise-store = true; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 1w"; - }; - }; - - # Set timezone - time.timeZone = outputs.secrets.timeZone; - - # Select a terminal font - console = { - earlySetup = true; - font = "${pkgs.terminus_font}/share/consolefonts/ter-u22n.psf.gz"; - packages = with pkgs; [ terminus_font ]; - keyMap = "us"; - }; - - # Enable git - programs.git = { - enable = true; - lfs.enable = true; - }; - - # Basic firewall settings - networking.nftables.enable = true; - - # Enable the ZSH shell - programs.zsh.enable = true; - - # Disable Nano - programs.nano.enable = false; - - # Disable the HTML documentation link - documentation = { - nixos.enable = false; - info.enable = false; - }; - - # Allow binary firmware - hardware.enableRedistributableFirmware = true; -} diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..6328244 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,38 @@ +{ outputs, config, pkgs, ... }: { + imports = [ + ./accounts + ./modules/networking + ./modules/overlays + ./programs/git + ./services/garbage-collection + ]; + + nixpkgs.config.allowUnfree = true; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + time.timeZone = outputs.secrets.timeZone; + + console = { + earlySetup = true; + font = "${pkgs.terminus_font}/share/consolefonts/ter-u22n.psf.gz"; + packages = with pkgs; [ terminus_font ]; + }; + + programs = { + zsh.enable = true; + nano.enable = false; + }; + + # Disable the HTML documentation applet + documentation = { + nixos.enable = false; + info.enable = false; + }; + + # Allow binary firmware + hardware.enableRedistributableFirmware = true; +} diff --git a/system/desktop/fonts.nix b/system/desktop/fonts.nix deleted file mode 100644 index e38a909..0000000 --- a/system/desktop/fonts.nix +++ /dev/null @@ -1,14 +0,0 @@ -{pkgs, ...}: { - # Fonts - fonts = { - packages = with pkgs; [ - liberation_ttf - twitter-color-emoji - noto-fonts - sarasa-gothic - ubuntu_font_family - (nerdfonts.override {fonts = ["UbuntuMono"];}) - ]; - fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"]; - }; -} diff --git a/system/desktop/misc.nix b/system/desktop/misc.nix deleted file mode 100644 index 34cc267..0000000 --- a/system/desktop/misc.nix +++ /dev/null @@ -1,24 +0,0 @@ -{pkgs, ...}: { - # Enable AppImages - programs.appimage = { - enable = true; - binfmt = true; - }; - - # Network mounts, automounts, and battery saver - services = { - gvfs.enable = true; - udisks2.enable = true; - }; - - # Security that only makes sense with a GUI - security = { - polkit.enable = true; - rtkit.enable = true; - }; - - # Install programs system-wide - environment.systemPackages = with pkgs; [ - cifs-utils - ]; -} diff --git a/system/hosts/JimDesktop/configuration.nix b/system/hosts/JimDesktop/configuration.nix deleted file mode 100644 index 3e53a5c..0000000 --- a/system/hosts/JimDesktop/configuration.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - imports = [ - # Base configs - ./../../base.nix - - # Import users and groups - ./../../users/jimbo.nix - ./../../users/groups.nix - - # Desktop - ./../../desktop/misc.nix - ./../../desktop/sway.nix - ./../../desktop/greetd-sway.nix - ./../../desktop/printing.nix - ./../../desktop/gaming.nix - ./../../desktop/pipewire.nix - ./../../desktop/bluetooth.nix - ./../../desktop/firewall.nix - ./../../desktop/fonts.nix - ./../../desktop/qt.nix - - # Modules - ./../../modules/security.nix - - # Hardware - ./hardware-configuration.nix - ./../../modules/systemdboot.nix - ./../../modules/opengl.nix - ./../../modules/filesystems.nix - ./../../modules/nvidia.nix - #./../../modules/nouveau.nix - - # Services - ./../../services/openssh.nix - ./../../services/gnome-keyring.nix - ./../../services/qemukvm.nix - ./../../services/udev.nix - ./../../services/sunshine.nix - ./../../services/mpd.nix - #./../../services/waydroid.nix - ]; - - # Set hostname - networking.hostName = "JimDesktop"; - - # Force Electron to use Wayland - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "24.05"; -} diff --git a/system/hosts/JimServer/configuration.nix b/system/hosts/JimServer/configuration.nix deleted file mode 100644 index 0622a83..0000000 --- a/system/hosts/JimServer/configuration.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - imports = [ - # Base configs - ./../../base.nix - - # Import users and groups - ./../../users/jimbo.nix - ./../../users/nextcloud.nix - ./../../users/nginx.nix - ./../../users/liquidsoap.nix - ./../../users/groups.nix - - # Modules - ./../../modules/security.nix - - # Hardware - ./hardware-configuration.nix - ./../../hardware/systemdboot.nix - - # Services - ./../../services/openssh.nix - ./../../server/acme.nix - ./../../server/ddclient.nix - ./../../server/icecast.nix - ./../../server/firewall.nix - ./../../server/forgejo.nix - ./../../server/mailserver.nix - ./../../server/mariadb.nix - ./../../server/nginx.nix - ./../../server/owncast.nix - ./../../server/photoprism.nix - ./../../server/minecraft - ./../../server/vaultwarden.nix - ./../../server/transmission.nix - ./../../server/wireguard.nix - ./../../server/misc.nix - - # File server - ./../../server/nextcloud.nix - ./../../server/nfs.nix - ./../../server/samba.nix - - # Matrix - ./../../server/synapse.nix - ./../../server/element.nix - ./../../server/coturn.nix - ./../../server/matrix-discord.nix - - # Federation - ./../../server/lemmy.nix - ./../../server/mastodon.nix - ./../../server/pixelfed.nix - ]; - - # Set custom openssh port - services.openssh.ports = [ 2222 ]; - - # Set hostname - networking.hostName = "JimServer"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "24.05"; -} diff --git a/system/desktop/bluetooth.nix b/system/modules/bluetooth/default.nix similarity index 91% rename from system/desktop/bluetooth.nix rename to system/modules/bluetooth/default.nix index b519c76..2dcde0b 100644 --- a/system/desktop/bluetooth.nix +++ b/system/modules/bluetooth/default.nix @@ -1,5 +1,4 @@ -{ - # Enable Bluetooth +{ ... }: { hardware.bluetooth = { enable = true; settings = { diff --git a/system/modules/extlinux.nix b/system/modules/boot/extlinux/default.nix similarity index 82% rename from system/modules/extlinux.nix rename to system/modules/boot/extlinux/default.nix index 01b0299..bdd0f35 100644 --- a/system/modules/extlinux.nix +++ b/system/modules/boot/extlinux/default.nix @@ -1,5 +1,4 @@ { - # For ARM machines boot.loader = { generic-extlinux-compatible.enable = true; grub.enable = false; diff --git a/system/modules/systemdboot.nix b/system/modules/boot/systemd/default.nix similarity index 80% rename from system/modules/systemdboot.nix rename to system/modules/boot/systemd/default.nix index 31fd278..244ac0b 100644 --- a/system/modules/systemdboot.nix +++ b/system/modules/boot/systemd/default.nix @@ -1,5 +1,4 @@ { - # For UEFI machines boot.loader.systemd-boot = { enable = true; netbootxyz.enable = true; diff --git a/system/modules/default.nix b/system/modules/default.nix new file mode 100644 index 0000000..d8038e6 --- /dev/null +++ b/system/modules/default.nix @@ -0,0 +1,12 @@ +{ ... }: { + imports = [ + ./bluetooth + ./filesystems + ./networking + ./pipewire + ./printing + ./security + ./udev + ./video + ]; +} diff --git a/system/modules/filesystems.nix b/system/modules/filesystems/default.nix similarity index 87% rename from system/modules/filesystems.nix rename to system/modules/filesystems/default.nix index 0777d8c..f24fd90 100644 --- a/system/modules/filesystems.nix +++ b/system/modules/filesystems/default.nix @@ -1,4 +1,4 @@ -{lib, ...}: { +{ lib, ... }: { boot.supportedFilesystems = { ntfs = true; zfs = lib.mkForce false; diff --git a/system/modules/networking.nix b/system/modules/networking/default.nix similarity index 51% rename from system/modules/networking.nix rename to system/modules/networking/default.nix index a5b22f2..c7c5a69 100644 --- a/system/modules/networking.nix +++ b/system/modules/networking/default.nix @@ -1,7 +1,11 @@ -{ - # Networking settings +{ ... }: { + imports = [ + ./wireless + ]; + networking = { wireless.enable = false; dhcpcd.enable = true; + nftables.enable = true; }; } diff --git a/system/modules/networking/wireless/default.nix b/system/modules/networking/wireless/default.nix new file mode 100644 index 0000000..03e07cf --- /dev/null +++ b/system/modules/networking/wireless/default.nix @@ -0,0 +1,12 @@ +{ lib, config, ... }: { + options = { + networking.wifi.enable = lib.mkEnableOption "Enable enable Network Manager and B43"; + }; + + config = lib.mkIf config.misc.general.enable { + networking = { + networkmanager.enable = true; + enableB43Firmware = true; + }; + }; +} diff --git a/system/modules/nouveau.nix b/system/modules/nouveau.nix deleted file mode 100644 index bfd9504..0000000 --- a/system/modules/nouveau.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs, ...}: { - # Enable video drivers - services.xserver.videoDrivers = ["nouveau"]; -} diff --git a/system/modules/nvidia.nix b/system/modules/nvidia.nix deleted file mode 100644 index 7d06fae..0000000 --- a/system/modules/nvidia.nix +++ /dev/null @@ -1,10 +0,0 @@ -{pkgs, config, ...}: { - # Enable video drivers - services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia = { - modesetting.enable = true; - nvidiaSettings = false; - package = config.boot.kernelPackages.nvidiaPackages.beta; - open = false; - }; -} diff --git a/system/modules/overlays/default.nix b/system/modules/overlays/default.nix new file mode 100644 index 0000000..2883425 --- /dev/null +++ b/system/modules/overlays/default.nix @@ -0,0 +1,7 @@ +{ outputs, ... }: { + nixpkgs.overlays = [ + outputs.overlays.additions + outputs.overlays.selfsuper + outputs.overlays.finalprev + ]; +} diff --git a/system/desktop/pipewire.nix b/system/modules/pipewire/default.nix similarity index 93% rename from system/desktop/pipewire.nix rename to system/modules/pipewire/default.nix index 1a5af4e..2fc5cde 100644 --- a/system/desktop/pipewire.nix +++ b/system/modules/pipewire/default.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: { - # Enable Pipewire +{ pkgs, ... }: { services = { pipewire = { enable = true; diff --git a/system/desktop/printing.nix b/system/modules/printing/default.nix similarity index 81% rename from system/desktop/printing.nix rename to system/modules/printing/default.nix index 842609a..a6ad026 100644 --- a/system/desktop/printing.nix +++ b/system/modules/printing/default.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: { - # Enable printing +{ pkgs, ... }: { services = { printing = { enable = true; @@ -13,7 +12,6 @@ }; }; - # Install programs system-wide environment.systemPackages = with pkgs; [ system-config-printer ]; diff --git a/system/modules/security/apparmor/default.nix b/system/modules/security/apparmor/default.nix new file mode 100644 index 0000000..49498f4 --- /dev/null +++ b/system/modules/security/apparmor/default.nix @@ -0,0 +1,3 @@ +{ ... }: { + security.apparmor.enable = true; +} diff --git a/system/modules/security/default.nix b/system/modules/security/default.nix new file mode 100644 index 0000000..ae30326 --- /dev/null +++ b/system/modules/security/default.nix @@ -0,0 +1,8 @@ +{ ... }: { + imports = [ + ./apparmor + ./doas + ./gnome-keyring + ./polkit + ]; +} diff --git a/system/modules/security.nix b/system/modules/security/doas/default.nix similarity index 83% rename from system/modules/security.nix rename to system/modules/security/doas/default.nix index 98565be..31bf677 100644 --- a/system/modules/security.nix +++ b/system/modules/security/doas/default.nix @@ -1,5 +1,4 @@ -{ - # Enable AppArmor +{ ... }: { security = { sudo.enable = false; doas = { @@ -12,6 +11,5 @@ } ]; }; - apparmor.enable = true; }; } diff --git a/system/services/gnome-keyring.nix b/system/modules/security/gnome-keyring/default.nix similarity index 81% rename from system/services/gnome-keyring.nix rename to system/modules/security/gnome-keyring/default.nix index 9dd1656..f421dfc 100644 --- a/system/services/gnome-keyring.nix +++ b/system/modules/security/gnome-keyring/default.nix @@ -1,3 +1,3 @@ -{ +{ ... }: { services.gnome.gnome-keyring.enable = true; } diff --git a/system/modules/security/polkit/default.nix b/system/modules/security/polkit/default.nix new file mode 100644 index 0000000..391a55a --- /dev/null +++ b/system/modules/security/polkit/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + security = { + polkit.enable = true; + rtkit.enable = true; + }; +} diff --git a/system/modules/udev/default.nix b/system/modules/udev/default.nix new file mode 100644 index 0000000..5d042de --- /dev/null +++ b/system/modules/udev/default.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: { + # Rules to make PDP controller and Oculus Rift CV1 work + services.udev = let + pdpRules = pkgs.writeTextFile { + name = "10-pdp.rules"; + text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"''; + destination = "/etc/udev/rules.d/10-pdp.rules"; + }; + oculusRules = pkgs.writeTextFile { + name = "10-oculus.rules"; + text = ''KERNEL=="hidraw*", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0184", MODE="0660", TAG+="uaccess"''; + destination = "/etc/udev/rules.d/10-oculus.rules"; + }; + in { + packages = [ + oculusRules + pdpRules + ]; + }; +} diff --git a/system/modules/opengl.nix b/system/modules/video/default.nix similarity index 75% rename from system/modules/opengl.nix rename to system/modules/video/default.nix index a68615f..8e59782 100644 --- a/system/modules/opengl.nix +++ b/system/modules/video/default.nix @@ -1,5 +1,9 @@ -{pkgs, ...}: { - # Enable OpenGL +{ pkgs, ... }: { + imports = [ + ./nvidia + ./nouveau + ]; + hardware.opengl = { enable = true; driSupport32Bit = true; diff --git a/system/modules/video/nouveau/default.nix b/system/modules/video/nouveau/default.nix new file mode 100644 index 0000000..3413d95 --- /dev/null +++ b/system/modules/video/nouveau/default.nix @@ -0,0 +1,9 @@ +{ config, lib, ... }: { + options = { + drivers.nouveau.enable = lib.mkEnableOption "Enable proprietary Nvidia drivers"; + }; + + config = lib.mkIf config.drivers.nvidia.enable { + services.xserver.videoDrivers = [ "nouveau" ]; + }; +} diff --git a/system/modules/video/nvidia/default.nix b/system/modules/video/nvidia/default.nix new file mode 100644 index 0000000..e8cc340 --- /dev/null +++ b/system/modules/video/nvidia/default.nix @@ -0,0 +1,15 @@ +{ pkgs, config, lib, ... }: { + options = { + drivers.nvidia.enable = lib.mkEnableOption "Enable proprietary Nvidia drivers"; + }; + + config = lib.mkIf config.drivers.nvidia.enable { + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + nvidiaSettings = false; + package = config.boot.kernelPackages.nvidiaPackages.beta; + open = false; + }; + }; +} diff --git a/system/modules/wireless.nix b/system/modules/wireless.nix deleted file mode 100644 index 25f1c77..0000000 --- a/system/modules/wireless.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - # Enable wireless networkmanager - networking = { - networkmanager.enable = true; - enableB43Firmware = true; - }; -} diff --git a/system/pc.nix b/system/pc.nix new file mode 100644 index 0000000..0b8568c --- /dev/null +++ b/system/pc.nix @@ -0,0 +1,21 @@ +{ ... }: { + imports = [ + # Base configs + ./default.nix + + # Users and groups + ./accounts + + # Modules + ./modules + + # Programs + ./programs + + # Services + ./services/ssh + ./services/sunshine + ./services/mpd + ./services/virtualization + ]; +} diff --git a/system/programs/appimage/default.nix b/system/programs/appimage/default.nix new file mode 100644 index 0000000..a7db39a --- /dev/null +++ b/system/programs/appimage/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + programs.appimage = { + enable = true; + binfmt = true; + }; +} diff --git a/system/programs/default.nix b/system/programs/default.nix new file mode 100644 index 0000000..1f91e59 --- /dev/null +++ b/system/programs/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./appimage + ./gaming + ./git + ./school + ./sway + ./theming + ./wayland + ]; +} diff --git a/system/desktop/gaming.nix b/system/programs/gaming/default.nix similarity index 56% rename from system/desktop/gaming.nix rename to system/programs/gaming/default.nix index 7e9d492..cb47b6b 100644 --- a/system/desktop/gaming.nix +++ b/system/programs/gaming/default.nix @@ -1,10 +1,8 @@ -{pkgs, ...}: { - # Enable Gamemode to boost games +{ pkgs, ... }: { programs.gamemode = { enable = true; settings.general.renice = 10; }; - # Enable hardware like the Steam Controller hardware.steam-hardware.enable = true; } diff --git a/system/programs/git/default.nix b/system/programs/git/default.nix new file mode 100644 index 0000000..9aa21c3 --- /dev/null +++ b/system/programs/git/default.nix @@ -0,0 +1,10 @@ +{ ... }: { + imports = [ + ./gpg + ]; + + programs.git = { + enable = true; + lfs.enable = true; + }; +} diff --git a/system/modules/gpg.nix b/system/programs/git/gpg/default.nix similarity index 59% rename from system/modules/gpg.nix rename to system/programs/git/gpg/default.nix index 917bf20..334fc56 100644 --- a/system/modules/gpg.nix +++ b/system/programs/git/gpg/default.nix @@ -1,7 +1,7 @@ -{pkgs, ...}: { +{ pkgs, ... }: { programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; + enable = true; + enableSSHSupport = true; }; environment.systemPackages = with pkgs; [ git-crypt diff --git a/system/desktop/school.nix b/system/programs/school/default.nix similarity index 68% rename from system/desktop/school.nix rename to system/programs/school/default.nix index 3a0993b..b717b22 100644 --- a/system/desktop/school.nix +++ b/system/programs/school/default.nix @@ -1,5 +1,4 @@ -{pkgs, ...}: { - # Install programs system-wide +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ remmina freerdp @@ -8,6 +7,5 @@ globalprotect-openconnect ]; - # Enable Globalprotect VPN services.globalprotect.enable = true; } diff --git a/system/desktop/sway.nix b/system/programs/sway/default.nix similarity index 94% rename from system/desktop/sway.nix rename to system/programs/sway/default.nix index a9f7f88..d59e8e0 100644 --- a/system/desktop/sway.nix +++ b/system/programs/sway/default.nix @@ -1,6 +1,6 @@ -{pkgs, ...}: { +{ pkgs, ... }: { imports = [ - ./wayland.nix + ./greetd ]; programs.sway = { diff --git a/system/desktop/greetd-sway.nix b/system/programs/sway/greetd/default.nix similarity index 98% rename from system/desktop/greetd-sway.nix rename to system/programs/sway/greetd/default.nix index 11a4bea..152fe4a 100644 --- a/system/desktop/greetd-sway.nix +++ b/system/programs/sway/greetd/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { services = { # Configure greetd for "auto" login (single user only) greetd = let diff --git a/system/programs/theming/default.nix b/system/programs/theming/default.nix new file mode 100644 index 0000000..7727fb3 --- /dev/null +++ b/system/programs/theming/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./qt + ./fonts + ]; +} diff --git a/system/programs/theming/fonts/default.nix b/system/programs/theming/fonts/default.nix new file mode 100644 index 0000000..c0a2569 --- /dev/null +++ b/system/programs/theming/fonts/default.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: { + fonts = { + packages = with pkgs; [ + liberation_ttf + twitter-color-emoji + noto-fonts + sarasa-gothic + ubuntu_font_family + (nerdfonts.override { + fonts = [ + "UbuntuMono" + ]; + }) + ]; + fontconfig.defaultFonts.emoji = [ + "Twitter Color Emoji" + ]; + }; +} diff --git a/system/desktop/qt.nix b/system/programs/theming/qt/default.nix similarity index 88% rename from system/desktop/qt.nix rename to system/programs/theming/qt/default.nix index bf08a3d..8ec8567 100644 --- a/system/desktop/qt.nix +++ b/system/programs/theming/qt/default.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { qt = { enable = true; style = "gtk2"; diff --git a/system/desktop/wayland.nix b/system/programs/wayland/default.nix similarity index 95% rename from system/desktop/wayland.nix rename to system/programs/wayland/default.nix index 12798ad..f3fc805 100644 --- a/system/desktop/wayland.nix +++ b/system/programs/wayland/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { programs = { dconf.enable = true; light.enable = true; diff --git a/system/server.nix b/system/server.nix new file mode 100644 index 0000000..3623eef --- /dev/null +++ b/system/server.nix @@ -0,0 +1,34 @@ +{ ... }: { + imports = [ + # Base configs + ./default.nix + + # Users and groups + ./accounts + + # Modules + ./modules/security/doas + + # Services + ./services/acme + ./services/ddclient + ./services/fileserver + ./services/firewall/server + ./services/forgejo + ./services/icecast + ./services/mailserver + ./services/minecraft + ./services/misc/server + ./services/mysql + ./services/nginx + ./services/social + ./services/ssh + ./services/transmission + ./services/vaultwarden + ./services/wireguard/server + ]; + + environment.systemPackages = with pkgs; [ + mdadm + ]; +} diff --git a/system/server/archived/adguard.nix b/system/server/archived/adguard.nix deleted file mode 100644 index 7712a89..0000000 --- a/system/server/archived/adguard.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - services = { - adguardhome.enable = true; - nginx.virtualHosts."guard.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:3000"; - proxyWebsockets = true; - }; - }; - }; - networking.firewall.allowedUDPPorts = [ 53 ]; -} diff --git a/system/server/archived/gitea.nix b/system/server/archived/gitea.nix deleted file mode 100644 index b8f77b1..0000000 --- a/system/server/archived/gitea.nix +++ /dev/null @@ -1,36 +0,0 @@ -{outputs, ...}: { - services = { - gitea = { - enable = true; - settings = { - server = { - DOMAIN = "gitea.${outputs.secrets.jimDomain}"; - ROOT_URL = "https://gitea.${outputs.secrets.jimDomain}:443"; - HTTP_PORT = 3115; - SSH_PORT = 2295; - START_SSH_SERVER = true; - }; - mailer = { - ENABLED = true; - SMTP_ADDR = "mx.${outputs.secrets.jimDomain}"; - FROM = "Jimbo's Git "; - USER = "noreply@${outputs.secrets.jimDomain}"; - PASSWD = outputs.secrets.noreplyPassword; - PROTOCOL = "smtps"; - }; - service.REGISTER_EMAIL_CONFIRM = true; - }; - }; - nginx.virtualHosts."gitea.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:3115"; - proxyWebsockets = true; - }; - }; - }; - - # Allow Gitea SSH to work - networking.firewall.allowedTCPPorts = [ 2295 ]; -} diff --git a/system/server/archived/pufferpanel.nix b/system/server/archived/pufferpanel.nix deleted file mode 100644 index b9ff0df..0000000 --- a/system/server/archived/pufferpanel.nix +++ /dev/null @@ -1,31 +0,0 @@ -{pkgs, outputs, lib, ...}: { - services = { - pufferpanel = { - enable = true; - environment = { - PUFFER_WEB_HOST = ":5010"; - PUFFER_PANEL_SETTINGS_MASTERURL = "https://panel.${outputs.secrets.jimDomain}"; - PUFFER_PANEL_EMAIL_PROVIDER = "smtp"; - PUFFER_PANEL_EMAIL_HOST = "mx.${outputs.secrets.jimDomain}:587"; - PUFFER_PANEL_EMAIL_FROM = "noreply@${outputs.secrets.jimDomain}"; - PUFFER_PANEL_EMAIL_USERNAME = "noreply@${outputs.secrets.jimDomain}"; - PUFFER_PANEL_EMAIL_PASSWORD = outputs.secrets.noreplyPassword; - }; - extraPackages = with pkgs; [ bash curl gawk gnutar gzip ]; - package = pkgs.buildFHSEnv { - name = "pufferpanel-fhs"; - meta.mainProgram = "pufferpanel-fhs"; - runScript = lib.getExe pkgs.pufferpanel; - targetPkgs = pkgs': with pkgs'; [ icu openssl zlib ]; - }; - }; - nginx.virtualHosts."panel.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:5010"; - proxyWebsockets = true; - }; - }; - }; -} diff --git a/system/server/lemmy.nix b/system/server/lemmy.nix deleted file mode 100644 index 09a2829..0000000 --- a/system/server/lemmy.nix +++ /dev/null @@ -1,25 +0,0 @@ -{outputs, ...}: { - services = { - lemmy = { - enable = true; - nginx.enable = true; - database.createLocally = true; - settings = { - hostname = "lemmy.${outputs.secrets.jimDomain}"; - email = { - smtp_server = "mx.${outputs.secrets.jimDomain}:587"; - smtp_login = "noreply@${outputs.secrets.jimDomain}"; - smtp_from_address = "Jimbo's Lemmy "; - smtp_password = outputs.secrets.noreplyPassword; - tls_type = "starttls"; - }; - }; - }; - - # Add SSL to webpage - nginx.virtualHosts."lemmy.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - }; - }; -} diff --git a/system/server/matrix-discord.nix b/system/server/matrix-discord.nix deleted file mode 100644 index d201dbb..0000000 --- a/system/server/matrix-discord.nix +++ /dev/null @@ -1,16 +0,0 @@ -{outputs, ...}: { - services.matrix-appservice-discord = { - enable = true; - settings = { - auth = { - clientID = "${outputs.secrets.discordBotID}"; - botToken = "${outputs.secrets.discordBotToken}"; - usePrivilegedIntents = true; - }; - bridge = { - domain = "${outputs.secrets.jimDomain}"; - homeserverUrl = "https://matrix.${outputs.secrets.jimDomain}"; - }; - }; - }; -} diff --git a/system/server/misc.nix b/system/server/misc.nix deleted file mode 100644 index 3fea159..0000000 --- a/system/server/misc.nix +++ /dev/null @@ -1,10 +0,0 @@ -{pkgs, ...}: { - # Install programs system-wide - environment.systemPackages = with pkgs; [ - mdadm - ]; - services = { - snowflake-proxy.enable = true; - logrotate.checkConfig = false; - }; -} diff --git a/system/server/owncast.nix b/system/server/owncast.nix deleted file mode 100644 index 332917c..0000000 --- a/system/server/owncast.nix +++ /dev/null @@ -1,18 +0,0 @@ -{outputs, ...}: { - services = { - owncast = { - enable = true; - port = 8060; - rtmp-port = 1945; - listen = "0.0.0.0"; - }; - nginx.virtualHosts."live.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:8060"; - proxyWebsockets = true; - }; - }; - }; -} diff --git a/system/server/synapse.nix b/system/server/synapse.nix deleted file mode 100644 index 303d8a8..0000000 --- a/system/server/synapse.nix +++ /dev/null @@ -1,91 +0,0 @@ -{pkgs, outputs, ...}: { - services = { - # Synapse Matrix server - matrix-synapse = { - enable = true; - settings = { - server_name = "${outputs.secrets.jimDomain}"; - public_baseurl = "https://matrix.${outputs.secrets.jimDomain}"; - suppress_key_server_warning = true; - - # Set the network config - listeners = [{ - port = 8008; - bind_addresses = [ "::" "0.0.0.0" ]; - resources = [ { compress = false; names = [ "client" "federation" ]; } ]; - type = "http"; - tls = false; - x_forwarded = true; - }]; - - # Enable smtp for password resets - email = { - notif_from = "Jimbo's Matrix "; - smtp_host = "mx.${outputs.secrets.jimDomain}"; - smtp_user = "noreply@${outputs.secrets.jimDomain}"; - smtp_pass = outputs.secrets.noreplyPassword; - enable_tls = true; - smtp_port = 587; - require_transport_security = true; - }; - - # Allows a Discord/Matrix bridge, comment on first use and copy using instructions - app_service_config_files = [ - # cp /var/lib/matrix-appservice-discord/discord-registration.yaml /var/lib/matrix-synapse/ - # chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/discord-registration.yaml - "/var/lib/matrix-synapse/discord-registration.yaml" - ]; - - # Disable registration without email - registrations_require_3pid = [ "email" ]; - - # Allow only this range of emails - allowed_local_3pids = [{ - medium = "email"; - pattern = "^[^@]+@jimbosfiles\\.com$"; - }]; - - # Set the type of database - database.name = "sqlite3"; - - # Allow account registration - enable_registration = true; - - # General settings - url_preview_enabled = true; - max_upload_size = "50M"; - report_stats = false; - - # Ratelimiting - burst_count = 15; - }; - }; - - # Sliding sync proxy for Matrix - matrix-sliding-sync = let - matrixSecretFile = pkgs.writeText "matrixsecret" '' - SYNCV3_SECRET=${outputs.secrets.matrixSecret} - ''; - in { - enable = true; - settings = { - SYNCV3_SERVER = "https://matrix.${outputs.secrets.jimDomain}"; - SYNCV3_BINDADDR = "0.0.0.0:8009"; - }; - environmentFile = "${matrixSecretFile}"; - }; - - # Proxy for both Synapse and Sliding Sync - nginx.virtualHosts."matrix.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations = { - "/".extraConfig = ''return 403;''; - "/client".proxyPass = "http://127.0.0.1:8009"; - "/_matrix".proxyPass = "http://127.0.0.1:8008"; - "/_matrix/client/unstable/org.matrix.msc3575/sync".proxyPass = "http://127.0.0.1:8009"; - "/_synapse/client".proxyPass = "http://127.0.0.1:8008"; - }; - }; - }; -} diff --git a/system/server/transmission.nix b/system/server/transmission.nix deleted file mode 100644 index 7b149f9..0000000 --- a/system/server/transmission.nix +++ /dev/null @@ -1,20 +0,0 @@ -{pkgs, outputs, ...}: { - services = { - transmission = { - enable = true; - credentialsFile = pkgs.writeText "credentials" outputs.secrets.transmissionCredFile; - openPeerPorts = true; - settings = { - rpc-authentication-required = true; - }; - }; - nginx.virtualHosts."torrent.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:9091"; - proxyWebsockets = true; - }; - }; - }; -} diff --git a/system/server/vaultwarden.nix b/system/server/vaultwarden.nix deleted file mode 100644 index fd1b859..0000000 --- a/system/server/vaultwarden.nix +++ /dev/null @@ -1,32 +0,0 @@ -{outputs, ...}: { - services = { - vaultwarden = { - enable = true; - config = { - DOMAIN = "https://warden.${outputs.secrets.jimDomain}"; - SIGNUPS_ALLOWED = false; - ROCKET_ADDRESS = "127.0.0.1"; - ROCKET_PORT = 8222; - ROCKET_LOG = "critical"; - - # Smtp email - SMTP_HOST = "mx.${outputs.secrets.jimDomain}"; - SMTP_FROM = "Jimbo's Vaultwarden "; - SMTP_FROM_NAME = "Vaultwarden"; - SMTP_USERNAME = "noreply@${outputs.secrets.jimDomain}"; - SMTP_PASSWORD = outputs.secrets.noreplyPassword; - SMTP_SECURITY = "starttls"; - SMTP_PORT = 587; - SMTP_TIMEOUT = 15; - }; - }; - nginx.virtualHosts."warden.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:8222"; - proxyWebsockets = true; - }; - }; - }; -} diff --git a/system/server/acme.nix b/system/services/acme/default.nix similarity index 93% rename from system/server/acme.nix rename to system/services/acme/default.nix index 1f978c7..542457a 100644 --- a/system/server/acme.nix +++ b/system/services/acme/default.nix @@ -1,4 +1,4 @@ -{outputs, ...}: { +{ outputs, ... }: { security.acme = { acceptTerms = true; defaults.email = outputs.secrets.jimEmail; diff --git a/system/server/ddclient.nix b/system/services/ddclient/default.nix similarity index 96% rename from system/server/ddclient.nix rename to system/services/ddclient/default.nix index 35a08c6..a98fb63 100644 --- a/system/server/ddclient.nix +++ b/system/services/ddclient/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { # Dynamic IPs for Cloudflare records services.ddclient = { enable = true; diff --git a/system/services/fileserver/default.nix b/system/services/fileserver/default.nix new file mode 100644 index 0000000..f22c5da --- /dev/null +++ b/system/services/fileserver/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./local + ./public + ]; +} diff --git a/system/services/fileserver/local/default.nix b/system/services/fileserver/local/default.nix new file mode 100644 index 0000000..3405606 --- /dev/null +++ b/system/services/fileserver/local/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./nfs + ./samba + ]; +} diff --git a/system/server/nfs.nix b/system/services/fileserver/local/nfs/default.nix similarity index 91% rename from system/server/nfs.nix rename to system/services/fileserver/local/nfs/default.nix index fc15404..a90342a 100644 --- a/system/server/nfs.nix +++ b/system/services/fileserver/local/nfs/default.nix @@ -1,4 +1,4 @@ -{ +{ ... }: { services.nfs.server = { enable = true; exports = '' diff --git a/system/server/samba.nix b/system/services/fileserver/local/samba/default.nix similarity index 97% rename from system/server/samba.nix rename to system/services/fileserver/local/samba/default.nix index 2c0da8a..c1cf2c8 100644 --- a/system/server/samba.nix +++ b/system/services/fileserver/local/samba/default.nix @@ -1,4 +1,4 @@ -{outputs, ...}: { +{ outputs, ... }: { services = { samba = { enable = true; diff --git a/system/services/fileserver/public/default.nix b/system/services/fileserver/public/default.nix new file mode 100644 index 0000000..e1b98c7 --- /dev/null +++ b/system/services/fileserver/public/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./nextcloud + ./photoprism + ]; +} diff --git a/system/server/nextcloud.nix b/system/services/fileserver/public/nextcloud/default.nix similarity index 97% rename from system/server/nextcloud.nix rename to system/services/fileserver/public/nextcloud/default.nix index 644bcb2..1ce89bf 100644 --- a/system/server/nextcloud.nix +++ b/system/services/fileserver/public/nextcloud/default.nix @@ -14,8 +14,6 @@ trusted_proxies = [ "127.0.0.1" ]; trusted_domains = [ "cloud.${outputs.secrets.jimDomain}" ]; overwriteprotocol = "https"; - - # Mailserver settings mail_smtphost = "mx.${outputs.secrets.jimDomain}"; mail_domain = "${outputs.secrets.jimDomain}"; mail_from_address = "noreply"; @@ -26,6 +24,7 @@ mail_smtpport = 587; }; }; + nginx.virtualHosts."cloud.${outputs.secrets.jimDomain}" = { enableACME = true; addSSL = true; diff --git a/system/server/photoprism.nix b/system/services/fileserver/public/photoprism/default.nix similarity index 97% rename from system/server/photoprism.nix rename to system/services/fileserver/public/photoprism/default.nix index 4e8283d..013ab1a 100644 --- a/system/server/photoprism.nix +++ b/system/services/fileserver/public/photoprism/default.nix @@ -1,4 +1,4 @@ -{outputs, ...}: { +{ outputs, ... }: { services = { photoprism = { enable = true; diff --git a/system/desktop/firewall.nix b/system/services/firewall/pc/default.nix similarity index 100% rename from system/desktop/firewall.nix rename to system/services/firewall/pc/default.nix diff --git a/system/server/firewall.nix b/system/services/firewall/server/default.nix similarity index 99% rename from system/server/firewall.nix rename to system/services/firewall/server/default.nix index a5a4184..83d5336 100644 --- a/system/server/firewall.nix +++ b/system/services/firewall/server/default.nix @@ -1,4 +1,4 @@ -{outputs, ...}: { +{ outputs, ... }: { # Allow forwarding boot.kernel.sysctl."net.ipv4.ip_forward" = 1; diff --git a/system/server/forgejo.nix b/system/services/forgejo/default.nix similarity index 76% rename from system/server/forgejo.nix rename to system/services/forgejo/default.nix index 3afb1b7..503d68d 100644 --- a/system/server/forgejo.nix +++ b/system/services/forgejo/default.nix @@ -1,5 +1,8 @@ -# This is a hard fork of Gitea. -{outputs, ...}: { +{ outputs, ... }: { + imports = [ + ./nginx + ]; + services = { forgejo = { enable = true; @@ -28,14 +31,6 @@ }; }; }; - nginx.virtualHosts."git.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:3110"; - proxyWebsockets = true; - }; - }; }; # Allow Forgejo's SSH to work diff --git a/system/services/forgejo/nginx/default.nix b/system/services/forgejo/nginx/default.nix new file mode 100644 index 0000000..cb7ffa2 --- /dev/null +++ b/system/services/forgejo/nginx/default.nix @@ -0,0 +1,10 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."git.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:3110"; + proxyWebsockets = true; + }; + }; +} diff --git a/system/services/garbage-collection/default.nix b/system/services/garbage-collection/default.nix new file mode 100644 index 0000000..c06c2d9 --- /dev/null +++ b/system/services/garbage-collection/default.nix @@ -0,0 +1,7 @@ +{ ... }: { + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; +} diff --git a/system/server/icecast.nix b/system/services/icecast/default.nix similarity index 76% rename from system/server/icecast.nix rename to system/services/icecast/default.nix index c33bac3..e75b21d 100644 --- a/system/server/icecast.nix +++ b/system/services/icecast/default.nix @@ -1,14 +1,16 @@ -{pkgs, outputs, ...}: { - # Icecast, replacing Azuracast maybe +{ pkgs, outputs, ... }: { + imports = [ + ./nginx + ]; + services = { - # The host service icecast = { enable = true; listen.port = 265; hostname = "icecast.${outputs.secrets.jimDomain}"; admin = { user = "jimbo"; - password = "${outputs.secrets.castAdminPass}"; + password = "${outputs.secrets.castAdminPass}"; }; extraConf = '' @@ -31,9 +33,8 @@ }; # The audio stream - liquidsoap.streams = let - JimBops = '' - # CONFIGURATION + liquidsoap.streams = { + jimbops = pkgs.writeText "liquidjim" '' settings.log.stdout.set(true) settings.init.allow_root.set(true) settings.scheduler.fast_queues.set(2) @@ -58,21 +59,6 @@ jimbops_fallback ) ''; - in { - jimbops = pkgs.writeText "liquidjim" JimBops; - }; - - # The web frontend - nginx.virtualHosts."icecast.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:265"; - proxyWebsockets = true; - extraConfig = '' - add_header Ice-Public "1"; - ''; - }; }; }; } diff --git a/system/services/icecast/nginx/default.nix b/system/services/icecast/nginx/default.nix new file mode 100644 index 0000000..2e3439e --- /dev/null +++ b/system/services/icecast/nginx/default.nix @@ -0,0 +1,13 @@ +{ pkgs, outputs, ... }: { + services.nginx.virtualHosts."icecast.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:265"; + proxyWebsockets = true; + extraConfig = '' + add_header Ice-Public "1"; + ''; + }; + }; +} diff --git a/system/server/mailserver.nix b/system/services/mailserver/default.nix similarity index 66% rename from system/server/mailserver.nix rename to system/services/mailserver/default.nix index d6ca3ba..589be77 100644 --- a/system/server/mailserver.nix +++ b/system/services/mailserver/default.nix @@ -1,5 +1,9 @@ -{pkgs, outputs, ...}: rec { - # Mail server +{ pkgs, outputs, ... }: rec { + imports = [ + ./nginx + ./roundcube + ]; + mailserver = rec { enable = true; openFirewall = false; @@ -39,30 +43,6 @@ }; }; - # Related services - services = { - # Roundcube mail server - roundcube = { - enable = true; - hostName = "mail.${outputs.secrets.jimDomain}"; - extraConfig = '' - $config['smtp_server'] = "tls://${mailserver.fqdn}"; - $config['smtp_user'] = "%u"; - $config['smtp_pass'] = "%p"; - ''; - }; - - # Force the mailserver to use a different redis port - redis.servers.rspamd.port = 1515; - - # The hostname mail ports use - nginx.virtualHosts."mx.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:1390"; - proxyWebsockets = true; - }; - }; - }; + # Assign the correct port + services.redis.servers.rspamd.port = 1515; } diff --git a/system/services/mailserver/nginx/default.nix b/system/services/mailserver/nginx/default.nix new file mode 100644 index 0000000..8d54dae --- /dev/null +++ b/system/services/mailserver/nginx/default.nix @@ -0,0 +1,10 @@ +{ pkgs, outputs, ... }: rec { + services.nginx.virtualHosts."mx.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:1390"; + proxyWebsockets = true; + }; + }; +} diff --git a/system/services/mailserver/roundcube/default.nix b/system/services/mailserver/roundcube/default.nix new file mode 100644 index 0000000..584b002 --- /dev/null +++ b/system/services/mailserver/roundcube/default.nix @@ -0,0 +1,11 @@ +{ pkgs, outputs, ... }: rec { + services.roundcube = { + enable = true; + hostName = "mail.${outputs.secrets.jimDomain}"; + extraConfig = '' + $config['smtp_server'] = "tls://${mailserver.fqdn}"; + $config['smtp_user'] = "%u"; + $config['smtp_pass'] = "%p"; + ''; + }; +} diff --git a/system/server/minecraft/common.nix b/system/services/minecraft/common/default.nix similarity index 100% rename from system/server/minecraft/common.nix rename to system/services/minecraft/common/default.nix diff --git a/system/server/minecraft/essentialsconfig.yml b/system/services/minecraft/common/essentialsconfig.yml similarity index 100% rename from system/server/minecraft/essentialsconfig.yml rename to system/services/minecraft/common/essentialsconfig.yml diff --git a/system/server/minecraft/vcserver.properties b/system/services/minecraft/common/vcserver.properties similarity index 100% rename from system/server/minecraft/vcserver.properties rename to system/services/minecraft/common/vcserver.properties diff --git a/system/server/minecraft/default.nix b/system/services/minecraft/default.nix similarity index 51% rename from system/server/minecraft/default.nix rename to system/services/minecraft/default.nix index f2f4787..2fc1955 100644 --- a/system/server/minecraft/default.nix +++ b/system/services/minecraft/default.nix @@ -1,13 +1,14 @@ -{inputs, ...}: { +{ inputs, ... }: { imports = [ inputs.minecraft.nixosModules.minecraft-servers - ./servers/velocity.nix - ./servers/dewdemolisher.nix - ./servers/johnside.nix - ./servers/roguecraft.nix - #./servers/blockworld.nix - #./servers/uberbeta.nix + ./servers/velocity + ./servers/dewdemolisher + ./servers/johnside + ./servers/roguecraft + ./servers/blockworld + ./servers/uberbeta ]; + nixpkgs.overlays = [ inputs.minecraft.overlay ]; services.minecraft-servers = { diff --git a/system/server/minecraft/servers/blockworld.nix b/system/services/minecraft/servers/blockworld/default.nix similarity index 96% rename from system/server/minecraft/servers/blockworld.nix rename to system/services/minecraft/servers/blockworld/default.nix index 7f3e96d..93231de 100644 --- a/system/server/minecraft/servers/blockworld.nix +++ b/system/services/minecraft/servers/blockworld/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: let +{ pkgs, ... }: let common = import ../common.nix { inherit pkgs; }; in { services.minecraft-servers.servers.blockworld = { diff --git a/system/server/minecraft/servers/dewdemolisher.nix b/system/services/minecraft/servers/dewdemolisher/default.nix similarity index 96% rename from system/server/minecraft/servers/dewdemolisher.nix rename to system/services/minecraft/servers/dewdemolisher/default.nix index 2c97575..010db5a 100644 --- a/system/server/minecraft/servers/dewdemolisher.nix +++ b/system/services/minecraft/servers/dewdemolisher/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: let +{ pkgs, ... }: let common = import ../common.nix { inherit pkgs; }; in { services.minecraft-servers.servers.dewdemolisher = { diff --git a/system/server/minecraft/servers/johnside.nix b/system/services/minecraft/servers/johnside/default.nix similarity index 98% rename from system/server/minecraft/servers/johnside.nix rename to system/services/minecraft/servers/johnside/default.nix index 6baea7d..5c25506 100644 --- a/system/server/minecraft/servers/johnside.nix +++ b/system/services/minecraft/servers/johnside/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: let +{ pkgs, outputs, ... }: let common = import ../common.nix { inherit pkgs; }; in { services = { diff --git a/system/server/minecraft/servers/roguecraft.nix b/system/services/minecraft/servers/roguecraft/default.nix similarity index 98% rename from system/server/minecraft/servers/roguecraft.nix rename to system/services/minecraft/servers/roguecraft/default.nix index 64b66b8..313e249 100644 --- a/system/server/minecraft/servers/roguecraft.nix +++ b/system/services/minecraft/servers/roguecraft/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: let +{ pkgs, outputs, ... }: let common = import ../common.nix { inherit pkgs; }; in { services = { diff --git a/system/server/minecraft/servers/uberbeta.nix b/system/services/minecraft/servers/uberbeta/default.nix similarity index 97% rename from system/server/minecraft/servers/uberbeta.nix rename to system/services/minecraft/servers/uberbeta/default.nix index b9004dd..ceaf7d5 100644 --- a/system/server/minecraft/servers/uberbeta.nix +++ b/system/services/minecraft/servers/uberbeta/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: let +{ pkgs, ... }: let common = import ../common.nix { inherit pkgs; }; uberBukkitZip = pkgs.fetchzip { url = "https://github.com/Moresteck/Project-Poseidon-Uberbukkit/releases/download/2.0.0/uberbukkit-2.0.0-java17.zip"; diff --git a/system/server/minecraft/servers/velocity.nix b/system/services/minecraft/servers/velocity/default.nix similarity index 99% rename from system/server/minecraft/servers/velocity.nix rename to system/services/minecraft/servers/velocity/default.nix index 6db38c2..c3f1289 100644 --- a/system/server/minecraft/servers/velocity.nix +++ b/system/services/minecraft/servers/velocity/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: let +{ pkgs, ... }: let common = import ../common.nix { inherit pkgs; }; in { services.minecraft-servers.servers.velocity = { diff --git a/system/services/misc/pc/default.nix b/system/services/misc/pc/default.nix new file mode 100644 index 0000000..4e223a2 --- /dev/null +++ b/system/services/misc/pc/default.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + services = { + gvfs.enable = true; + udisks2.enable = true; + }; +} diff --git a/system/services/misc/server/default.nix b/system/services/misc/server/default.nix new file mode 100644 index 0000000..ab24c8f --- /dev/null +++ b/system/services/misc/server/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + services = { + snowflake-proxy.enable = true; + logrotate.checkConfig = false; + }; +} diff --git a/system/services/mpd.nix b/system/services/mpd/default.nix similarity index 94% rename from system/services/mpd.nix rename to system/services/mpd/default.nix index 9f44196..a960102 100644 --- a/system/services/mpd.nix +++ b/system/services/mpd/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: { +{ config, pkgs, ... }: { services.mpd = { enable = true; user = "jimbo"; @@ -12,6 +12,7 @@ } ''; }; + systemd.services.mpd.environment = { XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.jimbo.uid}"; }; diff --git a/system/server/mariadb.nix b/system/services/mysql/default.nix similarity index 96% rename from system/server/mariadb.nix rename to system/services/mysql/default.nix index 8848e80..baf4f2c 100644 --- a/system/server/mariadb.nix +++ b/system/services/mysql/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { services.mysql = { enable = true; package = pkgs.mariadb; diff --git a/system/server/nginx.nix b/system/services/nginx/default.nix similarity index 98% rename from system/server/nginx.nix rename to system/services/nginx/default.nix index 4d2b218..a0a71ce 100644 --- a/system/server/nginx.nix +++ b/system/services/nginx/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { services.nginx = { enable = true; package = (pkgs.nginx.override { diff --git a/system/services/openssh.nix b/system/services/openssh.nix deleted file mode 100644 index 63699ac..0000000 --- a/system/services/openssh.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - # Enable SSH - services = { - openssh = { - enable = true; - settings = { - PermitRootLogin = "no"; - PrintLastLog = "no"; - PasswordAuthentication = false; - UsePAM = false; - }; - }; - - # Block nefarious SSH connections - fail2ban = { - enable = true; - maxretry = 5; - bantime = "5m"; - ignoreIP = [ "10.0.0.0/24" ]; - }; - }; -} diff --git a/system/services/social/default.nix b/system/services/social/default.nix new file mode 100644 index 0000000..724937c --- /dev/null +++ b/system/services/social/default.nix @@ -0,0 +1,9 @@ +{ ... }: { + imports = [ + ./matrix + ./mastodon + ./lemmy + ./pixelfed + ./owncast + ]; +} diff --git a/system/services/social/lemmy/default.nix b/system/services/social/lemmy/default.nix new file mode 100644 index 0000000..9eec59b --- /dev/null +++ b/system/services/social/lemmy/default.nix @@ -0,0 +1,21 @@ +{ outputs, ... }: { + imports = [ + ./nginx + ]; + + services.lemmy = { + enable = true; + nginx.enable = true; + database.createLocally = true; + settings = { + hostname = "lemmy.${outputs.secrets.jimDomain}"; + email = { + smtp_server = "mx.${outputs.secrets.jimDomain}:587"; + smtp_login = "noreply@${outputs.secrets.jimDomain}"; + smtp_from_address = "Jimbo's Lemmy "; + smtp_password = outputs.secrets.noreplyPassword; + tls_type = "starttls"; + }; + }; + }; +} diff --git a/system/services/social/lemmy/nginx/default.nix b/system/services/social/lemmy/nginx/default.nix new file mode 100644 index 0000000..34f156f --- /dev/null +++ b/system/services/social/lemmy/nginx/default.nix @@ -0,0 +1,6 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."lemmy.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + }; +} diff --git a/system/server/mastodon.nix b/system/services/social/mastodon/default.nix similarity index 95% rename from system/server/mastodon.nix rename to system/services/social/mastodon/default.nix index 77f0ff3..ac07cb8 100644 --- a/system/server/mastodon.nix +++ b/system/services/social/mastodon/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { services.mastodon = { enable = true; localDomain = "social.${outputs.secrets.jimDomain}"; diff --git a/system/services/social/matrix/default.nix b/system/services/social/matrix/default.nix new file mode 100644 index 0000000..c74c65d --- /dev/null +++ b/system/services/social/matrix/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./synapse + ./element + ]; +} diff --git a/system/server/element.nix b/system/services/social/matrix/element/default.nix similarity index 72% rename from system/server/element.nix rename to system/services/social/matrix/element/default.nix index 3543b83..b9fc0c6 100644 --- a/system/server/element.nix +++ b/system/services/social/matrix/element/default.nix @@ -1,5 +1,8 @@ -{pkgs, outputs, ...}: { - # Configure the Element web server +{ pkgs, outputs, ... }: { + imports = [ + ./nginx + ]; + nixpkgs.config.element-web.conf = { default_server_config = { "m.homeserver" = { @@ -18,11 +21,4 @@ disable_guests = true; default_theme = "dark"; }; - - # Serve the Element page over Nginx - services.nginx.virtualHosts."chat.${outputs.secrets.jimDomain}" = { - enableACME = true; - addSSL = true; - root = "${pkgs.element-web}"; - }; } diff --git a/system/services/social/matrix/element/nginx/default.nix b/system/services/social/matrix/element/nginx/default.nix new file mode 100644 index 0000000..4dfe86a --- /dev/null +++ b/system/services/social/matrix/element/nginx/default.nix @@ -0,0 +1,7 @@ +{ pkgs, outputs, ... }: { + services.nginx.virtualHosts."chat.${outputs.secrets.jimDomain}" = { + enableACME = true; + addSSL = true; + root = "${pkgs.element-web}"; + }; +} diff --git a/system/server/coturn.nix b/system/services/social/matrix/synapse/coturn/default.nix similarity index 74% rename from system/server/coturn.nix rename to system/services/social/matrix/synapse/coturn/default.nix index 4c77867..729f844 100644 --- a/system/server/coturn.nix +++ b/system/services/social/matrix/synapse/coturn/default.nix @@ -1,6 +1,6 @@ -{outputs, config, ...}: { +{ outputs, config, ... }: { services = { - coturn = rec { + coturn = { enable = true; no-cli = true; no-tcp-relay = true; @@ -22,18 +22,6 @@ turn_shared_secret = config.services.coturn.static-auth-secret; turn_user_lifetime = "1h"; }; - - # Proxy main coturn port - nginx.virtualHosts."turn.${outputs.secrets.jimDomain}" = { - enableACME = true; - forceSSL = true; - listen = [{ - addr = "0.0.0.0"; - port = 80; - ssl = false; - }]; - locations."/".proxyPass = "http://127.0.0.1:1380"; - }; }; # Open coturn ports diff --git a/system/services/social/matrix/synapse/coturn/nginx/default.nix b/system/services/social/matrix/synapse/coturn/nginx/default.nix new file mode 100644 index 0000000..217d78b --- /dev/null +++ b/system/services/social/matrix/synapse/coturn/nginx/default.nix @@ -0,0 +1,12 @@ +{ outputs, config, ... }: { + services.nginx.virtualHosts."turn.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + listen = [{ + addr = "0.0.0.0"; + port = 80; + ssl = false; + }]; + locations."/".proxyPass = "http://127.0.0.1:1380"; + }; +} diff --git a/system/services/social/matrix/synapse/default.nix b/system/services/social/matrix/synapse/default.nix new file mode 100644 index 0000000..6f1691e --- /dev/null +++ b/system/services/social/matrix/synapse/default.nix @@ -0,0 +1,56 @@ +{ pkgs, outputs, ... }: { + imports = [ + ./nginx + ./coturn + ./slidingsync + ]; + + services.matrix-synapse = { + enable = true; + settings = { + server_name = "${outputs.secrets.jimDomain}"; + public_baseurl = "https://matrix.${outputs.secrets.jimDomain}"; + suppress_key_server_warning = true; + + listeners = [{ + port = 8008; + bind_addresses = [ "::" "0.0.0.0" ]; + resources = [ { compress = false; names = [ "client" "federation" ]; } ]; + type = "http"; + tls = false; + x_forwarded = true; + }]; + + email = { + notif_from = "Jimbo's Matrix "; + smtp_host = "mx.${outputs.secrets.jimDomain}"; + smtp_user = "noreply@${outputs.secrets.jimDomain}"; + smtp_pass = outputs.secrets.noreplyPassword; + enable_tls = true; + smtp_port = 587; + require_transport_security = true; + }; + + # Disable registration without email + registrations_require_3pid = [ "email" ]; + + # Allow only this range of emails + allowed_local_3pids = [{ + medium = "email"; + pattern = "^[^@]+@jimbosfiles\\.com$"; + }]; + + # Set the type of database + database.name = "sqlite3"; + + # Allow account registration + enable_registration = true; + + # General settings + url_preview_enabled = true; + max_upload_size = "50M"; + report_stats = false; + burst_count = 15; + }; + }; +} diff --git a/system/services/social/matrix/synapse/nginx/default.nix b/system/services/social/matrix/synapse/nginx/default.nix new file mode 100644 index 0000000..f8141f6 --- /dev/null +++ b/system/services/social/matrix/synapse/nginx/default.nix @@ -0,0 +1,13 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."matrix.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations = { + "/".extraConfig = ''return 403;''; + "/client".proxyPass = "http://127.0.0.1:8009"; + "/_matrix".proxyPass = "http://127.0.0.1:8008"; + "/_matrix/client/unstable/org.matrix.msc3575/sync".proxyPass = "http://127.0.0.1:8009"; + "/_synapse/client".proxyPass = "http://127.0.0.1:8008"; + }; + }; +} diff --git a/system/services/social/matrix/synapse/slidingsync/default.nix b/system/services/social/matrix/synapse/slidingsync/default.nix new file mode 100644 index 0000000..f33e561 --- /dev/null +++ b/system/services/social/matrix/synapse/slidingsync/default.nix @@ -0,0 +1,12 @@ +{ pkgs, outputs, ... }: { + services.matrix-sliding-sync = { + enable = true; + settings = { + SYNCV3_SERVER = "https://matrix.${outputs.secrets.jimDomain}"; + SYNCV3_BINDADDR = "0.0.0.0:8009"; + }; + environmentFile = pkgs.writeText "matrixsecret" '' + SYNCV3_SECRET=${outputs.secrets.matrixSecret} + ''; + }; +} diff --git a/system/services/social/owncast/default.nix b/system/services/social/owncast/default.nix new file mode 100644 index 0000000..3404df9 --- /dev/null +++ b/system/services/social/owncast/default.nix @@ -0,0 +1,12 @@ +{ outputs, ... }: { + imports = [ + ./nginx + ]; + + services.owncast = { + enable = true; + port = 8060; + rtmp-port = 1945; + listen = "0.0.0.0"; + }; +} diff --git a/system/services/social/owncast/nginx/default.nix b/system/services/social/owncast/nginx/default.nix new file mode 100644 index 0000000..cfaf8a1 --- /dev/null +++ b/system/services/social/owncast/nginx/default.nix @@ -0,0 +1,10 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."live.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8060"; + proxyWebsockets = true; + }; + }; +} diff --git a/system/server/pixelfed.nix b/system/services/social/pixelfed/default.nix similarity index 97% rename from system/server/pixelfed.nix rename to system/services/social/pixelfed/default.nix index bc5b62b..50ac38e 100644 --- a/system/server/pixelfed.nix +++ b/system/services/social/pixelfed/default.nix @@ -1,4 +1,4 @@ -{pkgs, outputs, ...}: { +{ pkgs, outputs, ... }: { services.pixelfed = { enable = true; domain = "pics.${outputs.secrets.jimDomain}"; diff --git a/system/services/ssh/default.nix b/system/services/ssh/default.nix new file mode 100644 index 0000000..589248a --- /dev/null +++ b/system/services/ssh/default.nix @@ -0,0 +1,15 @@ +{ ... }: { + imports = [ + ./fail2ban + ]; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PrintLastLog = "no"; + PasswordAuthentication = false; + UsePAM = false; + }; + }; +} diff --git a/system/services/ssh/fail2ban/default.nix b/system/services/ssh/fail2ban/default.nix new file mode 100644 index 0000000..00206d1 --- /dev/null +++ b/system/services/ssh/fail2ban/default.nix @@ -0,0 +1,8 @@ +{ outputs, ... }: { + services.fail2ban = { + enable = true; + maxretry = 5; + bantime = "5m"; + ignoreIP = [ "${outputs.ips.localSpan}.0/24" ]; + }; +} diff --git a/system/services/sunshine.nix b/system/services/sunshine/default.nix similarity index 74% rename from system/services/sunshine.nix rename to system/services/sunshine/default.nix index e1f2387..053332c 100644 --- a/system/services/sunshine.nix +++ b/system/services/sunshine/default.nix @@ -1,5 +1,4 @@ -{ - # Enable Sunshine as a service +{ ... }: { services.sunshine = { enable = true; settings.port = 57989; diff --git a/system/services/transmission/default.nix b/system/services/transmission/default.nix new file mode 100644 index 0000000..8bd07a7 --- /dev/null +++ b/system/services/transmission/default.nix @@ -0,0 +1,14 @@ +{ pkgs, outputs, ... }: { + imports = [ + ./nginx + ]; + + services.transmission = { + enable = true; + credentialsFile = pkgs.writeText "credentials" outputs.secrets.transmissionCredFile; + openPeerPorts = true; + settings = { + rpc-authentication-required = true; + }; + }; +} diff --git a/system/services/transmission/nginx/default.nix b/system/services/transmission/nginx/default.nix new file mode 100644 index 0000000..498005b --- /dev/null +++ b/system/services/transmission/nginx/default.nix @@ -0,0 +1,10 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."torrent.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:9091"; + proxyWebsockets = true; + }; + }; +} diff --git a/system/services/udev.nix b/system/services/udev.nix deleted file mode 100644 index 2fef6c2..0000000 --- a/system/services/udev.nix +++ /dev/null @@ -1,21 +0,0 @@ -{pkgs, ...}: { - # Make udev rules to make PDP controller and Oculus Rift CV1 work - services.udev = let - oculusRules = pkgs.writeTextFile { - name = "10-oculus.rules"; - text = '' - KERNEL=="hidraw*", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0184", MODE="0660", TAG+="uaccess" - ''; - destination = "/etc/udev/rules.d/10-oculus.rules"; - }; - pdpRules = pkgs.writeTextFile { - name = "10-pdp.rules"; - text = '' - SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666" - ''; - destination = "/etc/udev/rules.d/10-pdp.rules"; - }; - in { - packages = [oculusRules pdpRules]; - }; -} diff --git a/system/services/vaultwarden/default.nix b/system/services/vaultwarden/default.nix new file mode 100644 index 0000000..705f0ef --- /dev/null +++ b/system/services/vaultwarden/default.nix @@ -0,0 +1,26 @@ +{ outputs, ... }: { + imports = [ + ./nginx + ]; + + services.vaultwarden = { + enable = true; + config = { + DOMAIN = "https://warden.${outputs.secrets.jimDomain}"; + SIGNUPS_ALLOWED = false; + ROCKET_ADDRESS = "127.0.0.1"; + ROCKET_PORT = 8222; + ROCKET_LOG = "critical"; + + # Smtp email + SMTP_HOST = "mx.${outputs.secrets.jimDomain}"; + SMTP_FROM = "Jimbo's Vaultwarden "; + SMTP_FROM_NAME = "Vaultwarden"; + SMTP_USERNAME = "noreply@${outputs.secrets.jimDomain}"; + SMTP_PASSWORD = outputs.secrets.noreplyPassword; + SMTP_SECURITY = "starttls"; + SMTP_PORT = 587; + SMTP_TIMEOUT = 15; + }; + }; +} diff --git a/system/services/vaultwarden/nginx/default.nix b/system/services/vaultwarden/nginx/default.nix new file mode 100644 index 0000000..35638f8 --- /dev/null +++ b/system/services/vaultwarden/nginx/default.nix @@ -0,0 +1,10 @@ +{ outputs, ... }: { + services.nginx.virtualHosts."warden.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8222"; + proxyWebsockets = true; + }; + }; +} diff --git a/system/services/virtualization/default.nix b/system/services/virtualization/default.nix new file mode 100644 index 0000000..f17d95e --- /dev/null +++ b/system/services/virtualization/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./qemu + ./waydroid + ]; +} diff --git a/system/services/qemukvm.nix b/system/services/virtualization/qemu/default.nix similarity index 96% rename from system/services/qemukvm.nix rename to system/services/virtualization/qemu/default.nix index f50caa9..5daeb19 100644 --- a/system/services/qemukvm.nix +++ b/system/services/virtualization/qemu/default.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: { +{ config, pkgs, ... }: { virtualisation = { libvirtd = { enable = true; diff --git a/system/services/virtualization/waydroid/default.nix b/system/services/virtualization/waydroid/default.nix new file mode 100644 index 0000000..0751a8e --- /dev/null +++ b/system/services/virtualization/waydroid/default.nix @@ -0,0 +1,9 @@ +{ config, lib, ... }: { + options = { + misc.waydroid.enable = lib.mkEnableOption "Enable proprietary Nvidia drivers"; + }; + + config = lib.mkIf config.misc.waydroid.enable { + virtualisation.waydroid.enable = true; + }; +} diff --git a/system/services/waydroid.nix b/system/services/waydroid.nix deleted file mode 100644 index 00ff0d9..0000000 --- a/system/services/waydroid.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - virtualisation.waydroid.enable = true; -} diff --git a/system/desktop/wireguard.nix b/system/services/wireguard/client/default.nix similarity index 100% rename from system/desktop/wireguard.nix rename to system/services/wireguard/client/default.nix diff --git a/system/server/wireguard.nix b/system/services/wireguard/server/default.nix similarity index 96% rename from system/server/wireguard.nix rename to system/services/wireguard/server/default.nix index f7ebfd5..94b215e 100644 --- a/system/server/wireguard.nix +++ b/system/services/wireguard/server/default.nix @@ -1,5 +1,4 @@ -{outputs, ...}: { - # Enable NAT +{ outputs, ... }: { networking = { nat = { enable = true; diff --git a/system/users/groups.nix b/system/users/groups.nix deleted file mode 100644 index 334f839..0000000 --- a/system/users/groups.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - # Define custom groups - users.groups = { - nfsShare = {}; - }; -}