From 892de67a9f64d0b0cdb023d830a019d8feec0a57 Mon Sep 17 00:00:00 2001 From: Jakub Stachurski Date: Wed, 19 Nov 2025 21:02:52 +0100 Subject: Nix fmt --- common.nix | 63 ++-- flake.nix | 94 +++--- home-modules/apps/default.nix | 100 ++++--- home-modules/apps/desktop/default.nix | 200 +++++++------ home-modules/apps/desktop/floorp.nix | 3 +- home-modules/apps/desktop/ghidra.nix | 4 +- home-modules/apps/desktop/wine.nix | 11 +- home-modules/apps/nvim/default.nix | 90 +++--- home-modules/apps/zsh.nix | 14 +- home-modules/default.nix | 21 +- home-modules/desktop/default.nix | 8 +- home-modules/desktop/hyprland.nix | 437 +++++++++++++++------------- home-modules/desktop/wayland/default.nix | 8 +- home-modules/desktop/wayland/mako.nix | 14 +- home-modules/desktop/wayland/waybar.nix | 220 ++++++++------ home-modules/services/default.nix | 11 +- home-modules/services/direnv.nix | 17 +- home-modules/services/syncthing.nix | 14 +- home-modules/services/vdirsyncer.nix | 43 +-- home-modules/theming.nix | 50 ++-- home/live-user.nix | 21 +- home/wilkuu.nix | 36 ++- hosts/apocalypse/backup.nix | 46 +-- hosts/apocalypse/default.nix | 146 +++++----- hosts/apocalypse/firewall.nix | 43 +-- hosts/apocalypse/hardware-configuration.nix | 151 ++++++---- hosts/apocalypse/nvidia.nix | 36 ++- hosts/full-iso/default.nix | 15 +- hosts/test_vm/default.nix | 21 +- modules/btrfs.nix | 19 +- modules/default.nix | 10 +- modules/desktop/common.nix | 66 +++-- modules/desktop/default.nix | 73 ++--- modules/desktop/steam.nix | 100 ++++--- modules/desktop/wayland.nix | 14 +- modules/desktop/wms/default.nix | 3 +- modules/desktop/wms/hyprland.nix | 83 +++--- modules/desktop/wms/xfce.nix | 75 ++--- modules/desktop/x11.nix | 20 +- modules/gpg.nix | 19 +- modules/lan-certs.nix | 6 +- modules/remote-builder.nix | 100 +++---- modules/virt.nix | 39 +-- modules/vpn.nix | 37 ++- users/live-user.nix | 39 ++- users/user-common.nix | 39 ++- users/wilkuu.nix | 43 ++- 47 files changed, 1529 insertions(+), 1193 deletions(-) diff --git a/common.nix b/common.nix index fcc7105..f6c036c 100644 --- a/common.nix +++ b/common.nix @@ -1,10 +1,19 @@ -{pkgs, lib, inputs, config,...}: { +{ + pkgs, + lib, + inputs, + config, + ... +}: +{ imports = [ ./modules - ]; - + ]; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nixpkgs = { config = { permittedInsecurePackages = [ @@ -16,9 +25,9 @@ time.timeZone = "Europe/Amsterdam"; # Set timezone sops.defaultSopsFile = ./secrets/secrets.yaml; - sops.age.sshKeyPaths = ["/etc/ssh_host_ed25519_key"]; - sops.age.keyFile = "/var/lib/sops-nix/key.txt"; - sops.age.generateKey = true; + sops.age.sshKeyPaths = [ "/etc/ssh_host_ed25519_key" ]; + sops.age.keyFile = "/var/lib/sops-nix/key.txt"; + sops.age.generateKey = true; systemd.oomd = { enable = true; @@ -26,16 +35,16 @@ enableSystemSlice = true; enableRootSlice = true; extraConfig = { - SwapUsedLimit="50%"; - DefaultMemoryPressureLimit="50%"; - DefaultMemoryPressureDurationSec=20; + SwapUsedLimit = "50%"; + DefaultMemoryPressureLimit = "50%"; + DefaultMemoryPressureDurationSec = 20; }; }; nix.gc = { - automatic = true; - dates = "weekly"; + automatic = true; + dates = "weekly"; options = "--delete-older-than 30d"; }; systemd.services.nix-daemon.serviceConfig = { @@ -46,44 +55,44 @@ environment.systemPackages = with pkgs; [ htop - btop - nmap + btop + nmap dig - ripgrep - unzip + ripgrep + unzip sshfs ranger file - lm_sensors + lm_sensors # Needed for getting credentials age - sops - + sops + bashInteractive coreutils utillinux iproute2 iputils - pciutils + pciutils usbutils vim # TODO: Dev stuff, move later - # This could really make the image smaller + # This could really make the image smaller git pkg-config - cmake - ( hiPrio gcc) + cmake + (hiPrio gcc) gnumake clang rustup ]; - + networking.hosts = { - "0.0.0.0" = ["apresolve.spotify.com"]; + "0.0.0.0" = [ "apresolve.spotify.com" ]; }; - # This option defines the first version of NixOS you have installed on this particular machine, + # This option defines the first version of NixOS you have installed on this particular machine, # DO NOT CHANGE UNLESS USING NIXOS-INSTALL system.stateVersion = "24.11"; # Did you read the comment? -} +} diff --git a/flake.nix b/flake.nix index b10155a..682e2b0 100644 --- a/flake.nix +++ b/flake.nix @@ -5,65 +5,69 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05"; - sops-nix = { - url = "github:Mic92/sops-nix"; + sops-nix = { + url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; }; tatuin = { url = "github:Wilkuu-2/tatuin/flake"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, ... }@inputs: { - packages."x86_64-linux".full-iso = self.nixosConfigurations.full-iso.config.system.build.isoImage; - nixosConfigurations = { - - apocalypse = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; + outputs = + { self, nixpkgs, ... }@inputs: + { + # packages."x86_64-linux".full-iso = self.nixosConfigurations.full-iso.config.system.build.isoImage; + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; + + nixosConfigurations = { + apocalypse = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + }; + system = "x86_64-linux"; + modules = [ + ./common.nix + ./hosts/apocalypse + ./users/wilkuu.nix + inputs.home-manager.nixosModules.default + inputs.sops-nix.nixosModules.sops + ]; }; - system = "x86_64-linux"; - modules = [ - ./common.nix - ./hosts/apocalypse - ./users/wilkuu.nix - inputs.home-manager.nixosModules.default - inputs.sops-nix.nixosModules.sops - ]; - }; - test_vm = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; + test_vm = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + }; + system = "x86_64-linux"; + modules = [ + ./common.nix + ./hosts/test_vm + ./users/wilkuu.nix + inputs.home-manager.nixosModules.default + ]; }; - system = "x86_64-linux"; - modules = [ - ./common.nix - ./hosts/test_vm - ./users/wilkuu.nix - inputs.home-manager.nixosModules.default - ]; - }; - full-iso = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - isoImage.squashfsCompression = "lz4"; - isoImage.isoLabel = "NIX_WQ_ISO"; + full-iso = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + isoImage.squashfsCompression = "lz4"; + isoImage.isoLabel = "NIX_WQ_ISO"; + }; + system = "x86_64-linux"; + modules = [ + ./common.nix + ./hosts/full-iso + ./users/live-user.nix + inputs.home-manager.nixosModules.default + ]; }; - system = "x86_64-linux"; - modules = [ - ./common.nix - ./hosts/full-iso - ./users/live-user.nix - inputs.home-manager.nixosModules.default - ]; }; }; - }; } diff --git a/home-modules/apps/default.nix b/home-modules/apps/default.nix index 5c920fd..ba19780 100644 --- a/home-modules/apps/default.nix +++ b/home-modules/apps/default.nix @@ -1,39 +1,44 @@ -{lib, pkgs, inputs, config, ...}: +{ + lib, + pkgs, + inputs, + config, + ... +}: with lib; let -cfg = config.homeapps.presets; -in + cfg = config.homeapps.presets; +in { - imports = [ - ./nvim - ./desktop - ./zsh.nix - ]; + imports = [ + ./nvim + ./desktop + ./zsh.nix + ]; options.homeapps.presets = { - base.enable = lib.mkOption { - type = lib.types.bool; - default = true; - description ="Enable basics for home-config"; - } ; - full.enable = lib.mkEnableOption "Enable everything" ; + base.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Enable basics for home-config"; + }; + full.enable = lib.mkEnableOption "Enable everything"; email.enable = lib.mkEnableOption "Enable email-related config"; browser.enable = lib.mkEnableOption "Enable the browser (librewolf)"; comms.enable = lib.mkEnableOption "Enable communication-related config"; - utils.enable = lib.mkEnableOption "Enable utilities" ; - note-taking.enable = lib.mkEnableOption "Enable note taking apps"; - art.enable = lib.mkEnableOption "Enable art apps config"; - work.enable = lib.mkEnableOption "Enable research-related config"; - dev.enable = lib.mkEnableOption "Enable development apps"; - connectivity.enable = lib.mkEnableOption "Enable connectivity"; - multimedia.enable = lib.mkEnableOption "Enable multimedia apps"; - games.enable = lib.mkEnableOption "Enable games"; + utils.enable = lib.mkEnableOption "Enable utilities"; + note-taking.enable = lib.mkEnableOption "Enable note taking apps"; + art.enable = lib.mkEnableOption "Enable art apps config"; + work.enable = lib.mkEnableOption "Enable research-related config"; + dev.enable = lib.mkEnableOption "Enable development apps"; + connectivity.enable = lib.mkEnableOption "Enable connectivity"; + multimedia.enable = lib.mkEnableOption "Enable multimedia apps"; + games.enable = lib.mkEnableOption "Enable games"; }; - config = lib.mkMerge [ (lib.mkIf cfg.full.enable { - homeapps.presets = { + homeapps.presets = { base.enable = true; email.enable = true; browser.enable = true; @@ -50,11 +55,11 @@ in }) (lib.mkIf cfg.base.enable { home.packages = with pkgs; [ - lm_sensors + lm_sensors nix-output-monitor ]; - homeapps.zsh.enable = true; - homeapps.nvim.enable = true; + homeapps.zsh.enable = true; + homeapps.nvim.enable = true; }) (lib.mkIf cfg.email.enable { home.packages = with pkgs; [ @@ -68,11 +73,11 @@ in (lib.mkIf cfg.utils.enable { home.packages = with pkgs; [ htop - btop - nmap + btop + nmap dig - ripgrep - unzip + ripgrep + unzip unrar sshfs xdg-user-dirs @@ -82,17 +87,18 @@ in ]; }) (lib.mkIf cfg.note-taking.enable { - home.packages = with pkgs; [ ]; - # Todo force synthing to be on here + home.packages = [ ]; + # Todo force synthing to be on here }) (lib.mkIf cfg.work.enable { home.packages = with pkgs; [ + inputs.tatuin.packages.${pkgs.system}.default ]; }) (lib.mkIf cfg.dev.enable { home.packages = with pkgs; [ - cmake - ( hiPrio gcc) + cmake + (hiPrio gcc) gnumake clang rustup @@ -103,11 +109,11 @@ in }) (lib.mkIf cfg.connectivity.enable { home.packages = with pkgs; [ - eduvpn-client + eduvpn-client ]; # services.syncthing = { - # enable = true; - # }; + # enable = true; + # }; }) (lib.mkIf cfg.multimedia.enable { home.packages = with pkgs; [ @@ -115,23 +121,23 @@ in playerctl ]; - services.playerctld.enable = true; + services.playerctld.enable = true; services.spotifyd = { - enable = true; + enable = true; settings = { global = { - use-mpris = true; - device_name = "Apocalypse Nix"; - }; + use-mpris = true; + device_name = "Apocalypse Nix"; + }; discovery = { - zeroconf_port = 5352; + zeroconf_port = 5352; }; audio = { - backend="pulse"; + backend = "pulse"; }; - ## Fixes spotifyd for some reason + ## Fixes spotifyd for some reason # FIXME: Add a hook for notifications - }; + }; }; }) (lib.mkIf cfg.games.enable { diff --git a/home-modules/apps/desktop/default.nix b/home-modules/apps/desktop/default.nix index 5eb14f3..c326607 100644 --- a/home-modules/apps/desktop/default.nix +++ b/home-modules/apps/desktop/default.nix @@ -1,100 +1,108 @@ -{lib, pkgs, config ,hostconfig, ...}: -let - cfg = config.homeapps.presets; -in { - imports = [ + lib, + pkgs, + config, + hostconfig, + ... +}: +let + cfg = config.homeapps.presets; +in +{ + imports = [ ./floorp.nix ]; - - config = lib.mkIf hostconfig.addons.desktop.enable or false (lib.mkMerge [ - (lib.mkIf cfg.base.enable { - home.packages = with pkgs; [ - # Base - evince - kitty - mpv - #Theme - qt6Packages.qt6ct - kdePackages.qtstyleplugin-kvantum - (catppuccin-kvantum.override { - accent = "pink"; - variant = "mocha"; - }) - ]; - }) - (lib.mkIf cfg.email.enable { - home.packages = with pkgs; [ - thunderbird - ]; - }) - (lib.mkIf cfg.comms.enable { - home.packages = with pkgs; [ - element-desktop - vesktop - ]; - }) - (lib.mkIf cfg.utils.enable { - home.packages = with pkgs; [ - kdePackages.filelight - qalculate-qt - gparted - ]; - }) - (lib.mkIf cfg.note-taking.enable { - home.packages = with pkgs; [ obsidian ]; - # Todo force synthing to be on here - }) - (lib.mkIf cfg.art.enable { - home.packages = with pkgs; [ - krita - inkscape - ]; - }) - (lib.mkIf cfg.browser.enable { - home.packages = with pkgs; [ - librewolf - ]; - }) - (lib.mkIf cfg.work.enable { - home.packages = with pkgs; [ - libreoffice-qt6-fresh - zotero - ]; - }) - (lib.mkIf cfg.dev.enable { - home.packages = with pkgs; [ - hugo - wireshark-qt - ]; - }) - (lib.mkIf cfg.connectivity.enable { - home.packages = with pkgs; [ - kdePackages.kdeconnect-kde - eduvpn-client - ]; - services.syncthing = { - tray = { - enable = true; - command = "syncthingtray --wait"; - }; - }; - }) - (lib.mkIf cfg.multimedia.enable { - home.packages = with pkgs; [ - ani-cli - vlc - # Spotify (The proprietary frontend) - riff - ]; - }) - (lib.mkIf cfg.games.enable { - home.packages = with pkgs; [ - # Games - prismlauncher - openttd - anki-bin - ]; - }) - ]); + + config = lib.mkIf hostconfig.addons.desktop.enable or false ( + lib.mkMerge [ + (lib.mkIf cfg.base.enable { + home.packages = with pkgs; [ + # Base + evince + kitty + mpv + #Theme + qt6Packages.qt6ct + kdePackages.qtstyleplugin-kvantum + (catppuccin-kvantum.override { + accent = "pink"; + variant = "mocha"; + }) + ]; + }) + (lib.mkIf cfg.email.enable { + home.packages = with pkgs; [ + thunderbird + ]; + }) + (lib.mkIf cfg.comms.enable { + home.packages = with pkgs; [ + element-desktop + vesktop + ]; + }) + (lib.mkIf cfg.utils.enable { + home.packages = with pkgs; [ + kdePackages.filelight + qalculate-qt + gparted + ]; + }) + (lib.mkIf cfg.note-taking.enable { + home.packages = with pkgs; [ obsidian ]; + # Todo force synthing to be on here + }) + (lib.mkIf cfg.art.enable { + home.packages = with pkgs; [ + krita + inkscape + ]; + }) + (lib.mkIf cfg.browser.enable { + home.packages = with pkgs; [ + librewolf + ]; + }) + (lib.mkIf cfg.work.enable { + home.packages = with pkgs; [ + libreoffice-qt6-fresh + zotero + ]; + }) + (lib.mkIf cfg.dev.enable { + home.packages = with pkgs; [ + hugo + wireshark-qt + ]; + }) + (lib.mkIf cfg.connectivity.enable { + home.packages = with pkgs; [ + kdePackages.kdeconnect-kde + eduvpn-client + ]; + services.syncthing = { + tray = { + enable = true; + command = "syncthingtray --wait"; + }; + }; + }) + (lib.mkIf cfg.multimedia.enable { + home.packages = with pkgs; [ + ani-cli + vlc + # Spotify (The proprietary frontend) + riff + ]; + }) + (lib.mkIf cfg.games.enable { + home.packages = with pkgs; [ + # Games + prismlauncher + openttd + anki-bin + ]; + }) + ] + ); } diff --git a/home-modules/apps/desktop/floorp.nix b/home-modules/apps/desktop/floorp.nix index 2d8cadb..b5b2cec 100644 --- a/home-modules/apps/desktop/floorp.nix +++ b/home-modules/apps/desktop/floorp.nix @@ -1,2 +1,3 @@ -{pkgs, config, ...}: { +{ pkgs, config, ... }: +{ } diff --git a/home-modules/apps/desktop/ghidra.nix b/home-modules/apps/desktop/ghidra.nix index 7bbcd0a..6e5b8c3 100644 --- a/home-modules/apps/desktop/ghidra.nix +++ b/home-modules/apps/desktop/ghidra.nix @@ -1,3 +1,3 @@ -{pkgs, ...}: +{ pkgs, ... }: { -} +} diff --git a/home-modules/apps/desktop/wine.nix b/home-modules/apps/desktop/wine.nix index 4aa00b6..a23f44a 100644 --- a/home-modules/apps/desktop/wine.nix +++ b/home-modules/apps/desktop/wine.nix @@ -1,7 +1,12 @@ -{pkgs, config, lib, ...}: { - home.packages = with pkgs; [ + pkgs, + config, + lib, + ... +}: +{ + home.packages = with pkgs; [ wineWowPackages.waylandFull winetricks - ]; + ]; } diff --git a/home-modules/apps/nvim/default.nix b/home-modules/apps/nvim/default.nix index 58a7dda..f45095f 100644 --- a/home-modules/apps/nvim/default.nix +++ b/home-modules/apps/nvim/default.nix @@ -1,26 +1,32 @@ -{ pkgs, config, lib,...}: +{ + pkgs, + config, + lib, + ... +}: let -ts_ls=pkgs.typescript-language-server; -vue_ls=pkgs.vue-language-server; -in { + ts_ls = pkgs.typescript-language-server; + vue_ls = pkgs.vue-language-server; +in +{ options.homeapps.nvim = { - enable = lib.mkEnableOption "Enables neovim configuration"; + enable = lib.mkEnableOption "Enables neovim configuration"; }; - config = lib.mkIf config.homeapps.nvim.enable { + config = lib.mkIf config.homeapps.nvim.enable { programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withPython3 = true; - withNodeJs = true; - withRuby = true; - - coc.enable = false; - plugins = [ - ]; + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withPython3 = true; + withNodeJs = true; + withRuby = true; + + coc.enable = false; + plugins = [ + ]; }; home.file."./.config/nvim/lua/wilkuu/init.lua".text = '' @@ -36,28 +42,34 @@ in { home.sessionPath = [ "/home/wilkuu/.npm/bin/" - ]; + ]; - home.packages = with pkgs; [ - lua - lua-language-server - gopls - go - typescript - nodejs_22 - rustup - nil - statix - nixfmt-rfc-style - # phpactor - pyright - nodePackages.intelephense - texlive.combined.scheme-medium - texlab - mermaid-cli - ltex-ls - deno - ] ++ [ ts_ls vue_ls]; + home.packages = + with pkgs; + [ + lua + lua-language-server + gopls + go + typescript + nodejs_22 + rustup + nil + statix + nixfmt-rfc-style + # phpactor + pyright + nodePackages.intelephense + texlive.combined.scheme-medium + texlab + mermaid-cli + ltex-ls + deno + ] + ++ [ + ts_ls + vue_ls + ]; }; } diff --git a/home-modules/apps/zsh.nix b/home-modules/apps/zsh.nix index b979a83..9a7c84d 100644 --- a/home-modules/apps/zsh.nix +++ b/home-modules/apps/zsh.nix @@ -1,4 +1,10 @@ -{config ,pkgs, lib, ...}: { +{ + config, + pkgs, + lib, + ... +}: +{ options.homeapps.zsh = { enable = lib.mkEnableOption "Enable ZSH shell"; }; @@ -6,10 +12,10 @@ config = lib.mkIf config.homeapps.zsh.enable { programs.zsh = { - enable = true; + enable = true; enableCompletion = true; oh-my-zsh = { - enable = true; + enable = true; theme = "clean"; }; plugins = [ @@ -24,6 +30,6 @@ }; } ]; - }; + }; }; } diff --git a/home-modules/default.nix b/home-modules/default.nix index 46db559..dec54f1 100644 --- a/home-modules/default.nix +++ b/home-modules/default.nix @@ -1,9 +1,20 @@ -{pkgs, config ,...}: { - imports = [./theming.nix ./apps ./desktop ./services ]; +{ + pkgs, + config, + input, + ... +}: +{ + imports = [ + ./theming.nix + ./apps + ./desktop + ./services + ]; sops = { - age.keyFile = "/home/${config.home.username}/.config/sops/age/keys.txt"; - defaultSopsFile = ../secrets/secrets.yaml; + age.keyFile = "/home/${config.home.username}/.config/sops/age/keys.txt"; + defaultSopsFile = ../secrets/secrets.yaml; }; -} +} diff --git a/home-modules/desktop/default.nix b/home-modules/desktop/default.nix index d02f217..6e88a5c 100644 --- a/home-modules/desktop/default.nix +++ b/home-modules/desktop/default.nix @@ -1,4 +1,8 @@ -{pkgs, hostconfig, ...}: { - imports = [./wayland ./hyprland.nix]; +{ pkgs, hostconfig, ... }: +{ + imports = [ + ./wayland + ./hyprland.nix + ]; } diff --git a/home-modules/desktop/hyprland.nix b/home-modules/desktop/hyprland.nix index 6f36b2f..f714650 100644 --- a/home-modules/desktop/hyprland.nix +++ b/home-modules/desktop/hyprland.nix @@ -1,4 +1,10 @@ -{lib, pkgs, config, hostconfig , ...}: +{ + lib, + pkgs, + config, + hostconfig, + ... +}: with lib; { config = mkIf hostconfig.addons.desktop.hyprland.enable { @@ -7,248 +13,261 @@ with lib; wofi hyprshot networkmanagerapplet - xdg-desktop-portal-gnome + xdg-desktop-portal-gnome xdg-desktop-portal-hyprland wl-clipboard brightnessctl ]; - services.hyprpolkitagent.enable = true; + services.hyprpolkitagent.enable = true; homeprogs.waybar.enable = true; homeprogs.mako.enable = true; # Environment variables for hyprland. # This can be used to configure wayland/hyprland-specific things home.file.".config/uwsm/env-hyprland".text = '' - export XDG_SESSION_TYPE=wayland - export GDK_BACKEND=wayland - export GTK_USE_PORTAL=1 - export QT_QPA_PLATFORM=wayland;xcb - export QT_STYLE_OVERRIDE=kvantum - export QT_QPA_PLATFORM_THEME=kvantum - export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 - export QT_AUTO_SCREEN_SCALE_FACTOR=1 - export MOZ_ENABLE_WAYLAND=1 - export -n GTK_IM_MODULE + export XDG_SESSION_TYPE=wayland + export GDK_BACKEND=wayland + export GTK_USE_PORTAL=1 + export QT_QPA_PLATFORM=wayland;xcb + export QT_STYLE_OVERRIDE=kvantum + export QT_QPA_PLATFORM_THEME=kvantum + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + export QT_AUTO_SCREEN_SCALE_FACTOR=1 + export MOZ_ENABLE_WAYLAND=1 + export -n GTK_IM_MODULE ''; - # Hyprland + # Hyprland wayland.windowManager.hyprland = { - systemd.enable = false; - enable = true; - xwayland.enable = true; - settings = { - exec-once = map (s: "uwsm app -- " + s) [ - "kitty &" - "waybar &" - "nm-applet &" - "blueman-tray &" - "blueman-applet &" - "hyprctl setcursor Catppuccin-Mocha-Dark-Cursors 24" - "kdeconnect-indicator &" - # "fcitx5 -d" - ] ++ [ + systemd.enable = false; + enable = true; + xwayland.enable = true; + settings = { + exec-once = + map (s: "uwsm app -- " + s) [ + "kitty &" + "waybar &" + "nm-applet &" + "blueman-tray &" + "blueman-applet &" + "hyprctl setcursor Catppuccin-Mocha-Dark-Cursors 24" + "kdeconnect-indicator &" + # "fcitx5 -d" + ] + ++ [ "systemctl --user start hypridle.service" "systemctl --user start hyprpaper.service" "systemctl --user start hyprpolkitagent.service" "uwsm finalize QT_QPA_PLATFORM QT_PLUGIN_PATH" - ]; - general = { - gaps_in = 3; - gaps_out = 8; - border_size = 1; - - "col.active_border" = "rgba(ed45b8ee) rgba(611449ee) 45deg"; - "col.inactive_border" = "rgba(595959aa)"; - - resize_on_border = true; - allow_tearing = true; - layout = "dwindle"; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - - decoration = { - rounding = 10; - - # Change transparency of focused and unfocused windows - active_opacity = "1.0"; - inactive_opacity = "1.0"; - - # drop_shadow = true; - # shadow_range = 4; - # shadow_render_power = 3; - # "col.shadow" = "rgba(1a1a1aee)"; - - # https://wiki.hyprland.org/Configuring/Variables/#blur - blur = { - enabled = true; - size = 3; - passes = 1; - - vibrancy = "0.1696"; - }; - }; - dwindle = { - pseudotile = true; - preserve_split = true; - }; - - #master = { - # new_is_master = true; - #}; - input = { - kb_layout = "pl"; - kb_variant = ""; - kb_model = ""; - kb_options = ""; - kb_rules = ""; - - follow_mouse = 1; - - sensitivity = 0; # -1.0 - 1.0, 0 means no modification. - - touchpad = { - natural_scroll = true; - }; + ]; + general = { + gaps_in = 3; + gaps_out = 8; + border_size = 1; + + "col.active_border" = "rgba(ed45b8ee) rgba(611449ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + resize_on_border = true; + allow_tearing = true; + layout = "dwindle"; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + decoration = { + rounding = 10; + + # Change transparency of focused and unfocused windows + active_opacity = "1.0"; + inactive_opacity = "1.0"; + + # drop_shadow = true; + # shadow_range = 4; + # shadow_render_power = 3; + # "col.shadow" = "rgba(1a1a1aee)"; + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur = { + enabled = true; + size = 3; + passes = 1; + + vibrancy = "0.1696"; }; - # Deprecated - # gestures = { - # workspace_swipe = true; - # }; - misc = { - force_default_wallpaper = "-1"; # Set to 0 or 1 to disable the anime mascot wallpapers - disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :( + }; + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + #master = { + # new_is_master = true; + #}; + input = { + kb_layout = "pl"; + kb_variant = ""; + kb_model = ""; + kb_options = ""; + kb_rules = ""; + + follow_mouse = 1; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + + touchpad = { + natural_scroll = true; }; - monitor= [ ",preferred,auto,1" ]; - - # Mod key - "$mod" = "SUPER"; - - # Programs - "$terminal" = "kitty"; - "$fileManager" = "thunar"; - "$menu" = "wofi --show drun"; - "$screenshot" = "hyprshot -m region -f screenshots/screenshot_$(date +'%y-%m-%d_%H-%M-%S').png"; - - bind = [ - # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - "$mod, RETURN, exec, $terminal" - "$mod, Q, killactive," - "$mod SHIFT, M, exec, uwsm stop" - "$mod, E, exec, uwsm app -- $fileManager" - "$mod, V, togglefloating," - "$mod, R, exec, uwsm app -- $menu" - "$mod, P, pseudo" - "$mod, J, togglesplit" - "$mod, L, exec, uwsm app -- hyprlock" - ",Print, exec, uwsm app -- $screenshot " - - # Move focus with mod + arrow keys - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - - # Example special workspace (scratchpad) - "$mod, S, togglespecialworkspace, magic" - "$mod SHIFT, S, movetoworkspace, special:magic" - - # Scroll through existing workspaces with mod + scroll - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ] ++ ( + }; + # Deprecated + # gestures = { + # workspace_swipe = true; + # }; + misc = { + force_default_wallpaper = "-1"; # Set to 0 or 1 to disable the anime mascot wallpapers + disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :( + }; + monitor = [ ",preferred,auto,1" ]; + + # Mod key + "$mod" = "SUPER"; + + # Programs + "$terminal" = "kitty"; + "$fileManager" = "thunar"; + "$menu" = "wofi --show drun"; + "$screenshot" = "hyprshot -m region -f screenshots/screenshot_$(date +'%y-%m-%d_%H-%M-%S').png"; + + bind = [ + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + "$mod, RETURN, exec, $terminal" + "$mod, Q, killactive," + "$mod SHIFT, M, exec, uwsm stop" + "$mod, E, exec, uwsm app -- $fileManager" + "$mod, V, togglefloating," + "$mod, R, exec, uwsm app -- $menu" + "$mod, P, pseudo" + "$mod, J, togglesplit" + "$mod, L, exec, uwsm app -- hyprlock" + ",Print, exec, uwsm app -- $screenshot " + + # Move focus with mod + arrow keys + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + # Example special workspace (scratchpad) + "$mod, S, togglespecialworkspace, magic" + "$mod SHIFT, S, movetoworkspace, special:magic" + + # Scroll through existing workspaces with mod + scroll + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ] + ++ ( # workspaces - builtins.concatLists (builtins.genList ( - x: let - ws = let - c = (x + 1) / 10; - in + builtins.concatLists ( + builtins.genList ( + x: + let + ws = + let + c = (x + 1) / 10; + in builtins.toString (x + 1 - (c * 10)); - in [ + in + [ # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} "$mod, ${ws}, workspace, ${toString (x + 1)}" "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" - + # Move workspace {1..10} to current monitor - "CTRL ALT $mod , ${ws}, focusworkspaceoncurrentmonitor, ${toString(x + 1)}" + "CTRL ALT $mod , ${ws}, focusworkspaceoncurrentmonitor, ${toString (x + 1)}" ] - ) - 10) - ) ++ ( - # Monitor {0..4} --> Key {1..5} - builtins.concatLists (builtins.genList ( - x: let - mon = builtins.toString(x); - key = builtins.toString(x + 1); - in [ - + ) 10 + ) + ) + ++ ( + # Monitor {0..4} --> Key {1..5} + builtins.concatLists ( + builtins.genList ( + x: + let + mon = builtins.toString (x); + key = builtins.toString (x + 1); + in + [ + # Move current workspace to a monitor {1..4} "CTRL ALT SHIFT $mod, ${key}, movecurrentworkspacetomonitor, ${mon} " - ] - ) 4)); - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - bindl = [ - "$mod, O, exec, sleep 1 && hyprctl dispatch dpms toggle" - ] ++ (lib.optionals config.homeapps.presets.multimedia.enable [ - # Playerctl binds if playerctl is enabled - " , XF86AudioNext, exec, playerctl next" - " , XF86AudioPause, exec, playerctl play-pause" - " , XF86AudioPlay, exec, playerctl play-pause" - " , XF86AudioPrev, exec, playerctl previous" - ]); - - bindel = [ - # Laptop multimedia keys for volume and LCD brightness - " ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" - " ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - " ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - " ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - " ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+" - " ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-" - ]; + ] + ) 4 + ) + ); + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + bindl = [ + "$mod, O, exec, sleep 1 && hyprctl dispatch dpms toggle" + ] + ++ (lib.optionals config.homeapps.presets.multimedia.enable [ + # Playerctl binds if playerctl is enabled + " , XF86AudioNext, exec, playerctl next" + " , XF86AudioPause, exec, playerctl play-pause" + " , XF86AudioPlay, exec, playerctl play-pause" + " , XF86AudioPrev, exec, playerctl previous" + ]); - windowrulev2 = [ - "suppressevent maximize, class:.*" # You'll probably like this. - ]; + bindel = [ + # Laptop multimedia keys for volume and LCD brightness + " ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + " ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + " ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + " ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + " ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+" + " ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-" + ]; - source = [ - "~/.config/hypr/hypr_test.conf" - ]; - }; - }; + windowrulev2 = [ + "suppressevent maximize, class:.*" # You'll probably like this. + ]; + + source = [ + "~/.config/hypr/hypr_test.conf" + ]; + }; + }; services.hyprpaper = { - enable = true; + enable = true; settings = { ipc = "on"; splash = false; splash_offset = 2.0; preload = [ "${./wallpaper.png}" ]; - wallpaper= [ ",${./wallpaper.png}" ]; + wallpaper = [ ",${./wallpaper.png}" ]; }; - }; + }; programs.hyprlock = { - enable=true; + enable = true; settings = { general = { disable_loading_bar = true; @@ -283,25 +302,25 @@ with lib; }; }; - services.hypridle.enable = true; + services.hypridle.enable = true; services.hypridle.settings = { general = { - lock_cmd ="pidof hyprlock || hyprlock"; - before_sleep_cmd="loginctl lock-session"; - ignore_dbus_inhibit=false; - after_sleep_cmd="hyprctl_dispatch dpms on"; + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + ignore_dbus_inhibit = false; + after_sleep_cmd = "hyprctl_dispatch dpms on"; }; listener = [ { timeout = 120; - on-timeout = "hyprlock"; - } + on-timeout = "hyprlock"; + } { timeout = 300; on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; + on-resume = "hyprctl dispatch dpms on"; } ]; }; - }; + }; } diff --git a/home-modules/desktop/wayland/default.nix b/home-modules/desktop/wayland/default.nix index 9be2fe9..ebf5439 100644 --- a/home-modules/desktop/wayland/default.nix +++ b/home-modules/desktop/wayland/default.nix @@ -1,3 +1,7 @@ -{pkgs, hostconfig, ...}: { - imports = [./waybar.nix ./mako.nix]; +{ pkgs, hostconfig, ... }: +{ + imports = [ + ./waybar.nix + ./mako.nix + ]; } diff --git a/home-modules/desktop/wayland/mako.nix b/home-modules/desktop/wayland/mako.nix index 15c7969..7dac41c 100644 --- a/home-modules/desktop/wayland/mako.nix +++ b/home-modules/desktop/wayland/mako.nix @@ -1,12 +1,18 @@ -{pkgs, config, hostconfig, lib,...}: { +{ + pkgs, + config, + hostconfig, + lib, + ... +}: +{ options.homeprogs.mako.enable = lib.mkEnableOption "Enable Mako notification manager"; config = lib.mkIf config.homeprogs.mako.enable { services.mako = { enable = true; }; - xdg.configFile."mako/config".source = ./mako.ini; - - }; + xdg.configFile."mako/config".source = ./mako.ini; + }; } diff --git a/home-modules/desktop/wayland/waybar.nix b/home-modules/desktop/wayland/waybar.nix index 5f3c532..6088cee 100644 --- a/home-modules/desktop/wayland/waybar.nix +++ b/home-modules/desktop/wayland/waybar.nix @@ -1,120 +1,141 @@ -{pkgs, hostconfig, lib, config,...}: { +{ + pkgs, + hostconfig, + lib, + config, + ... +}: +{ options.homeprogs.waybar.enable = lib.mkEnableOption "Enable waybar"; config = lib.mkIf config.homeprogs.waybar.enable { - programs.waybar = { - enable = true; - settings = [{ - layer = "top"; - position = "top"; - height = 30; - spacing = 6; - modules-left = [ - "hyprland/workspaces" - "hyprland/window" - ]; + programs.waybar = { + enable = true; + settings = [ + { + layer = "top"; + position = "top"; + height = 30; + spacing = 6; + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; - modules-center = [ - "clock" - "hyprland/language" - "tray" - "battery" - ]; + modules-center = [ + "clock" + "hyprland/language" + "tray" + "battery" + ]; - modules-right = [ - "idle_inhibitor" - "wireplumber" - "network" - "cpu" - "memory" - "disk" - "temperature" - "backlight" - ]; - wireplumber = { - scroll-step = 1; #%, can be a float + modules-right = [ + "idle_inhibitor" + "wireplumber" + "network" + "cpu" + "memory" + "disk" + "temperature" + "backlight" + ]; + wireplumber = { + scroll-step = 1; # %, can be a float format = "{volume}% "; format-muted = "Muted"; on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-right = "pavucontrol"; - }; + on-click-right = "pavucontrol"; + }; - network = { + network = { # interface = "wlp2*"; # (Optional) To force the use of this interface format-wifi = "({signalStrength}%) "; format-ethernet = "{ifname} "; tooltip-format = "{ifname} via {gwaddr} "; format-linked = "{ifname} (No IP) "; format-disconnected = "Disconnected ⚠"; - format-alt= "{essid}: {ipaddr}/{cidr}"; - }; + format-alt = "{essid}: {ipaddr}/{cidr}"; + }; - "hyprland/workspaces" = { - all-outputs = false; - active-only = false; - format = "{name}"; - format-icons = { - urgent = ""; - focused = ""; - default = ""; - }; - }; - - "hyprland/window" = { - max-length = 200; - separate-outputs = true; - }; + "hyprland/workspaces" = { + all-outputs = false; + active-only = false; + format = "{name}"; + format-icons = { + urgent = ""; + focused = ""; + default = ""; + }; + }; + "hyprland/window" = { + max-length = 200; + separate-outputs = true; + }; - keyboard-state = { - numlock = false; - format = "{name} {icon}"; - format-icons = { + keyboard-state = { + numlock = false; + format = "{name} {icon}"; + format-icons = { locked = ""; unlocked = ""; + }; }; - }; - idle_inhibitor = { - format = "{icon}"; - format-icons = { + idle_inhibitor = { + format = "{icon}"; + format-icons = { activated = ""; deactivated = ""; + }; }; - }; - tray = { - icon-size = 21; - spacing = 10; - }; - clock = { - timezone = "Europe/Amsterdam"; - tooltip-format = "{:%Y %B}\n{calendar}"; - format-alt = "{:%Y-%m-%d}"; - }; - cpu = { - format = "{usage}% "; - tooltip = false; - }; - memory = { - format = "{}% "; - }; - temperature = { - thermal-zone = 1; - # hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; - critical-threshold = 80; - # format-critical = "{temperatureC}°C {icon}"; - format = "{temperatureC}°C {icon}"; - format-icons = ["" "" ""]; - }; - "backlight" = { - # device = "acpi_video1"; - format = "{percent}{icon}"; - format-icons = ["" "" "" "" "" "" "" "" ""]; - }; - battery = { + tray = { + icon-size = 21; + spacing = 10; + }; + clock = { + timezone = "Europe/Amsterdam"; + tooltip-format = "{:%Y %B}\n{calendar}"; + format-alt = "{:%Y-%m-%d}"; + }; + cpu = { + format = "{usage}% "; + tooltip = false; + }; + memory = { + format = "{}% "; + }; + temperature = { + thermal-zone = 1; + # hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + # format-critical = "{temperatureC}°C {icon}"; + format = "{temperatureC}°C {icon}"; + format-icons = [ + "" + "" + "" + ]; + }; + "backlight" = { + # device = "acpi_video1"; + format = "{percent}{icon}"; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; + }; + battery = { states = { - # good = 95; - warning = 30; - critical = 15; + # good = 95; + warning = 30; + critical = 15; }; format = "{capacity}% {icon}"; format-charging = "{capacity}% "; @@ -122,10 +143,17 @@ format-alt = "{time} {icon}"; # format-good = ""; // An empty format will hide the module # format-full = ""; - format-icons = ["" "" "" "" ""]; - }; - }]; + format-icons = [ + "" + "" + "" + "" + "" + ]; + }; + } + ]; style = ./waybar.css; - }; + }; }; } diff --git a/home-modules/services/default.nix b/home-modules/services/default.nix index 7506f86..9f13709 100644 --- a/home-modules/services/default.nix +++ b/home-modules/services/default.nix @@ -1,7 +1,12 @@ -{lib, pkgs ,...}: { - imports = [./vdirsyncer.nix ./direnv.nix ./syncthing.nix]; +{ lib, pkgs, ... }: +{ + imports = [ + ./vdirsyncer.nix + ./direnv.nix + ./syncthing.nix + ]; - # Gnome keyring, very smort + # Gnome keyring, very smort services.gnome-keyring.enable = true; home.packages = [ pkgs.gcr ]; } diff --git a/home-modules/services/direnv.nix b/home-modules/services/direnv.nix index 7e68f99..9ddab97 100644 --- a/home-modules/services/direnv.nix +++ b/home-modules/services/direnv.nix @@ -1,11 +1,16 @@ -{pkgs, config, lib ,...}: { - options.homesv.direnv.enable = lib.mkEnableOption "Enable Direnv support"; - config = lib.mkIf config.homesv.direnv.enable { + pkgs, + config, + lib, + ... +}: +{ + options.homesv.direnv.enable = lib.mkEnableOption "Enable Direnv support"; + config = lib.mkIf config.homesv.direnv.enable { programs.direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; }; }; } diff --git a/home-modules/services/syncthing.nix b/home-modules/services/syncthing.nix index b264433..b518dd6 100644 --- a/home-modules/services/syncthing.nix +++ b/home-modules/services/syncthing.nix @@ -1,9 +1,13 @@ -{ config, pkgs, lib ,... }: { - config = lib.mkIf config.homeapps.presets.connectivity.enable { + config, + pkgs, + lib, + ... +}: +{ + config = lib.mkIf config.homeapps.presets.connectivity.enable { services.syncthing = { - enable = true; + enable = true; }; - }; + }; } - diff --git a/home-modules/services/vdirsyncer.nix b/home-modules/services/vdirsyncer.nix index c5dd2cc..a849637 100644 --- a/home-modules/services/vdirsyncer.nix +++ b/home-modules/services/vdirsyncer.nix @@ -1,29 +1,35 @@ -{pkgs, inputs, config, lib, ...}: -let - cfg = config.homesv.vdirsyncer; -in -{ +{ + pkgs, + inputs, + config, + lib, + ... +}: +let + cfg = config.homesv.vdirsyncer; +in +{ options.homesv.vdirsyncer = { - enable = lib.mkEnableOption "Enable syncing via vdirsyncer"; - user = lib.mkOption { default = config.home.username; }; - server = lib.mkOption { default= "https://webdav.wilkuu.xyz/dav.php"; }; + enable = lib.mkEnableOption "Enable syncing via vdirsyncer"; + user = lib.mkOption { default = config.home.username; }; + server = lib.mkOption { default = "https://webdav.wilkuu.xyz/dav.php"; }; }; config = lib.mkIf cfg.enable { sops.secrets.webdav_uname = { sopsFile = ../../secrets/secrets.yaml; - key="${cfg.user}/webdav/username"; - }; + key = "${cfg.user}/webdav/username"; + }; sops.secrets.webdav_pass = { sopsFile = ../../secrets/secrets.yaml; - key="${cfg.user}/webdav/password"; - }; + key = "${cfg.user}/webdav/password"; + }; services.vdirsyncer = { - enable = true; + enable = true; frequency = "*:0/5"; # About once in 5 minutes - }; + }; systemd.user.services.vdirsyncer.unitConfig.After = [ "sops-nix.service" ]; - + sops.templates."vdirsyncer_config_${cfg.user}" = { content = '' [general] @@ -67,8 +73,9 @@ in ''; }; home.file.".config/vdirsyncer/config" = { - source = config.lib.file.mkOutOfStoreSymlink config.sops.templates."vdirsyncer_config_${cfg.user}".path; + source = + config.lib.file.mkOutOfStoreSymlink + config.sops.templates."vdirsyncer_config_${cfg.user}".path; }; }; -} - +} diff --git a/home-modules/theming.nix b/home-modules/theming.nix index 291dadc..ee6b13b 100644 --- a/home-modules/theming.nix +++ b/home-modules/theming.nix @@ -1,45 +1,49 @@ -{ hostconfig, pkgs, lib,... }: +{ + hostconfig, + pkgs, + lib, + ... +}: let - catppuccin_gtk = pkgs.catppuccin-gtk.override { - accents = ["pink"]; + catppuccin_gtk = pkgs.catppuccin-gtk.override { + accents = [ "pink" ]; size = "compact"; - tweaks = ["black"]; + tweaks = [ "black" ]; variant = "mocha"; - }; + }; in { - config = lib.mkIf hostconfig.addons.desktop.enable { - #Gtk Theming + config = lib.mkIf hostconfig.addons.desktop.enable { + #Gtk Theming gtk = { - enable=true; - theme = { - package= catppuccin_gtk; - name="catppuccin-mocha-pink-compact+black"; - }; + enable = true; + theme = { + package = catppuccin_gtk; + name = "catppuccin-mocha-pink-compact+black"; + }; iconTheme = { - package = pkgs.catppuccin-papirus-folders; + package = pkgs.catppuccin-papirus-folders; name = "Papirus-Dark"; - }; + }; }; - home.pointerCursor = { gtk.enable = true; package = pkgs.catppuccin-cursors.mochaDark; name = "catppuccin-mocha-dark-cursors"; size = 32; - }; + }; qt = { - enable = true; + enable = true; platformTheme.name = "qtct"; - style.name="kvantum"; + style.name = "kvantum"; }; - xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { - General.theme = "Catppuccin-Mocha-Pink"; - }; + xdg.configFile."Kvantum/kvantum.kvconfig".source = + (pkgs.formats.ini { }).generate "kvantum.kvconfig" + { + General.theme = "Catppuccin-Mocha-Pink"; + }; }; } - - diff --git a/home/live-user.nix b/home/live-user.nix index e4dfd8b..7a8e5c0 100644 --- a/home/live-user.nix +++ b/home/live-user.nix @@ -1,13 +1,14 @@ -{ config ,pkgs, ... }: { - imports = [../home-modules]; +{ config, pkgs, ... }: +{ + imports = [ ../home-modules ]; - homeapps.presets = { - browser.enable = true; - utils.enable = true; - }; + homeapps.presets = { + browser.enable = true; + utils.enable = true; + }; - home.username = "live-user"; - home.homeDirectory = "/home/live-user"; - home.stateVersion = "24.11"; - programs.home-manager.enable = true; + home.username = "live-user"; + home.homeDirectory = "/home/live-user"; + home.stateVersion = "24.11"; + programs.home-manager.enable = true; } diff --git a/home/wilkuu.nix b/home/wilkuu.nix index 9547aec..1e744cd 100644 --- a/home/wilkuu.nix +++ b/home/wilkuu.nix @@ -1,23 +1,29 @@ -{ config ,pkgs, hostconfig, ... }: { - imports = [../home-modules]; +{ + config, + pkgs, + hostconfig, + ... +}: +{ + imports = [ ../home-modules ]; - homeapps.presets.full.enable = true; - # homeapps.vnc = true; + homeapps.presets.full.enable = true; + # homeapps.vnc = true; - services.wayvnc = { - enable = true; - autoStart = false; + services.wayvnc = { + enable = true; + autoStart = false; settings = { # Todo, bind to vpn and LAN explicitly somehow address = "0.0.0.0"; - port = 5900; + port = 5900; }; - }; - - homesv.vdirsyncer.enable = true; + }; - home.username = "wilkuu"; - home.homeDirectory = "/home/wilkuu"; - home.stateVersion = "24.11"; - programs.home-manager.enable = true; + homesv.vdirsyncer.enable = true; + + home.username = "wilkuu"; + home.homeDirectory = "/home/wilkuu"; + home.stateVersion = "24.11"; + programs.home-manager.enable = true; } diff --git a/hosts/apocalypse/backup.nix b/hosts/apocalypse/backup.nix index 3529024..1942d66 100644 --- a/hosts/apocalypse/backup.nix +++ b/hosts/apocalypse/backup.nix @@ -1,31 +1,37 @@ -{ config, lib, pkgs, modulesPath, ...}: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { environment.systemPackages = with pkgs; [ btrbk lz4 ]; - + services.btrbk = { - extraPackages = with pkgs; [ lz4 ]; - instances."remote_vault" = { - onCalendar = "weekly"; - settings = { - snapshot_preserve_min = "1w"; - snapshot_preserve = "2w"; - target_preserve_min = "1w"; - target_preserve = "4w"; - ssh_identity = "/etc/vault_key"; # NOTE: must be readable by user/group btrbk - ssh_user = "vaultmanager"; - stream_compress = "lz4"; - volume."/btrfs_root" = { - target = "ssh://10.127.9.1/vault/backups/apocalypse"; - subvolume = { - "@root" = { - snapshot_create = "ondemand"; - }; + extraPackages = with pkgs; [ lz4 ]; + instances."remote_vault" = { + onCalendar = "weekly"; + settings = { + snapshot_preserve_min = "1w"; + snapshot_preserve = "2w"; + target_preserve_min = "1w"; + target_preserve = "4w"; + ssh_identity = "/etc/vault_key"; # NOTE: must be readable by user/group btrbk + ssh_user = "vaultmanager"; + stream_compress = "lz4"; + volume."/btrfs_root" = { + target = "ssh://10.127.9.1/vault/backups/apocalypse"; + subvolume = { + "@root" = { + snapshot_create = "ondemand"; + }; + }; }; }; }; }; -}; } diff --git a/hosts/apocalypse/default.nix b/hosts/apocalypse/default.nix index eb9d14c..5437a32 100644 --- a/hosts/apocalypse/default.nix +++ b/hosts/apocalypse/default.nix @@ -1,68 +1,70 @@ - {lib, pkgs, ...}: - { - imports = [ - ./hardware-configuration.nix - ./nvidia.nix - ./backup.nix - ./firewall.nix - ]; +{ lib, pkgs, ... }: +{ + imports = [ + ./hardware-configuration.nix + ./nvidia.nix + ./backup.nix + ./firewall.nix + ]; ## TODO REMOVE LATER TO PREVENT ELI FROM BUILDING REMOTELY - boot.binfmt.emulatedSystems = ["aarch64-linux"]; - + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + ## Addons for this system - addons = { - desktop.hyprland.enable = true; - desktop.xfce.enable = true; - steam.enable = true; + addons = { + desktop.hyprland.enable = true; + desktop.xfce.enable = true; + steam.enable = true; - virtualisation.guest = false; - virtualisation.host = true; + virtualisation.guest = false; + virtualisation.host = true; - vpn.mullvad.enable = true; - vpn.eduvpn.enable = true; + vpn.mullvad.enable = true; + vpn.eduvpn.enable = true; gpg.enable = true; remote_builder = { - enable = true; - allowedKeyFiles = [../../secrets/eli.pub]; - openFirewall = true; - }; + enable = true; + allowedKeyFiles = [ ../../secrets/eli.pub ]; + openFirewall = true; + }; + }; + + boot.loader.grub = { + useOSProber = true; + device = "nodev"; + + efiSupport = true; + default = "saved"; + memtest86.enable = true; + # splashImage = ./GrubBG.png; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.systemd.enable = true; + boot.crashDump.enable = true; + boot.plymouth = { + enable = true; + theme = "bgrt"; }; - boot.loader.grub = { - useOSProber = true; - device = "nodev"; - - efiSupport = true; - default = "saved"; - memtest86.enable = true; - # splashImage = ./GrubBG.png; - }; - boot.loader.efi.canTouchEfiVariables = true; - boot.initrd.systemd.enable = true; - boot.crashDump.enable = true; - boot.plymouth = { - enable = true; - theme = "bgrt"; - }; - - boot.kernelParams = [ - "quiet" - "splash" - "loglevel=3" - "rd.systemd.show_status=false" - "rd.udev.log_level=3" - "udev.logpriority=3" + boot.kernelParams = [ + "quiet" + "splash" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.logpriority=3" ]; - boot.consoleLogLevel = 0; + boot.consoleLogLevel = 0; networking.hostName = "apocalypse"; # Define your hostname. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - hardware.bluetooth.enable = true; + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + hardware.bluetooth.enable = true; hardware.bluetooth.settings = { - General = {Enable = "Source,Sink,Media,Socket";}; + General = { + Enable = "Source,Sink,Media,Socket"; + }; }; hardware.bluetooth.powerOnBoot = true; @@ -71,39 +73,35 @@ programs.nix-ld.enable = true; services.printing.enable = true; - - services.resolved = { - enable = true; - dnssec = "false"; - domains = [ "~." ]; - fallbackDns = [ ]; - dnsovertls = "opportunistic"; - }; + services.resolved = { + enable = true; + dnssec = "false"; + domains = [ "~." ]; + fallbackDns = [ ]; + dnsovertls = "opportunistic"; + }; networking.useDHCP = lib.mkDefault true; - networking.firewall.checkReversePath = false; + networking.firewall.checkReversePath = false; - - # Thunderbolt + # Thunderbolt services.hardware.bolt.enable = true; - powerManagement.enable = true; + powerManagement.enable = true; - # Firmware updates - services.fwupd.enable = true; + # Firmware updates + services.fwupd.enable = true; services.openssh = { - enable = true; - ports = [22]; - openFirewall = false; - allowSFTP = false; + enable = true; + ports = [ 22 ]; + openFirewall = false; + allowSFTP = false; settings = { PasswordAuthentication = false; - AllowUsers = ["wilkuu"]; - X11Forwarding = false; + AllowUsers = [ "wilkuu" ]; + X11Forwarding = false; PermitRootLogin = "no"; PrintMotd = true; - }; + }; }; } - - diff --git a/hosts/apocalypse/firewall.nix b/hosts/apocalypse/firewall.nix index 4be34a3..8c5dadb 100644 --- a/hosts/apocalypse/firewall.nix +++ b/hosts/apocalypse/firewall.nix @@ -1,37 +1,46 @@ -{pkgs, config, ...}: -let +{ pkgs, config, ... }: +let baseTCP = [ 22000 # Syncthng - 5352 # Zeroconf for spotifyd - ]; + 5352 # Zeroconf for spotifyd + ]; baseUDP = [ 22000 # Syncthing - 22027 # Syncthing + 22027 # Syncthing 16555 # Wireguard - 5353 # Mdns (Spotify) - ]; + 5353 # Mdns (Spotify) + ]; baseTCPRanges = [ - { from = 1714; to = 1764; } # KDE-CONNECT + { + from = 1714; + to = 1764; + } # KDE-CONNECT ]; baseUDPRanges = [ - { from = 1714; to = 1764; } # KDE-CONNECT + { + from = 1714; + to = 1764; + } # KDE-CONNECT ]; secureTCP = [ - 22 80 433 5900 # SSH HTTP VNC - ]; - + 22 + 80 + 433 + 5900 # SSH HTTP VNC + ]; + secureUDP = [ - 5900 - ]; + 5900 + ]; secureTCPRanges = [ - ]; + ]; secureUDPRanges = [ - ]; -in + ]; +in { networking.nftables.enable = true; networking.firewall = { diff --git a/hosts/apocalypse/hardware-configuration.nix b/hosts/apocalypse/hardware-configuration.nix index 2e5d049..cdd25a9 100644 --- a/hosts/apocalypse/hardware-configuration.nix +++ b/hosts/apocalypse/hardware-configuration.nix @@ -1,92 +1,133 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ "cryptd" "aesni_intel" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "nvme" + "usb_storage" + "usbhid" + "sd_mod" + "sdhci_pci" + ]; + boot.initrd.kernelModules = [ + "cryptd" + "aesni_intel" + ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - boot.supportedFilesystems = [ "ntfs" "btrfs" "vfat" ]; - boot.loader.grub.extraEntries = - '' -menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' { - fwsetup -} - ''; + boot.supportedFilesystems = [ + "ntfs" + "btrfs" + "vfat" + ]; + boot.loader.grub.extraEntries = '' + menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' { + fwsetup + } + ''; + + boot.extraModprobeConfig = '' + options thinkpad_acpi fan_control=1 + ''; - boot.extraModprobeConfig = '' - options thinkpad_acpi fan_control=1 - ''; - boot.initrd.luks.devices = { - "cryptroot".device = "/dev/disk/by-uuid/d2c3c197-3d75-4da2-a098-207030a91b62"; - "cryptswap".device = "/dev/disk/by-uuid/fd6a5644-a33c-40af-ae48-42db1a5997ac"; + "cryptroot".device = "/dev/disk/by-uuid/d2c3c197-3d75-4da2-a098-207030a91b62"; + "cryptswap".device = "/dev/disk/by-uuid/fd6a5644-a33c-40af-ae48-42db1a5997ac"; "cryptstore".device = "/dev/disk/by-uuid/b5fb2feb-cbec-4c16-8efe-c08a3cbe05c5"; }; - fileSystems."/" = - { device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = [ "subvol=@root" "compress=zstd" ]; - }; + fileSystems."/" = { + device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ + "subvol=@root" + "compress=zstd" + ]; + }; fileSystems."/btrfs_root" = { - device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = [ "subvolid=5" "compress=zstd"]; + device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ + "subvolid=5" + "compress=zstd" + ]; + }; + + fileSystems."/snapshots" = { + device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ + "subvol=@snapshots" + "compress=zstd" + ]; }; - fileSystems."/snapshots" = - { device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = [ "subvol=@snapshots" "compress=zstd" ]; - }; - # TODO: Mount efi and boot separately - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/6E1A-07F4"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/6E1A-07F4"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; }; - fileSystems."/store2" = - { - device = "/dev/mapper/cryptstore"; - fsType = "btrfs"; - options = [ "noatime" "compress=zstd" "subvol=store"]; + fileSystems."/store2" = { + device = "/dev/mapper/cryptstore"; + fsType = "btrfs"; + options = [ + "noatime" + "compress=zstd" + "subvol=store" + ]; }; fileSystems."/store2/.snapshots" = { - device = "/dev/mapper/cryptstore"; - fsType = "btrfs"; - options = [ "noatime" "compress=zstd" "subvol=store"]; + device = "/dev/mapper/cryptstore"; + fsType = "btrfs"; + options = [ + "noatime" + "compress=zstd" + "subvol=store" + ]; }; - # fileSystems."/store1" = + # fileSystems."/store1" = # { device = "/dev/disk/by-uuid/6A2E2BFF2E2BC2C5"; # fsType = "ntfs-3g" ; # options = ["rw" "uid=1000" "gid=100"]; # }; - fileSystems."/win_games" = - { device = "/dev/disk/by-uuid/6A680789680752ED"; - fsType = "ntfs-3g" ; - options = ["rw" "uid=1000" "gid=100"]; - }; + fileSystems."/win_games" = { + device = "/dev/disk/by-uuid/6A680789680752ED"; + fsType = "ntfs-3g"; + options = [ + "rw" + "uid=1000" + "gid=100" + ]; + }; # fileSystems."/windows" = { # device = "/dev/disk/by-uuid/7AFA6C84FA6C3E8F"; # fsType = "ntfs-3g"; # options = ["rw" "uid=1000" "gid=100"]; # }; - swapDevices = - [ { device = "/dev/mapper/cryptswap"; } - ]; + swapDevices = [ + { device = "/dev/mapper/cryptswap"; } + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/apocalypse/nvidia.nix b/hosts/apocalypse/nvidia.nix index ef95b43..ccfc6d8 100644 --- a/hosts/apocalypse/nvidia.nix +++ b/hosts/apocalypse/nvidia.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, modulesPath, ...}: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { # Enable OpenGL hardware.graphics = { @@ -6,7 +12,7 @@ }; # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { @@ -15,7 +21,7 @@ # Nvidia power management. Experimental, and can cause sleep/suspend to fail. # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead # of just the bare essentials. powerManagement.enable = false; @@ -25,31 +31,31 @@ # Use the NVidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus # Only available from driver 515.43.04+ # Currently alpha-quality/buggy, so false is currently the recommended setting. open = false; # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. + # accessible via `nvidia-settings`. nvidiaSettings = true; # Optionally, you may need to select the appropriate driver version for your specific GPU. package = config.boot.kernelPackages.nvidiaPackages.production; prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; + offload = { + enable = true; + enableOffloadCmd = true; + }; - sync.enable = false; + sync.enable = false; - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - }; + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; }; } diff --git a/hosts/full-iso/default.nix b/hosts/full-iso/default.nix index d2ca00a..e17e620 100644 --- a/hosts/full-iso/default.nix +++ b/hosts/full-iso/default.nix @@ -1,12 +1,13 @@ -{modulesPath, pkgs, ...}: { +{ modulesPath, pkgs, ... }: +{ imports = [ - (modulesPath + "/installer/cd-dvd/installation-cd-base.nix") + (modulesPath + "/installer/cd-dvd/installation-cd-base.nix") ]; - boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - addons.desktop.hyprland.enable = true; - addons.desktop.xfce.enable = false; - addons.gpg.enable = false; -} + addons.desktop.hyprland.enable = true; + addons.desktop.xfce.enable = false; + addons.gpg.enable = false; +} diff --git a/hosts/test_vm/default.nix b/hosts/test_vm/default.nix index 06998c6..a627939 100644 --- a/hosts/test_vm/default.nix +++ b/hosts/test_vm/default.nix @@ -1,16 +1,21 @@ -{pkgs, lib, inputs,...}: { - boot.loader.systemd-boot.enable = true; +{ + pkgs, + lib, + inputs, + ... +}: +{ + boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - imports = ["${inputs.nixpkgs}/nixos/modules/virtualisation/libvirtd.nix"]; + imports = [ "${inputs.nixpkgs}/nixos/modules/virtualisation/libvirtd.nix" ]; networking.hostName = "cookie_vm"; # Define your hostname. - networking.networkmanager.enable = true; + networking.networkmanager.enable = true; programs.nix-ld.enable = true; - - addons.desktop.hyprland.enable = false; - addons.desktop.xfce.enable = true; - addons.virtualisation.guest = true; + addons.desktop.hyprland.enable = false; + addons.desktop.xfce.enable = true; + addons.virtualisation.guest = true; virtualisation.vmVariant = { # following configuration is added only when building VM with build-vm virtualisation = { diff --git a/modules/btrfs.nix b/modules/btrfs.nix index 70d35ac..7c4e964 100644 --- a/modules/btrfs.nix +++ b/modules/btrfs.nix @@ -1,16 +1,21 @@ -{pkgs, lib, config, ...}: -let - cfg = config.addons.btrfs; -in +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.addons.btrfs; +in { options.addons.btrfs = { enable = lib.mkEnableOption "Enable btrfs-related apps and utils"; - }; + }; config = lib.mkMerge [ (lib.mkIf cfg.enable { - services.btrfs.autoScrub = { - enable = true; + services.btrfs.autoScrub = { + enable = true; interval = "weekly"; }; }) diff --git a/modules/default.nix b/modules/default.nix index dc1d2f6..5bbfa3c 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,6 +1,12 @@ -{pkgs, lib, config ,...}: { +{ + pkgs, + lib, + config, + ... +}: +{ imports = [ - ./desktop + ./desktop ./virt.nix ./gpg.nix ./btrfs.nix diff --git a/modules/desktop/common.nix b/modules/desktop/common.nix index c04a6b0..86cb562 100644 --- a/modules/desktop/common.nix +++ b/modules/desktop/common.nix @@ -1,21 +1,27 @@ -{pkgs, config, lib, ...}: { - options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop"; +{ + pkgs, + config, + lib, + ... +}: +{ + options.addons.desktop.enable = lib.mkEnableOption "On if the machine needs a desktop"; - config = lib.mkIf config.addons.desktop.enable { + config = lib.mkIf config.addons.desktop.enable { programs = { - dconf.enable = true; - thunar = { - enable = true; - plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-media-tags-plugin - thunar-volman + dconf.enable = true; + thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-media-tags-plugin + thunar-volman ]; }; }; environment.systemPackages = with pkgs; [ - xdg-user-dirs + xdg-user-dirs zathura sioyek vlc @@ -28,48 +34,46 @@ # surf # A basic browser in case we don't want to import a larger browser ]; - # Enable CUPS to print documents. # services.printing.enable = true; - # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true; - + services = { - blueman.enable = true; - # Enable sound - pipewire = { - enable = true; - pulse.enable = true; - }; + blueman.enable = true; + # Enable sound + pipewire = { + enable = true; + pulse.enable = true; + }; displayManager.sddm = { - enable=true; + enable = true; #theme = "catppuccin-mocha"; - }; + }; }; # fcitx is broken for now # i18n.inputMethod = { # type = "fcitx5"; - # enable = true; + # enable = true; # fcitx5.addons = with pkgs; [ # fcitx5-gtk # fcitx5-lua # fcitx5-mozc - # catppuccin-fcitx5 + # catppuccin-fcitx5 # fcitx5-table-other # kdePackages.fcitx5-qt - # ]; - # }; + # ]; + # }; fonts.packages = with pkgs; [ - noto-fonts - font-awesome - nerd-fonts.hurmit - minecraftia - ]; + noto-fonts + font-awesome + nerd-fonts.hurmit + minecraftia + ]; }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 4719b5d..be082bc 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,50 +1,55 @@ -{pkgs, lib, config,...}: -with lib; - let - wmMeta = config.addons.desktop.wmMeta; +{ + pkgs, + lib, + config, + ... +}: +with lib; +let + wmMeta = config.addons.desktop.wmMeta; - # Gets all the vm's that are enabled and checks which protocols are used + # Gets all the vm's that are enabled and checks which protocols are used enabledWMs = (filter (wm: wm.enable) (attrValues wmMeta)); - protos = (unique (map (wm: wm.protocol) enabledWMs)); - desktopEnabled = protos != []; - x11Enabled = elem "x11" protos; - waylandEnabled = elem "wayland" protos; + protos = (unique (map (wm: wm.protocol) enabledWMs)); + desktopEnabled = protos != [ ]; + x11Enabled = elem "x11" protos; + waylandEnabled = elem "wayland" protos; - -in { +in +{ imports = [ ./common.nix ./x11.nix ./wayland.nix ./wms ./steam.nix - ]; + ]; options.addons.desktop = with types; { - wmMeta = mkOption { - type = attrsOf (submodule { - options = { - enable = mkOption { - type = bool; - default = false; - }; - protocol = mkOption { - type = str; - description = "Used display protocol (x11 or wayland)"; - }; + wmMeta = mkOption { + type = attrsOf (submodule { + options = { + enable = mkOption { + type = bool; + default = false; + }; + protocol = mkOption { + type = str; + description = "Used display protocol (x11 or wayland)"; }; - }); - default = {}; - description = "Window manager metadata used for determining which protocol to enable."; - }; + }; + }); + default = { }; + description = "Window manager metadata used for determining which protocol to enable."; + }; - # enable = lib.mkEnableOption "Whenever any desktop environment is enabled."; - # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled."; - # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled."; + # enable = lib.mkEnableOption "Whenever any desktop environment is enabled."; + # x11.enable = lib.mkEnableOption "Whenever x11 desktop environment is enabled."; + # wayland.enable = lib.mkEnableOption "Whenever wayland desktop environment is enabled."; }; - config.addons.desktop = { - enable = desktopEnabled; - x11.enable = x11Enabled; - wayland.enable = waylandEnabled; + config.addons.desktop = { + enable = desktopEnabled; + x11.enable = x11Enabled; + wayland.enable = waylandEnabled; }; } diff --git a/modules/desktop/steam.nix b/modules/desktop/steam.nix index f21a5a3..a78c7c4 100644 --- a/modules/desktop/steam.nix +++ b/modules/desktop/steam.nix @@ -1,50 +1,58 @@ -{config, pkgs,lib, ...}: { +{ + config, + pkgs, + lib, + ... +}: +{ options.addons = { - steam.enable = lib.mkEnableOption "Enable steam on this machine"; + steam.enable = lib.mkEnableOption "Enable steam on this machine"; }; - config = lib.mkIf config.addons.steam.enable (lib.mkMerge [ - ({ - assertions = [ - { - assertion = config.addons.desktop.enable; - message = "You need a desktop environment to enable Steam!"; - } - ]; - programs.gamescope = { - enable = true; - capSysNice = false; # This needs to be false as to make nested steam stuff work in it. - }; - programs.steam = { - enable = true; - # Done according to the wiki, talks about some unexpected values in a lambda? - # Doesn't seem to be how overrides work - # TODO: Figure out how overrides work - # package = pkgs.steam.override { - # # withPrimus = true; - # extraPackages = with pkgs; [bumblebee glxinfo]; - # }; - - # Gamescope - gamescopeSession.enable = true; - - # Open firewall - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; - }; - - # Enable Appimage for some steam games - programs.appimage.enable = true; - programs.appimage.binfmt = true; - }) - - (lib.mkIf config.addons.dssktop.x11.enable { - - }) - (lib.mkIf config.addons.dssktop.wayland.enable { - - }) - - ]); + config = lib.mkIf config.addons.steam.enable ( + lib.mkMerge [ + ({ + assertions = [ + { + assertion = config.addons.desktop.enable; + message = "You need a desktop environment to enable Steam!"; + } + ]; + programs.gamescope = { + enable = true; + capSysNice = false; # This needs to be false as to make nested steam stuff work in it. + }; + programs.steam = { + enable = true; + # Done according to the wiki, talks about some unexpected values in a lambda? + # Doesn't seem to be how overrides work + # TODO: Figure out how overrides work + # package = pkgs.steam.override { + # # withPrimus = true; + # extraPackages = with pkgs; [bumblebee glxinfo]; + # }; + + # Gamescope + gamescopeSession.enable = true; + + # Open firewall + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; + + # Enable Appimage for some steam games + programs.appimage.enable = true; + programs.appimage.binfmt = true; + }) + + (lib.mkIf config.addons.dssktop.x11.enable { + + }) + (lib.mkIf config.addons.dssktop.wayland.enable { + + }) + + ] + ); } diff --git a/modules/desktop/wayland.nix b/modules/desktop/wayland.nix index d7b9651..9197a4e 100644 --- a/modules/desktop/wayland.nix +++ b/modules/desktop/wayland.nix @@ -1,12 +1,18 @@ -{pkgs, lib, config, ...}: { - options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland" ; +{ + pkgs, + lib, + config, + ... +}: +{ + options.addons.desktop.wayland.enable = lib.mkEnableOption "Enable wayland"; config = lib.mkIf config.addons.desktop.wayland.enable { services.displayManager.sddm.wayland.enable = true; - xdg.portal = { + xdg.portal = { enable = true; extraPortals = [ - pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-gtk ]; }; }; diff --git a/modules/desktop/wms/default.nix b/modules/desktop/wms/default.nix index 94d0e05..9f7a18d 100644 --- a/modules/desktop/wms/default.nix +++ b/modules/desktop/wms/default.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./hyprland.nix ./xfce.nix diff --git a/modules/desktop/wms/hyprland.nix b/modules/desktop/wms/hyprland.nix index 8243b3d..dfc7116 100644 --- a/modules/desktop/wms/hyprland.nix +++ b/modules/desktop/wms/hyprland.nix @@ -1,43 +1,52 @@ -{pkgs, lib, config, ...}: - let cfg = config.addons.desktop.hyprland; -in { +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.addons.desktop.hyprland; +in +{ options.addons.desktop.hyprland = { - enable = lib.mkEnableOption "Enable Hyprland"; + enable = lib.mkEnableOption "Enable Hyprland"; }; - config = lib.mkIf cfg.enable (lib.mkMerge [ - (import ../../../utils/makeWm.nix "hyprland" "wayland" ) - { - programs.hyprland.enable = true; - programs.hyprland.withUWSM = true; - programs.uwsm = { - enable = true; - waylandCompositors ={ - hyprland = { - prettyName = "Hyprland"; - comment = "Hyprland compositor managed by UWSM"; - binPath = "/run/current-system/sw/bin/Hyprland"; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + (import ../../../utils/makeWm.nix "hyprland" "wayland") + { + programs.hyprland.enable = true; + programs.hyprland.withUWSM = true; + programs.uwsm = { + enable = true; + waylandCompositors = { + hyprland = { + prettyName = "Hyprland"; + comment = "Hyprland compositor managed by UWSM"; + binPath = "/run/current-system/sw/bin/Hyprland"; + }; }; }; - }; - environment.systemPackages = with pkgs; [ - hyprland - hyprshot - hypridle - hyprpaper - hyprpicker - hyprnotify - hyprcursor - hyprpolkitagent - wofi - waybar - waybar-mpris - mako - xdg-desktop-portal-gnome - xdg-desktop-portal-hyprland - wl-clipboard - ]; - } - ]); -} + environment.systemPackages = with pkgs; [ + hyprland + hyprshot + hypridle + hyprpaper + hyprpicker + hyprnotify + hyprcursor + hyprpolkitagent + wofi + waybar + waybar-mpris + mako + xdg-desktop-portal-gnome + xdg-desktop-portal-hyprland + wl-clipboard + ]; + } + ] + ); +} diff --git a/modules/desktop/wms/xfce.nix b/modules/desktop/wms/xfce.nix index 0c62ee0..8d29e8a 100644 --- a/modules/desktop/wms/xfce.nix +++ b/modules/desktop/wms/xfce.nix @@ -1,37 +1,46 @@ -{pkgs, config, lib, ...}: -let - cfg = config.addons.desktop.xfce; -in { - +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.addons.desktop.xfce; +in +{ + options.addons.desktop.xfce = { enable = lib.mkEnableOption "Enable xfce"; }; - - config = lib.mkIf cfg.enable (lib.mkMerge [ - (import ../../../utils/makeWm.nix "xfce" "x11" ) - { - environment.systemPackages = with pkgs; [ - # XFCE stuff - xfce.catfish - xfce.xfce4-appfinder - xfce.xfce4-clipman-plugin - xfce.xfce4-cpugraph-plugin - xfce.xfce4-dict - xfce.xfce4-fsguard-plugin - xfce.xfce4-genmon-plugin - xfce.xfce4-netload-plugin - xfce.xfce4-panel - xfce.xfce4-pulseaudio-plugin - xfce.xfce4-systemload-plugin - xfce.xfce4-weather-plugin - xfce.xfce4-whiskermenu-plugin - xfce.xfce4-xkb-plugin - xfce.xfdashboard - - # GNOME stuff - file-roller - gnome-disk-utility - ]; - services.xserver.desktopManager.xfce.enable = true; - }]); + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + (import ../../../utils/makeWm.nix "xfce" "x11") + { + environment.systemPackages = with pkgs; [ + # XFCE stuff + xfce.catfish + xfce.xfce4-appfinder + xfce.xfce4-clipman-plugin + xfce.xfce4-cpugraph-plugin + xfce.xfce4-dict + xfce.xfce4-fsguard-plugin + xfce.xfce4-genmon-plugin + xfce.xfce4-netload-plugin + xfce.xfce4-panel + xfce.xfce4-pulseaudio-plugin + xfce.xfce4-systemload-plugin + xfce.xfce4-weather-plugin + xfce.xfce4-whiskermenu-plugin + xfce.xfce4-xkb-plugin + xfce.xfdashboard + + # GNOME stuff + file-roller + gnome-disk-utility + ]; + services.xserver.desktopManager.xfce.enable = true; + } + ] + ); } diff --git a/modules/desktop/x11.nix b/modules/desktop/x11.nix index cdbf3a3..d0f5480 100644 --- a/modules/desktop/x11.nix +++ b/modules/desktop/x11.nix @@ -1,11 +1,17 @@ -{pkgs, lib, config, ...}: { +{ + pkgs, + lib, + config, + ... +}: +{ options.addons.desktop.x11.enable = lib.mkEnableOption "Enabled if X11 is needed for this machine"; config = lib.mkIf config.addons.desktop.x11.enable { services.xserver = { - enable = true; - excludePackages = with pkgs; [ - xterm - ]; - }; - }; + enable = true; + excludePackages = with pkgs; [ + xterm + ]; + }; + }; } diff --git a/modules/gpg.nix b/modules/gpg.nix index e7b6984..0fa48e6 100644 --- a/modules/gpg.nix +++ b/modules/gpg.nix @@ -1,9 +1,16 @@ -{pkgs, config, lib, ... }: -let cfg = config.addons.gpg; in +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.addons.gpg; +in { options.addons.gpg = { - enable = lib.mkEnableOption "Allow gpg for all users"; - }; + enable = lib.mkEnableOption "Allow gpg for all users"; + }; config = lib.mkMerge ([ (lib.mkIf cfg.enable { @@ -11,8 +18,8 @@ let cfg = config.addons.gpg; in agent = { enable = true; }; - }; + }; }) ]); -} +} diff --git a/modules/lan-certs.nix b/modules/lan-certs.nix index d2da09d..60d1c20 100644 --- a/modules/lan-certs.nix +++ b/modules/lan-certs.nix @@ -1,7 +1,7 @@ -{config, lib, ...}: +{ config, lib, ... }: { options.addons.lan-certs.enable = lib.mkDefault true; - config = lib.mkIf config.addons.lan-certs.enable { - security.pki.certificateFiles = [../certs/wilkuu_ca.crt ]; + config = lib.mkIf config.addons.lan-certs.enable { + security.pki.certificateFiles = [ ../certs/wilkuu_ca.crt ]; }; } diff --git a/modules/remote-builder.nix b/modules/remote-builder.nix index ddd9a99..ca9b0a1 100644 --- a/modules/remote-builder.nix +++ b/modules/remote-builder.nix @@ -1,70 +1,70 @@ -{config, lib,...}: +{ config, lib, ... }: let -cfg = config.addons.remote_builder; -in + cfg = config.addons.remote_builder; +in { options.addons.remote_builder = { - enable = lib.mkEnableOption "Enable remote builder support"; + enable = lib.mkEnableOption "Enable remote builder support"; allowedKeyFiles = lib.mkOption { - default = []; - example = [../secrets/example.pub]; - description = "Public key files that are allowed on the remote builder"; + default = [ ]; + example = [ ../secrets/example.pub ]; + description = "Public key files that are allowed on the remote builder"; }; allowedKeys = lib.mkOption { - default = []; - example = ["ssh-ed25519 ... user@example.com"]; - description = "Public keys that are allowed on the remote builder"; + default = [ ]; + example = [ "ssh-ed25519 ... user@example.com" ]; + description = "Public keys that are allowed on the remote builder"; }; emulatedSystems = lib.mkOption { - default = []; - example = ["aarch64-linux"]; # TODO: This probably has a nice type that could be used - description = "Allow the remote builder to emultate builds for certain architectures"; - }; - openFirewall = lib.mkEnableOption "Forces the ssh port open for the remote builder"; + default = [ ]; + example = [ "aarch64-linux" ]; # TODO: This probably has a nice type that could be used + description = "Allow the remote builder to emultate builds for certain architectures"; + }; + openFirewall = lib.mkEnableOption "Forces the ssh port open for the remote builder"; }; - config = lib.mkIf cfg.enable (lib.mkMerge [ - { - users.users.remotebuild = { - isSystemUser = true; - group = "remotebuild"; - useDefaultShell = true; - # Add keys to remotebuild user. - openssh.authorizedKeys = { - keyFiles = cfg.allowedKeyFiles; - keys = cfg.allowedKeys; + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + users.users.remotebuild = { + isSystemUser = true; + group = "remotebuild"; + useDefaultShell = true; + # Add keys to remotebuild user. + openssh.authorizedKeys = { + keyFiles = cfg.allowedKeyFiles; + keys = cfg.allowedKeys; + }; }; - }; - users.groups.remotebuild = {}; - nix = { - nrBuildUsers = 64; - settings = { - trusted-users = [ "remotebuild" ]; + users.groups.remotebuild = { }; + nix = { + nrBuildUsers = 64; + settings = { + trusted-users = [ "remotebuild" ]; - min-free = 10 * 1024 * 1024; - max-free = 200 * 1024 * 1024; + min-free = 10 * 1024 * 1024; + max-free = 200 * 1024 * 1024; - max-jobs = "auto"; - cores = 8; + max-jobs = "auto"; + cores = 8; + }; }; - }; - - boot.binfmt.emulatedSystems = cfg.emulatedSystems; + boot.binfmt.emulatedSystems = cfg.emulatedSystems; - # TODO: Make a good default module for ssh. - services.openssh = { - enable = true; - settings.AllowUsers = ["remotebuild"]; - }; - } - - # Open firewall for ssh if not open already, not really recommended unless the server is meant to be public. - (lib.mkIf cfg.openFirewall { - services.openssh.openFirewall = lib.mkForce true; - }) - ]); + # TODO: Make a good default module for ssh. + services.openssh = { + enable = true; + settings.AllowUsers = [ "remotebuild" ]; + }; + } + # Open firewall for ssh if not open already, not really recommended unless the server is meant to be public. + (lib.mkIf cfg.openFirewall { + services.openssh.openFirewall = lib.mkForce true; + }) + ] + ); } diff --git a/modules/virt.nix b/modules/virt.nix index 597b957..53bd70a 100644 --- a/modules/virt.nix +++ b/modules/virt.nix @@ -1,34 +1,39 @@ -{pkgs, config, lib, ...}: -let - cfg = config.addons.virtualisation; -in +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.addons.virtualisation; +in { options.addons.virtualisation = { - host = lib.mkEnableOption "Allow to host vm's and containers"; - guest = lib.mkEnableOption "Enable guest agents"; - }; + host = lib.mkEnableOption "Allow to host vm's and containers"; + guest = lib.mkEnableOption "Enable guest agents"; + }; - config = lib.mkMerge([ + config = lib.mkMerge ([ (lib.mkIf cfg.host { - environment.systemPackages = with pkgs; [ - qemu - ]; + environment.systemPackages = with pkgs; [ + qemu + ]; programs.virt-manager.enable = true; virtualisation = { - spiceUSBRedirection.enable = true; + spiceUSBRedirection.enable = true; docker.enable = true; libvirtd = { enable = true; qemu = { - swtpm.enable = true; + swtpm.enable = true; vhostUserPackages = with pkgs; [ virtiofsd ]; }; }; - }; - + }; + }) (lib.mkIf cfg.guest { - services.spice-vdagentd.enable = true; + services.spice-vdagentd.enable = true; }) ]); -} +} diff --git a/modules/vpn.nix b/modules/vpn.nix index 1aaaa6e..b1b7463 100644 --- a/modules/vpn.nix +++ b/modules/vpn.nix @@ -1,10 +1,15 @@ -{config, pkgs, lib, ...}: +{ + config, + pkgs, + lib, + ... +}: let desktop = config.addons.desktop; - cfg = config.addons.vpn; - opt-mullvad = config.addons.vpn.mullvad; -in -{ + cfg = config.addons.vpn; + opt-mullvad = config.addons.vpn.mullvad; +in +{ options.addons.vpn = { eduvpn.enable = lib.mkEnableOption "Enable eduvpn"; mullvad.enable = lib.mkEnableOption "Enable mullvad vpn"; @@ -15,15 +20,17 @@ in (lib.mkIf cfg.eduvpn.enable { networking.networkmanager.plugins = [ pkgs.networkmanager-openvpn ]; }) - (lib.mkIf desktop.enable (lib.mkMerge [ - (lib.mkIf opt-mullvad.enable { - services.mullvad-vpn.package = pkgs.mullvad-vpn; - }) - (lib.mkIf cfg.eduvpn.enable { - environment.systemPackages = with pkgs; [ - eduvpn-client - ]; - }) - ])) + (lib.mkIf desktop.enable ( + lib.mkMerge [ + (lib.mkIf opt-mullvad.enable { + services.mullvad-vpn.package = pkgs.mullvad-vpn; + }) + (lib.mkIf cfg.eduvpn.enable { + environment.systemPackages = with pkgs; [ + eduvpn-client + ]; + }) + ] + )) ]; } diff --git a/users/live-user.nix b/users/live-user.nix index b7182c8..8e8c237 100644 --- a/users/live-user.nix +++ b/users/live-user.nix @@ -1,16 +1,29 @@ -{pkgs, lib, config,...}: { - imports = [./user-common.nix]; - programs.zsh.enable = true; - users.users.live-user = { - shell = pkgs.zsh; - isNormalUser = true; - initialPassword = "PleazeChangeThis123"; - extraGroups = [ "wheel" "networkmanager" "input" "docker" "adbusers" "libvirtd" ]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ - home-manager - ]; - }; +{ + pkgs, + lib, + config, + ... +}: +{ + imports = [ ./user-common.nix ]; + programs.zsh.enable = true; + users.users.live-user = { + shell = pkgs.zsh; + isNormalUser = true; + initialPassword = "PleazeChangeThis123"; + extraGroups = [ + "wheel" + "networkmanager" + "input" + "docker" + "adbusers" + "libvirtd" + ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + home-manager + ]; + }; - home-manager.users.live-user.imports = [ ../home/live-user.nix ]; + home-manager.users.live-user.imports = [ ../home/live-user.nix ]; } diff --git a/users/user-common.nix b/users/user-common.nix index b6da2bb..4d0e8ad 100644 --- a/users/user-common.nix +++ b/users/user-common.nix @@ -1,17 +1,26 @@ -{pkgs, config, inputs, ...}: { - # Pass host config to HM (Common config) - # TODO: Move this somewhere else. - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - backupFileExtension = "bak"; - - sharedModules = [ - ({ ...}: { - _module.args.hostconfig = config; +{ + pkgs, + config, + inputs, + ... +}: +{ + # Pass host config to HM (Common config) + # TODO: Move this somewhere else. + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + backupFileExtension = "bak"; - }) - inputs.sops-nix.homeManagerModules.sops - ]; - }; + sharedModules = [ + ( + { ... }: + { + _module.args.hostconfig = config; + _module.args.inputs = inputs; + } + ) + inputs.sops-nix.homeManagerModules.sops + ]; + }; } diff --git a/users/wilkuu.nix b/users/wilkuu.nix index 1815b10..e5404ae 100644 --- a/users/wilkuu.nix +++ b/users/wilkuu.nix @@ -1,17 +1,32 @@ -{pkgs, lib, config,...}: { - imports = [./user-common.nix]; - programs.zsh.enable = true; - programs.adb.enable = true; - users.users.wilkuu = { - shell = pkgs.zsh; - isNormalUser = true; - initialPassword = "PleazeChangeThis123"; - extraGroups = [ "wheel" "adbusers" "networkmanager" "input" "docker" "adbusers" "libvirtd" "libvirt"]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ - home-manager - ]; - }; +{ + pkgs, + lib, + config, + ... +}: +{ + imports = [ ./user-common.nix ]; + programs.zsh.enable = true; + programs.adb.enable = true; + users.users.wilkuu = { + shell = pkgs.zsh; + isNormalUser = true; + initialPassword = "PleazeChangeThis123"; + extraGroups = [ + "wheel" + "adbusers" + "networkmanager" + "input" + "docker" + "adbusers" + "libvirtd" + "libvirt" + ]; # Enable ‘sudo’ for the user. + packages = with pkgs; [ + home-manager + ]; + }; - home-manager.users.wilkuu.imports = [ ../home/wilkuu.nix ]; + home-manager.users.wilkuu.imports = [ ../home/wilkuu.nix ]; } -- cgit v1.3.1