diff --git a/.gitignore b/.gitignore index 73105bb..21fb0b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,3 @@ -# Nix build outputs -result -result-* +result/ .direnv/ -oci-trantor/ -tailscale-tailnet/ -cloudflare-baduhaidev - -# Personal notes and temporary files -todo.md -notes.md -scratch/ -tmp/ +.pre-commit-config.yaml diff --git a/aspects/ai.nix b/aspects/ai.nix deleted file mode 100644 index f3eb6dd..0000000 --- a/aspects/ai.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.ai = - { inputs, pkgs, ... }: - { - environment.systemPackages = - (with pkgs; [ ]) - ++ (with inputs.nix-ai-tools.packages.${pkgs.stdenv.hostPlatform.system}; [ - opencode - ]); - - nix.settings = { - extra-substituters = [ "https://cache.numtide.com" ]; - extra-trusted-public-keys = [ - "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" - ]; - }; - }; -} diff --git a/aspects/base/bash.nix b/aspects/base/bash.nix deleted file mode 100644 index 6ba97ef..0000000 --- a/aspects/base/bash.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - flake.modules.homeManager.bash = - { - config, - lib, - pkgs, - ... - }: - { - programs.bash = { - enable = true; - historyFile = "~/.cache/bash_history"; - }; - }; -} diff --git a/aspects/base/boot.nix b/aspects/base/boot.nix deleted file mode 100644 index ec8593d..0000000 --- a/aspects/base/boot.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.boot = - { pkgs, ... }: - { - boot = { - loader = { - timeout = 1; - efi.canTouchEfiVariables = true; - systemd-boot = { - enable = true; - editor = false; - consoleMode = "max"; - sortKey = "aa"; - netbootxyz = { - enable = true; - sortKey = "zz"; - }; - }; - }; - }; - }; -} diff --git a/aspects/base/console.nix b/aspects/base/console.nix deleted file mode 100644 index 6bb7be4..0000000 --- a/aspects/base/console.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.console = - { ... }: - { - console = { - useXkbConfig = true; - earlySetup = true; - }; - }; -} diff --git a/aspects/base/firewall.nix b/aspects/base/firewall.nix deleted file mode 100644 index 68ffa6e..0000000 --- a/aspects/base/firewall.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.firewall = - { ... }: - { - networking = { - firewall.enable = true; - nftables.enable = true; - }; - }; -} diff --git a/aspects/base/fish.nix b/aspects/base/fish.nix deleted file mode 100644 index 8ed326a..0000000 --- a/aspects/base/fish.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ ... }: -{ - flake.modules = { - nixos.fish = - { ... }: - { - programs.fish.enable = true; - }; - homeManager.fish = - { - config, - lib, - pkgs, - ... - }: - { - programs.fish = { - enable = true; - interactiveShellInit = '' - set fish_greeting - ${lib.getExe pkgs.nix-your-shell} fish | source - ''; - loginShellInit = "${lib.getExe pkgs.nix-your-shell} fish | source"; - plugins = [ - { - name = "bang-bang"; - src = pkgs.fetchFromGitHub { - owner = "oh-my-fish"; - repo = "plugin-bang-bang"; - rev = "f969c618301163273d0a03d002614d9a81952c1e"; - sha256 = "sha256-A8ydBX4LORk+nutjHurqNNWFmW6LIiBPQcxS3x4nbeQ="; - }; - } - { - name = "z"; - src = pkgs.fetchFromGitHub { - owner = "jethrokuan"; - repo = "z"; - rev = "067e867debee59aee231e789fc4631f80fa5788e"; - sha256 = "sha256-emmjTsqt8bdI5qpx1bAzhVACkg0MNB/uffaRjjeuFxU="; - }; - } - ]; - }; - }; - }; -} diff --git a/aspects/base/locale.nix b/aspects/base/locale.nix deleted file mode 100644 index 4d0c716..0000000 --- a/aspects/base/locale.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.locale = - { ... }: - { - time.timeZone = "America/Bahia"; - - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "pt_BR.utf8"; - LC_COLLATE = "pt_BR.utf8"; - LC_IDENTIFICATION = "pt_BR.utf8"; - LC_MEASUREMENT = "pt_BR.utf8"; - LC_MONETARY = "pt_BR.utf8"; - LC_NAME = "pt_BR.utf8"; - LC_NUMERIC = "pt_BR.utf8"; - LC_PAPER = "pt_BR.utf8"; - LC_TELEPHONE = "pt_BR.utf8"; - LC_TIME = "en_IE.utf8"; - }; - }; - }; -} diff --git a/aspects/base/nix.nix b/aspects/base/nix.nix deleted file mode 100644 index 2442024..0000000 --- a/aspects/base/nix.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.nix = - { inputs, pkgs, ... }: - { - imports = [ inputs.nixos-cli.nixosModules.nixos-cli ]; - - nix = { - settings = { - auto-optimise-store = true; - connect-timeout = 10; - log-lines = 25; - min-free = 128000000; - max-free = 1000000000; - trusted-users = [ "@wheel" ]; - }; - extraOptions = "experimental-features = nix-command flakes"; - gc = { - automatic = true; - options = "--delete-older-than 8d"; - }; - }; - - nixpkgs.config = { - allowUnfree = true; - enableParallelBuilding = true; - buildManPages = false; - buildDocs = false; - }; - - services.nixos-cli = { - enable = true; - config = { - use_nvd = true; - ignore_dirty_tree = true; - apply = { - reexec_as_root = true; - use_nom = true; - }; - confirmation.empty = "default-yes"; - }; - }; - - environment.systemPackages = with pkgs; [ - nix-output-monitor - nvd - ]; - - system.stateVersion = "22.11"; - }; -} diff --git a/aspects/base/security.nix b/aspects/base/security.nix deleted file mode 100644 index 310e345..0000000 --- a/aspects/base/security.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.security = - { ... }: - { - security.sudo = { - wheelNeedsPassword = false; - extraConfig = '' - Defaults lecture = never - ''; - }; - }; -} diff --git a/aspects/base/ssh.nix b/aspects/base/ssh.nix deleted file mode 100644 index 6569bf0..0000000 --- a/aspects/base/ssh.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.ssh = - { ... }: - { - services.openssh = { - enable = true; - settings.PermitRootLogin = "no"; - extraConfig = '' - PrintLastLog no - ''; - }; - programs = { - bash.interactiveShellInit = '' - if [ -n "$SSH_CONNECTION" ] && [ -z "$IN_NIX_SHELL" ] && [ -z "$TMUX" ]; then - export TERM=xterm-256color - clear - fastfetch - fi - ''; - fish.interactiveShellInit = '' - set fish_greeting - if set -q SSH_CONNECTION; and not set -q IN_NIX_SHELL; and not set -q TMUX - export TERM=xterm-256color - clear - fastfetch - end - ''; - }; - }; -} diff --git a/aspects/bluetooth.nix b/aspects/bluetooth.nix deleted file mode 100644 index 6c7b2d8..0000000 --- a/aspects/bluetooth.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.bluetooth = - { - config, - lib, - pkgs, - ... - }: - { - hardware.bluetooth = { - enable = true; - powerOnBoot = false; - }; - }; -} diff --git a/aspects/cli/btop.nix b/aspects/cli/btop.nix deleted file mode 100644 index 220a462..0000000 --- a/aspects/cli/btop.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ ... }: -{ - flake.modules = { - nixos.btop = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ btop ]; - }; - - homeManager.btop = - { - config, - lib, - pkgs, - ... - }: - { - programs.btop = { - enable = true; - settings = { - theme_background = false; - proc_sorting = "cpu direct"; - update_ms = 500; - }; - }; - }; - }; -} diff --git a/aspects/cli/comma.nix b/aspects/cli/comma.nix deleted file mode 100644 index 169144f..0000000 --- a/aspects/cli/comma.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - flake.modules.homeManager.comma = - { - config, - lib, - pkgs, - inputs, - ... - }: - { - imports = [ inputs.nix-index-database.homeModules.nix-index ]; - - programs.nix-index-database.comma.enable = true; - }; -} diff --git a/aspects/cli/direnv.nix b/aspects/cli/direnv.nix deleted file mode 100644 index 2cfb2ef..0000000 --- a/aspects/cli/direnv.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - flake.modules.homeManager.direnv = - { - config, - lib, - pkgs, - ... - }: - { - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - }; -} diff --git a/aspects/cli/helix.nix b/aspects/cli/helix.nix deleted file mode 100644 index a21641a..0000000 --- a/aspects/cli/helix.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ ... }: -{ - flake.modules = { - nixos.helix = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - helix - ]; - }; - - homeManager.helix = - { - config, - lib, - pkgs, - ... - }: - { - home.sessionVariables = { - EDITOR = "hx"; - }; - - programs.helix = { - enable = true; - settings = { - editor = { - file-picker.hidden = false; - idle-timeout = 0; - line-number = "relative"; - cursor-shape = { - normal = "underline"; - insert = "bar"; - select = "underline"; - }; - soft-wrap.enable = true; - auto-format = true; - indent-guides.render = true; - }; - keys.normal = { - space = { - o = "file_picker_in_current_buffer_directory"; - esc = [ - "collapse_selection" - "keep_primary_selection" - ]; - }; - }; - }; - languages = { - language = [ - { - name = "nix"; - auto-format = true; - formatter.command = "nixfmt"; - } - { - name = "typst"; - auto-format = true; - formatter.command = "typstyle -c 1000 -i"; - } - ]; - }; - }; - }; - }; -} diff --git a/aspects/cli/hm-cli.nix b/aspects/cli/hm-cli.nix deleted file mode 100644 index 97d79e4..0000000 --- a/aspects/cli/hm-cli.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: -{ - flake.modules.homeManager.hm-cli = - { - config, - lib, - pkgs, - ... - }: - { - home = { - packages = with pkgs; [ hm-cli ]; - sessionVariables = { - HM_PATH = "/etc/nixos"; - }; - }; - }; -} diff --git a/aspects/cli/starship.nix b/aspects/cli/starship.nix deleted file mode 100644 index 3ac5e4f..0000000 --- a/aspects/cli/starship.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ ... }: -{ - flake.modules.homeManager.starship = - { - config, - lib, - pkgs, - ... - }: - { - programs.starship = { - enable = true; - enableBashIntegration = true; - enableFishIntegration = true; - settings = { - add_newline = false; - format = '' - $hostname$directory$git_branch$git_status$nix_shell - [ ❯ ](bold green) - ''; - right_format = "$cmd_duration$character"; - hostname = { - ssh_symbol = "󰖟 "; - }; - character = { - error_symbol = "[](red)"; - success_symbol = "[󱐋](green)"; - }; - cmd_duration = { - format = "[󰄉 $duration ]($style)"; - style = "yellow"; - min_time = 500; - }; - git_branch = { - symbol = " "; - style = "purple"; - }; - git_status.style = "red"; - nix_shell = { - format = "via [$symbol$state]($style)"; - heuristic = true; - style = "blue"; - symbol = "󱄅 "; - }; - }; - }; - }; -} diff --git a/aspects/cli/tmux.nix b/aspects/cli/tmux.nix deleted file mode 100644 index 4937574..0000000 --- a/aspects/cli/tmux.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ ... }: -{ - flake.modules = { - nixos.tmux = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - tmux - ]; - }; - - homeManager.tmux = - { - config, - lib, - pkgs, - ... - }: - { - programs.tmux = { - enable = true; - clock24 = true; - terminal = "xterm-256color"; - mouse = true; - keyMode = "vi"; - }; - }; - }; -} diff --git a/aspects/constants.nix b/aspects/constants.nix deleted file mode 100644 index 5a82660..0000000 --- a/aspects/constants.nix +++ /dev/null @@ -1,217 +0,0 @@ -{ - inputs, - lib, - config, - ... -}: - -let - # Host submodule type - hostType = lib.types.submodule { - options = { - lanIP = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "LAN IP address for the host"; - }; - tailscaleIP = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "Tailscale IP address for the host"; - }; - }; - }; - - # Service submodule type - serviceType = lib.types.submodule { - options = { - name = lib.mkOption { - type = lib.types.str; - description = "Service name"; - }; - domain = lib.mkOption { - type = lib.types.str; - description = "Domain name for the service"; - }; - host = lib.mkOption { - type = lib.types.str; - description = "Host where the service runs"; - }; - public = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Whether the service is publicly accessible"; - }; - lanIP = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "LAN IP address (inherited from host)"; - }; - tailscaleIP = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "Tailscale IP address (inherited from host)"; - }; - }; - }; - - # Import shared data (also used by terranix) - sharedData = import ../data/services.nix; - - # Enrich services with host IP information - enrichServices = - hosts: services: - map ( - svc: - let - hostInfo = hosts.${svc.host} or { }; - in - svc - // { - lanIP = hostInfo.lanIP or null; - tailscaleIP = hostInfo.tailscaleIP or null; - } - ) services; - -in -{ - options.flake = { - hosts = lib.mkOption { - type = lib.types.attrsOf hostType; - default = { }; - description = "Host definitions with IP addresses"; - }; - - services = lib.mkOption { - type = lib.types.listOf serviceType; - default = [ ]; - description = "Service definitions with enriched host information"; - }; - - lib = lib.mkOption { - type = lib.types.attrsOf lib.types.raw; - default = { }; - description = "Utility functions for flake configuration"; - }; - }; - - config.flake = { - hosts = sharedData.hosts; - - services = enrichServices config.flake.hosts sharedData.services; - - lib = { - # Nginx virtual host utilities - mkNginxVHosts = - { domains }: - let - mkVHostConfig = - domain: vhostConfig: - lib.recursiveUpdate { - useACMEHost = domain; - forceSSL = true; - kTLS = true; - } vhostConfig; - in - lib.mapAttrs mkVHostConfig domains; - - # Split DNS utilities for unbound - # Generates unbound view config from a list of DNS entries - mkSplitDNS = - entries: - let - tailscaleData = map (e: ''"${e.domain}. IN A ${e.tailscaleIP}"'') entries; - lanData = map (e: ''"${e.domain}. IN A ${e.lanIP}"'') entries; - in - [ - { - name = "tailscale"; - view-first = true; - local-zone = ''"baduhai.dev." transparent''; - local-data = tailscaleData; - } - { - name = "lan"; - view-first = true; - local-zone = ''"baduhai.dev." transparent''; - local-data = lanData; - } - ]; - # Generates flake.homeConfigurations - mkHomeConfiguration = - { - user, - hostname, - system ? "x86_64-linux", - stateVersion ? "22.05", - nixpkgs ? inputs.nixpkgs, # override with e.g. inputs.nixpkgs-stable - userModules ? [ ], - overlays ? [ inputs.self.overlays.default ], - homeManagerModules ? with inputs.self.modules.homeManager; [ - base - cli - ], - userDirectory ? "/home/${user}", - }: - inputs.home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - - extraSpecialArgs = { - inherit inputs hostname; - }; - - modules = [ - { nixpkgs.overlays = overlays; } - { - home = { - username = user; - homeDirectory = userDirectory; - inherit stateVersion; - }; - } - ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) - "/${inputs.self}/aspects/users/_${user}" - ) - ] - ++ homeManagerModules - ++ userModules; - }; - # Generates flake.nixosConfigurations - mkHost = - { - hostname, - system ? "x86_64-linux", - nixpkgs ? inputs.nixpkgs, - overlays ? [ - inputs.agenix.overlays.default - inputs.self.overlays.default - ], - ephemeralRootDev ? null, # pass rootDevice string to enable, e.g. ephemeralephemeralRootDev = "/dev/mapper/cryptroot" - nixosModules ? with inputs.self.modules.nixos; [ - base - cli - user - root - ], - extraModules ? [ ], - }: - nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs; }; - modules = [ - inputs.agenix.nixosModules.default - { networking.hostName = hostname; } - { nixpkgs.overlays = overlays; } - ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) - "${inputs.self}/aspects/hosts/_${hostname}" - ) - ] - ++ (lib.optional (ephemeralRootDev != null) ( - inputs.self.factory.ephemeral { rootDevice = ephemeralRootDev; } - )) - ++ nixosModules - ++ extraModules; - }; - }; - }; -} diff --git a/aspects/desktop/graphics.nix b/aspects/desktop/graphics.nix deleted file mode 100644 index 7d1ed6d..0000000 --- a/aspects/desktop/graphics.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.graphics = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - gimp - inkscape - plasticity - ]; - - services.flatpak.packages = [ - "com.boxy_svg.BoxySVG" - rec { - appId = "io.github.softfever.OrcaSlicer"; - sha256 = "0hdx5sg6fknj1pfnfxvlfwb5h6y1vjr6fyajbsnjph5gkp97c6p1"; - bundle = "${pkgs.fetchurl { - url = "https://github.com/SoftFever/OrcaSlicer/releases/download/v2.3.0/OrcaSlicer-Linux-flatpak_V2.3.0_x86_64.flatpak"; - inherit sha256; - }}"; - } - ]; - }; -} diff --git a/aspects/desktop/media.nix b/aspects/desktop/media.nix deleted file mode 100644 index 7543c0a..0000000 --- a/aspects/desktop/media.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ ... }: - -{ - flake.modules = { - nixos.media = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - decibels - loupe - obs-studio - showtime - ]; - }; - - homeManager.media = - { pkgs, ... }: - { - programs.obs-studio = { - enable = true; - plugins = with pkgs.obs-studio-plugins; [ - obs-vkcapture - obs-backgroundremoval - obs-pipewire-audio-capture - ]; - }; - }; - }; -} diff --git a/aspects/desktop/niri.nix b/aspects/desktop/niri.nix deleted file mode 100644 index 9408097..0000000 --- a/aspects/desktop/niri.nix +++ /dev/null @@ -1,246 +0,0 @@ -{ ... }: -{ - flake.modules = { - nixos.niri = - { - config, - lib, - pkgs, - ... - }: - { - services.greetd.settings = { - default_session.command = "${lib.getExe pkgs.tuigreet} --user-menu --time --remember --asterisks --cmd ${config.programs.niri.package}/bin/niri-session"; - }; - - programs.niri.enable = true; - }; - homeManager.niri = - { - config, - lib, - pkgs, - inputs, - hostname ? null, - ... - }: - let - isRotterdam = hostname == "rotterdam"; - in - { - imports = [ inputs.noctalia.homeModules.default ]; - - services.kanshi = { - enable = true; - settings = [ - { - profile.name = "default"; - profile.outputs = [ - { - criteria = "*"; - scale = 1.0; - } - ]; - } - ]; - }; - - home = { - packages = with pkgs; [ - xwayland-satellite - inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default - ]; - sessionVariables.QT_QPA_PLATFORMTHEME = "gtk3"; - }; - - xdg.configFile."niri/config.kdl".text = '' - input { - keyboard { - xkb { - layout "us" - variant "altgr-intl" - } - } - touchpad { - tap - dwt - drag true - drag-lock - natural-scroll - accel-speed 0.2 - accel-profile "flat" - scroll-method "two-finger" - middle-emulation - } - mouse { - natural-scroll - accel-speed 0.2 - accel-profile "flat" - } - warp-mouse-to-focus mode="center-xy" - focus-follows-mouse - } - - output "LG Electronics LG ULTRAWIDE 206AZFM5E459" { - layout { - preset-column-widths { - proportion 0.33333 - proportion 0.5 - proportion 0.66667 - } - default-column-width { proportion 0.33333; } - } - } - - layout { - gaps 8 - center-focused-column "never" - always-center-single-column - empty-workspace-above-first - preset-column-widths { - proportion 0.5 - proportion 1.0 - } - default-column-width { proportion 0.5; } - focus-ring { - off - } - border { - width 4 - active-color "#ffc87f" - inactive-color "#505050" - urgent-color "#9b0000" - } - tab-indicator { - width 4 - gap 4 - place-within-column - } - } - - overview { - zoom 0.65 - } - - spawn-at-startup "noctalia-shell" "-d" - spawn-at-startup "${lib.getExe pkgs.niri-auto-centre}" - layer-rule { - match namespace="^noctalia-overview*" - place-within-backdrop true - } - - hotkey-overlay { - skip-at-startup - } - - prefer-no-csd - screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" - - animations { - slowdown 0.3 - } - - window-rule { - match app-id="zen" - default-column-width { proportion ${if isRotterdam then "0.5" else "1.0"}; } - } - - window-rule { - geometry-corner-radius 12 - clip-to-geometry true - } - - config-notification { - disable-failed - } - - binds { - Alt+Space repeat=false { spawn "vicinae" "toggle"; } - XF86AudioRaiseVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "increase"; } - XF86AudioLowerVolume allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "decrease"; } - XF86AudioMute allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "volume" "muteOutput"; } - XF86MonBrightnessUp allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "brightness" "increase"; } - XF86MonBrightnessDown allow-when-locked=true { spawn "noctalia-shell" "ipc" "call" "brightness" "decrease"; } - XF86AudioPlay allow-when-locked=true { spawn "${lib.getExe pkgs.playerctl}" "play-pause"; } - XF86AudioStop allow-when-locked=true { spawn "${lib.getExe pkgs.playerctl}" "stop"; } - XF86AudioPrev allow-when-locked=true { spawn "${lib.getExe pkgs.playerctl}" "previous"; } - XF86AudioNext allow-when-locked=true { spawn "${lib.getExe pkgs.playerctl}" "next"; } - Mod+V repeat=false { spawn "vicinae" "vicinae://extensions/vicinae/clipboard/history"; } - Mod+Shift+L repeat=false { spawn "noctalia-shell" "ipc" "call" "lockScreen" "lock"; } - Mod+Return { spawn "ghostty"; } - Ctrl+Alt+Shift+A allow-when-locked=true { spawn "toggleaudiosink"; } - Mod+W repeat=false { toggle-overview; } - Mod+Q { close-window; } - Alt+Shift+Q { close-window;} - Mod+Shift+Q { close-window; } - Alt+F4 { close-window; } - Mod+Left { focus-column-left; } - Mod+Down { focus-window-or-workspace-down; } - Mod+Up { focus-window-or-workspace-up; } - Mod+Right { focus-column-right; } - Mod+H { focus-column-left; } - Mod+L { focus-column-right; } - Mod+J { focus-window-or-workspace-down; } - Mod+K { focus-window-or-workspace-up; } - Mod+Ctrl+Left { move-column-left; } - Mod+Ctrl+Down { move-window-down-or-to-workspace-down; } - Mod+Ctrl+Up { move-window-up-or-to-workspace-up; } - Mod+Ctrl+Right { move-column-right; } - Mod+Ctrl+H { move-column-left; } - Mod+Ctrl+J { move-window-down-or-to-workspace-down; } - Mod+Ctrl+K { move-window-up-or-to-workspace-up; } - Mod+Ctrl+L { move-column-right; } - Mod+Home { focus-column-first; } - Mod+End { focus-column-last; } - Mod+Ctrl+Home { move-column-to-first; } - Mod+Ctrl+End { move-column-to-last; } - Mod+Alt+Left { focus-monitor-left; } - Mod+Alt+Down { focus-monitor-down; } - Mod+Alt+Up { focus-monitor-up; } - Mod+Alt+Right { focus-monitor-right; } - Mod+Alt+H { focus-monitor-left; } - Mod+Alt+J { focus-monitor-down; } - Mod+Alt+K { focus-monitor-up; } - Mod+Alt+L { focus-monitor-right; } - Mod+Alt+Ctrl+Left { move-column-to-monitor-left; } - Mod+Alt+Ctrl+Down { move-column-to-monitor-down; } - Mod+Alt+Ctrl+Up { move-column-to-monitor-up; } - Mod+Alt+Ctrl+Right { move-column-to-monitor-right; } - Mod+Alt+Ctrl+H { move-column-to-monitor-left; } - Mod+Alt+Ctrl+J { move-column-to-monitor-down; } - Mod+Alt+Ctrl+K { move-column-to-monitor-up; } - Mod+Alt+Ctrl+L { move-column-to-monitor-right; } - Mod+Ctrl+U { move-workspace-down; } - Mod+Ctrl+I { move-workspace-up; } - Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } - Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } - Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } - Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } - Mod+Shift+WheelScrollDown { focus-column-right; } - Mod+Shift+WheelScrollUp { focus-column-left; } - Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } - Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } - Mod+BracketLeft { consume-or-expel-window-left; } - Mod+BracketRight { consume-or-expel-window-right; } - Mod+Comma { consume-window-into-column; } - Mod+Period { expel-window-from-column; } - Mod+R { switch-preset-column-width; } - Mod+F { maximize-column; } - Mod+Ctrl+F { fullscreen-window; } - Mod+C { center-visible-columns; } - Mod+Ctrl+C { center-column; } - Mod+Space { toggle-window-floating; } - Mod+Ctrl+Space { switch-focus-between-floating-and-tiling; } - Mod+T { toggle-column-tabbed-display; } - Print { screenshot-screen; } - Mod+Print { screenshot; } - Ctrl+Print { screenshot-window; } - Mod+Backspace allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } - Mod+Alt+E { spawn "noctalia-shell" "ipc" "call" "sessionMenu" "toggle"; } - Ctrl+Alt+Delete { spawn "noctalia-shell" "ipc" "call" "sessionMenu" "toggle"; } - Mod+Ctrl+P { power-off-monitors; } - } - ''; - }; - }; -} diff --git a/aspects/desktop/office.nix b/aspects/desktop/office.nix deleted file mode 100644 index 68d958a..0000000 --- a/aspects/desktop/office.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.office = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - aspell - aspellDicts.de - aspellDicts.en - aspellDicts.en-computers - aspellDicts.pt_BR - glow - papers - presenterm - rnote - ]; - - services.flatpak.packages = [ - "com.collabora.Office" - ]; - }; -} diff --git a/aspects/desktop/web.nix b/aspects/desktop/web.nix deleted file mode 100644 index 9d6494f..0000000 --- a/aspects/desktop/web.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.web = - { - inputs, - pkgs, - ... - }: - { - environment.systemPackages = with pkgs; [ - inputs.zen-browser.packages."${pkgs.stdenv.hostPlatform.system}".default - beeper - bitwarden-desktop - fragments - nextcloud-client - tor-browser - ungoogled-chromium - vesktop - ]; - }; -} diff --git a/aspects/dev.nix b/aspects/dev.nix deleted file mode 100644 index afe9edc..0000000 --- a/aspects/dev.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.dev = - { - config, - lib, - pkgs, - ... - }: - { - environment.systemPackages = with pkgs; [ - android-tools - lazygit - fd - fzf - nixfmt - nix-init - ripgrep - ]; - - users.users.user.extraGroups = [ "adbusers" ]; - }; -} diff --git a/aspects/ephemeral.nix b/aspects/ephemeral.nix deleted file mode 100644 index 90c03c6..0000000 --- a/aspects/ephemeral.nix +++ /dev/null @@ -1,139 +0,0 @@ -# Ephemeral root aspect - provides automatic btrfs root subvolume rollover -# Exports both a base module with options and a factory function for easy configuration -{ inputs, ... }: -{ - # Base module with options (for external flakes or direct use) - flake.modules.nixos.ephemeral = - { lib, config, ... }: - let - cfg = config.ephemeral; - in - { - options.ephemeral = { - enable = lib.mkEnableOption "ephemeral root with automatic rollback"; - - rootDevice = lib.mkOption { - type = lib.types.str; - example = "/dev/mapper/cryptroot"; - description = "Device path for the root btrfs filesystem"; - }; - - rootSubvolume = lib.mkOption { - type = lib.types.str; - default = "@root"; - description = "Name of the root btrfs subvolume"; - }; - - oldRootRetentionDays = lib.mkOption { - type = lib.types.int; - default = 30; - description = "Number of days to keep old root snapshots before deletion"; - }; - }; - - config = lib.mkIf cfg.enable { - boot.initrd.systemd.services.recreate-root = { - description = "Rolling over and creating new filesystem root"; - requires = [ "initrd-root-device.target" ]; - after = [ - "local-fs-pre.target" - "initrd-root-device.target" - ]; - requiredBy = [ "initrd-root-fs.target" ]; - before = [ "sysroot.mount" ]; - unitConfig = { - AssertPathExists = "/etc/initrd-release"; - DefaultDependencies = false; - }; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = '' - set -euo pipefail - - mkdir /btrfs_tmp - if ! mount ${cfg.rootDevice} /btrfs_tmp; then - echo "ERROR: Failed to mount ${cfg.rootDevice}" - exit 1 - fi - - if [[ -e /btrfs_tmp/${cfg.rootSubvolume} ]]; then - mkdir -p /btrfs_tmp/old_roots - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/${cfg.rootSubvolume})" "+%Y-%m-%-d_%H:%M:%S") - mv /btrfs_tmp/${cfg.rootSubvolume} "/btrfs_tmp/old_roots/$timestamp" - fi - - delete_subvolume_recursively() { - IFS=$'\n' - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/btrfs_tmp/$i" - done - btrfs subvolume delete "$1" - } - - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +${toString cfg.oldRootRetentionDays}); do - delete_subvolume_recursively "$i" - done - - if ! btrfs subvolume create /btrfs_tmp/${cfg.rootSubvolume}; then - echo "ERROR: Failed to create subvolume ${cfg.rootSubvolume}" - umount /btrfs_tmp - exit 1 - fi - - umount /btrfs_tmp - ''; - }; - }; - }; - - # Factory function that generates configured modules - flake.factory.ephemeral = - { - rootDevice, - rootSubvolume ? "@root", - retentionDays ? 30, - persistentStoragePath ? "/persistent", - persistentFiles ? [ - "/etc/machine-id" - "/etc/ssh/ssh_host_ed25519_key" - "/etc/ssh/ssh_host_ed25519_key.pub" - "/etc/ssh/ssh_host_rsa_key" - "/etc/ssh/ssh_host_rsa_key.pub" - ], - persistentDirectories ? [ - "/etc/NetworkManager/system-connections" - "/etc/nixos" - "/var/lib/bluetooth" - "/var/lib/flatpak" - "/var/lib/lxd" - "/var/lib/nixos" - "/var/lib/systemd/coredump" - "/var/lib/systemd/timers" - "/var/lib/tailscale" - "/var/log" - ], - }: - { ... }: - { - imports = [ - inputs.impermanence.nixosModules.impermanence - inputs.self.modules.nixos.ephemeral - ]; - - ephemeral = { - enable = true; - inherit rootDevice rootSubvolume; - oldRootRetentionDays = retentionDays; - }; - - fileSystems."/persistent".neededForBoot = true; - - environment.persistence.main = { - inherit persistentStoragePath; - files = persistentFiles; - directories = persistentDirectories; - }; - }; -} diff --git a/aspects/fwupd.nix b/aspects/fwupd.nix deleted file mode 100644 index 217f1eb..0000000 --- a/aspects/fwupd.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.fwupd = - { - config, - lib, - pkgs, - ... - }: - { - services.fwupd.enable = true; - }; -} diff --git a/aspects/gaming/mangohud.nix b/aspects/gaming/mangohud.nix deleted file mode 100644 index 14a3df6..0000000 --- a/aspects/gaming/mangohud.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ ... }: - -{ - flake.modules = { - nixos.mangohud = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - mangohud - ]; - }; - - homeManager.mangohud = - { config, ... }: - { - programs.mangohud = { - enable = true; - enableSessionWide = true; - settings = { - position = "top-left"; - fps = true; - frametime = false; - frame_timing = false; - gpu_stats = true; - gpu_temp = true; - gpu_power = true; - cpu_stats = true; - cpu_temp = true; - cpu_power = true; - ram = true; - vram = true; - gamemode = false; - vkbasalt = false; - version = false; - engine_version = false; - vulkan_driver = false; - wine = false; - time = false; - fps_sampling_period = 500; - toggle_hud = "Shift_L+F12"; - toggle_logging = "Ctrl_L+F2"; - output_folder = "${config.home.homeDirectory}/.local/share/mangohud"; - }; - }; - }; - }; -} diff --git a/aspects/gaming/steam.nix b/aspects/gaming/steam.nix deleted file mode 100644 index a10d0e4..0000000 --- a/aspects/gaming/steam.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.steam = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - steam-run - ]; - - programs = { - steam = { - enable = true; - extraCompatPackages = [ pkgs.proton-ge-bin ]; - }; - gamemode.enable = true; - }; - - services.flatpak.packages = [ - "com.steamgriddb.SGDBoop" - "io.github.Foldex.AdwSteamGtk" - ]; - }; -} diff --git a/aspects/hosts/_alexandria/jellyfin.nix b/aspects/hosts/_alexandria/jellyfin.nix deleted file mode 100644 index 0b024bd..0000000 --- a/aspects/hosts/_alexandria/jellyfin.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, inputs, ... }: -let - mkNginxVHosts = inputs.self.lib.mkNginxVHosts; -in -{ - services.jellyfin = { - enable = true; - openFirewall = true; - }; - - services.nginx.virtualHosts = mkNginxVHosts { - domains."jellyfin.baduhai.dev".locations."/".proxyPass = "http://127.0.0.1:8096/"; - }; -} diff --git a/aspects/hosts/_alexandria/nginx.nix b/aspects/hosts/_alexandria/nginx.nix deleted file mode 100644 index 087faf4..0000000 --- a/aspects/hosts/_alexandria/nginx.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: - -let - services = inputs.self.services; - - # Get all unique domains from shared services that have LAN IPs (served by this host) - localDomains = lib.unique (map (s: s.domain) (lib.filter (s: s.host == "alexandria") services)); - - # Generate ACME cert configs for all local domains - acmeCerts = lib.genAttrs localDomains (domain: { - group = "nginx"; - }); -in - -{ - security.acme = { - acceptTerms = true; - defaults = { - email = "baduhai@proton.me"; - dnsResolver = "1.1.1.1:53"; - dnsProvider = "cloudflare"; - credentialsFile = config.age.secrets.cloudflare.path; - }; - certs = acmeCerts; - }; - - services.nginx = { - enable = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts = { - "_" = { - default = true; - locations."/".return = "444"; - }; - }; - }; - - users.users.nginx.extraGroups = [ "acme" ]; - - networking.firewall.allowedTCPPorts = [ - 80 - 443 - ]; - - age.secrets.cloudflare = { - file = "${inputs.self}/secrets/cloudflare.age"; - owner = "nginx"; - group = "nginx"; - }; -} diff --git a/aspects/hosts/_alexandria/unbound.nix b/aspects/hosts/_alexandria/unbound.nix deleted file mode 100644 index 8aedc37..0000000 --- a/aspects/hosts/_alexandria/unbound.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ inputs, lib, ... }: - -let - services = inputs.self.services; -in - -{ - services.unbound = { - enable = true; - enableRootTrustAnchor = true; - settings = { - server = { - interface = [ - "0.0.0.0" - "::" - ]; - access-control = [ - "127.0.0.0/8 allow" - "192.168.0.0/16 allow" - "::1/128 allow" - ]; - - num-threads = 2; - msg-cache-size = "50m"; - rrset-cache-size = "100m"; - cache-min-ttl = 300; - cache-max-ttl = 86400; - prefetch = true; - prefetch-key = true; - hide-identity = true; - hide-version = true; - so-rcvbuf = "1m"; - so-sndbuf = "1m"; - - # LAN-only DNS records - local-zone = ''"baduhai.dev." transparent''; - local-data = map (e: ''"${e.domain}. IN A ${e.lanIP}"'') (lib.filter (e: e.lanIP != null) services); - }; - - forward-zone = [ - { - name = "."; - forward-addr = [ - "1.1.1.1@853#cloudflare-dns.com" - "1.0.0.1@853#cloudflare-dns.com" - ]; - forward-tls-upstream = true; - } - ]; - }; - }; - - networking.firewall = { - allowedTCPPorts = [ 53 ]; - allowedUDPPorts = [ 53 ]; - }; -} diff --git a/aspects/hosts/_alexandria/vaultwarden.nix b/aspects/hosts/_alexandria/vaultwarden.nix deleted file mode 100644 index 8577b2d..0000000 --- a/aspects/hosts/_alexandria/vaultwarden.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -let - mkNginxVHosts = inputs.self.lib.mkNginxVHosts; -in -{ - services.vaultwarden = { - enable = true; - config = { - DOMAIN = "https://pass.baduhai.dev"; - SIGNUPS_ALLOWED = false; - ROCKET_ADDRESS = "127.0.0.1"; - ROCKET_PORT = 58222; - }; - }; - - services.nginx.virtualHosts = mkNginxVHosts { - domains."pass.baduhai.dev".locations."/".proxyPass = - "http://${config.services.vaultwarden.config.ROCKET_ADDRESS}:${toString config.services.vaultwarden.config.ROCKET_PORT}/"; - }; -} diff --git a/aspects/hosts/_io/boot.nix b/aspects/hosts/_io/boot.nix deleted file mode 100644 index 326f7dc..0000000 --- a/aspects/hosts/_io/boot.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - boot = { - # TODO check if future kernel versions fix boot issue with systemd initrd with tpm - initrd.systemd.tpm2.enable = false; - kernelParams = [ - "nosgx" - "i915.fastboot=1" - "mem_sleep_default=deep" - ]; - extraModprobeConfig = '' - options snd-intel-dspcfg dsp_driver=3 - ''; - }; -} diff --git a/aspects/hosts/_io/disko.nix b/aspects/hosts/_io/disko.nix deleted file mode 100644 index 4e6c9d5..0000000 --- a/aspects/hosts/_io/disko.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ inputs.disko.nixosModules.default ]; - - disko.devices.disk.main = { - type = "disk"; - device = "/dev/disk/by-id/mmc-hDEaP3_0x1041b689"; - content = { - type = "gpt"; - partitions = { - ESP = { - priority = 1; - name = "ESP"; - start = "1MiB"; - end = "1GiB"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot/efi"; - mountOptions = [ - "noatime" - "fmask=0077" - "dmask=0077" - ]; - }; - }; - cryptroot = { - priority = 2; - name = "root"; - size = "100%"; - content = { - type = "luks"; - name = "cryptroot"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "@root" = { - mountpoint = "/"; - mountOptions = [ - "noatime" - "compress=zstd" - "subvol=@root" - ]; - }; - "@home" = { - mountpoint = "/home"; - mountOptions = [ - "noatime" - "compress=zstd" - "subvol=@home" - ]; - }; - "@nix" = { - mountpoint = "/nix"; - mountOptions = [ - "noatime" - "compress=zstd" - "subvol=@nix" - ]; - }; - "@persistent" = { - mountpoint = "/persistent"; - mountOptions = [ - "noatime" - "compress=zstd" - "subvol=@persistent" - ]; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/aspects/hosts/_io/hardware-configuration.nix b/aspects/hosts/_io/hardware-configuration.nix deleted file mode 100644 index 8e4dae4..0000000 --- a/aspects/hosts/_io/hardware-configuration.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - config, - lib, - modulesPath, - inputs, - ... -}: - -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot = { - initrd = { - availableKernelModules = [ - "xhci_pci" - "ahci" - "usb_storage" - "sd_mod" - "sdhci_pci" - ]; - }; - kernelModules = [ "kvm-intel" ]; - }; - - zramSwap = { - enable = true; - memoryPercent = 100; - }; - - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/aspects/hosts/_io/programs.nix b/aspects/hosts/_io/programs.nix deleted file mode 100644 index e272d22..0000000 --- a/aspects/hosts/_io/programs.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs, ... }: - -let - cml-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs { - wttsrc = pkgs.fetchFromGitHub { - owner = "WeirdTreeThing"; - repo = "chromebook-ucm-conf"; - rev = "b6ce2a7"; - hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc="; - }; - postInstall = '' - echo "v0.4.1" > $out/chromebook.patched - cp -R $wttsrc/{common,codecs,platforms} $out/share/alsa/ucm2 - cp -R $wttsrc/{cml,sof-rt5682} $out/share/alsa/ucm2/conf.d - ''; - }; -in - -{ - environment = { - systemPackages = with pkgs; [ - maliit-keyboard - sof-firmware - ]; - sessionVariables.ALSA_CONFIG_UCM2 = "${cml-ucm-conf}/share/alsa/ucm2"; - }; -} diff --git a/aspects/hosts/_rotterdam/boot.nix b/aspects/hosts/_rotterdam/boot.nix deleted file mode 100644 index d038ede..0000000 --- a/aspects/hosts/_rotterdam/boot.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ pkgs, ... }: - -let - qubesnsh = pkgs.writeTextFile { - name = "qubes.nsh"; - text = "HD1f65535a1:EFI\\qubes\\grubx64.efi"; - }; -in - -{ - boot = { - kernelParams = [ - "processor.max_cstate=1" # Fixes bug where ryzen cpus freeze when in highest C state - "clearcpuid=514" - "amdgpu.ppfeaturemask=0xfffd3fff" # Fixes amdgpu freezing - ]; - # QubesOS boot entry - loader.systemd-boot = { - extraFiles = { - "efi/edk2-shell/shell.efi" = "${pkgs.edk2-uefi-shell}/shell.efi"; - "qubes.nsh" = qubesnsh; - }; - extraEntries."qubes.conf" = '' - title Qubes OS - efi /efi/edk2-shell/shell.efi - options -nointerrupt qubes.nsh - sort-key ab - ''; - }; - }; -} diff --git a/aspects/hosts/_rotterdam/hardware.nix b/aspects/hosts/_rotterdam/hardware.nix deleted file mode 100644 index 6f76e99..0000000 --- a/aspects/hosts/_rotterdam/hardware.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: - -{ - hardware = { - amdgpu.opencl.enable = true; - graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ]; - }; -} diff --git a/aspects/hosts/_rotterdam/programs.nix b/aspects/hosts/_rotterdam/programs.nix deleted file mode 100644 index b4dcfd9..0000000 --- a/aspects/hosts/_rotterdam/programs.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ pkgs, ... }: - -let - reboot-into-qubes = pkgs.makeDesktopItem { - name = "reboot-into-qubes"; - icon = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/vinceliuice/Qogir-icon-theme/31f267e1f5fd4e9596bfd78dfb41a03d3a9f33ee/src/scalable/apps/distributor-logo-qubes.svg"; - sha256 = "sha256-QbHr7s5Wcs7uFtfqZctMyS0iDbMfiiZOKy2nHhDOfn0="; - }; - desktopName = "Qubes OS"; - genericName = "Reboot into Qubes OS"; - categories = [ "System" ]; - startupNotify = true; - exec = pkgs.writeShellScript "reboot-into-qubes" '' - ${pkgs.yad}/bin/yad --form \ - --title="Qubes OS" \ - --image distributor-logo-qubes \ - --text "Are you sure you want to reboot into Qubes OS?" \ - --button="Yes:0" --button="Cancel:1" - if [ $? -eq 0 ]; then - systemctl reboot --boot-loader-entry=qubes.conf - fi - ''; - }; -in - -{ - environment.systemPackages = [ reboot-into-qubes ]; - - programs.steam.dedicatedServer.openFirewall = true; -} diff --git a/aspects/hosts/_rotterdam/services.nix b/aspects/hosts/_rotterdam/services.nix deleted file mode 100644 index 0bf276f..0000000 --- a/aspects/hosts/_rotterdam/services.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - services.keyd = { - enable = true; - keyboards.main = { - ids = [ "5653:0001" ]; - settings.main = { - esc = "overload(meta, esc)"; - }; - }; - }; -} diff --git a/aspects/hosts/_trantor/boot.nix b/aspects/hosts/_trantor/boot.nix deleted file mode 100644 index 0498818..0000000 --- a/aspects/hosts/_trantor/boot.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - boot = { - initrd.systemd.enable = true; - loader.efi.efiSysMountPoint = "/boot/efi"; - }; -} diff --git a/aspects/hosts/_trantor/disko.nix b/aspects/hosts/_trantor/disko.nix deleted file mode 100644 index 0e47058..0000000 --- a/aspects/hosts/_trantor/disko.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ inputs.disko.nixosModules.default ]; - - disko.devices.disk.main = { - type = "disk"; - device = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20"; - content = { - type = "gpt"; - partitions = { - ESP = { - priority = 1; - name = "ESP"; - start = "1MiB"; - end = "512MiB"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot/efi"; - mountOptions = [ - "noatime" - "fmask=0077" - "dmask=0077" - ]; - }; - }; - root = { - priority = 2; - name = "root"; - size = "100%"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "@root" = { - mountpoint = "/"; - mountOptions = [ - "noatime" - "compress=zstd" - ]; - }; - "@nix" = { - mountpoint = "/nix"; - mountOptions = [ - "noatime" - "compress=zstd" - ]; - }; - "@persistent" = { - mountpoint = "/persistent"; - mountOptions = [ - "noatime" - "compress=zstd" - ]; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/aspects/hosts/_trantor/fail2ban.nix b/aspects/hosts/_trantor/fail2ban.nix deleted file mode 100644 index bc05139..0000000 --- a/aspects/hosts/_trantor/fail2ban.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.fail2ban = { - enable = true; - maxretry = 5; - ignoreIP = [ - "127.0.0.0/8" - "::1" - "10.0.0.0/8" - "172.16.0.0/12" - "192.168.0.0/16" - "100.64.0.0/10" - ]; - bantime = "1h"; - bantime-increment = { - enable = true; - multipliers = "1 2 4 8 16 32 64"; - maxtime = "10000h"; - overalljails = true; - }; - }; -} diff --git a/aspects/hosts/_trantor/forgejo.nix b/aspects/hosts/_trantor/forgejo.nix deleted file mode 100644 index 6d702e2..0000000 --- a/aspects/hosts/_trantor/forgejo.nix +++ /dev/null @@ -1,76 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: - -let - mkNginxVHosts = inputs.self.lib.mkNginxVHosts; -in - -{ - services = { - forgejo = { - enable = true; - settings = { - session.COOKIE_SECURE = true; - server = { - PROTOCOL = "http+unix"; - DOMAIN = "git.baduhai.dev"; - ROOT_URL = "https://git.baduhai.dev"; - OFFLINE_MODE = true; # disable use of CDNs - SSH_DOMAIN = "git.baduhai.dev"; - SSH_USER = "forgejo"; - SSH_PORT = lib.head config.services.openssh.ports; - }; - log.LEVEL = "Warn"; - mailer.ENABLED = false; - actions.ENABLED = false; - service.DISABLE_REGISTRATION = true; - oauth2_client = { - ENABLE_AUTO_REGISTRATION = true; - UPDATE_AVATAR = true; - ACCOUNT_LINKING = "login"; - USERNAME = "preferred_username"; - }; - }; - }; - nginx.virtualHosts = mkNginxVHosts { - domains."git.baduhai.dev".locations."/".proxyPass = - "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}:/"; - }; - fail2ban.jails.forgejo = { - settings = { - enabled = true; - filter = "forgejo"; - maxretry = 3; - findtime = "10m"; - bantime = "1h"; - }; - }; - }; - - environment = { - etc."fail2ban/filter.d/forgejo.conf".text = '' - [Definition] - failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from - ignoreregex = - journalmatch = _SYSTEMD_UNIT=forgejo.service - ''; - - persistence.main.directories = [ - { - directory = config.services.forgejo.stateDir; - inherit (config.services.forgejo) user group; - mode = "0700"; - } - ]; - }; - - # Disable PrivateMounts to allow LoadCredential to work with bind-mounted directories - systemd.services.forgejo.serviceConfig = { - PrivateMounts = lib.mkForce false; - ProtectSystem = lib.mkForce false; - }; -} diff --git a/aspects/hosts/_trantor/hardware-configuration.nix b/aspects/hosts/_trantor/hardware-configuration.nix deleted file mode 100644 index 039129e..0000000 --- a/aspects/hosts/_trantor/hardware-configuration.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - lib, - modulesPath, - ... -}: - -{ - imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - - boot.initrd.availableKernelModules = [ - "xhci_pci" - "virtio_pci" - "virtio_scsi" - "usbhid" - ]; - - networking.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; -} diff --git a/aspects/hosts/_trantor/networking.nix b/aspects/hosts/_trantor/networking.nix deleted file mode 100644 index 4dcbe1e..0000000 --- a/aspects/hosts/_trantor/networking.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - networking = { - firewall = { - allowedTCPPorts = [ 25566 ]; - allowedUDPPorts = [ 25566 ]; - }; - }; -} diff --git a/aspects/hosts/_trantor/nginx.nix b/aspects/hosts/_trantor/nginx.nix deleted file mode 100644 index 24f96c3..0000000 --- a/aspects/hosts/_trantor/nginx.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: - -let - services = inputs.self.services; - - localDomains = lib.unique (map (s: s.domain) (lib.filter (s: s.host == "trantor") services)); - - acmeCerts = lib.genAttrs localDomains (domain: { - group = "nginx"; - }); -in - -{ - security.acme = { - acceptTerms = true; - defaults = { - email = "baduhai@proton.me"; - dnsResolver = "1.1.1.1:53"; - dnsProvider = "cloudflare"; - credentialsFile = config.age.secrets.cloudflare.path; - }; - certs = acmeCerts; - }; - - services.nginx = { - enable = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts = { - "_" = { - default = true; - locations."/".return = "444"; - }; - }; - }; - - users.users.nginx.extraGroups = [ "acme" ]; - - networking.firewall.allowedTCPPorts = [ - 80 - 443 - ]; - - age.secrets.cloudflare = { - file = "${inputs.self}/secrets/cloudflare.age"; - owner = "nginx"; - group = "nginx"; - }; -} diff --git a/aspects/hosts/_trantor/openssh.nix b/aspects/hosts/_trantor/openssh.nix deleted file mode 100644 index 704b3df..0000000 --- a/aspects/hosts/_trantor/openssh.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -{ - services = { - openssh = { - settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - }; - }; - fail2ban.jails.sshd = { - settings = { - enabled = true; - port = "ssh"; - filter = "sshd"; - logpath = "/var/log/auth.log"; - maxretry = 3; - findtime = "10m"; - bantime = "1h"; - }; - }; - }; -} diff --git a/aspects/hosts/_trantor/unbound.nix b/aspects/hosts/_trantor/unbound.nix deleted file mode 100644 index 9f84228..0000000 --- a/aspects/hosts/_trantor/unbound.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ inputs, lib, ... }: - -let - services = inputs.self.services; -in - -{ - services.unbound = { - enable = true; - enableRootTrustAnchor = true; - settings = { - server = { - interface = [ - "0.0.0.0" - "::" - ]; - access-control = [ - "127.0.0.0/8 allow" - "100.64.0.0/10 allow" # Tailscale CGNAT range - "::1/128 allow" - "fd7a:115c:a1e0::/48 allow" # Tailscale IPv6 - ]; - - num-threads = 2; - msg-cache-size = "50m"; - rrset-cache-size = "100m"; - cache-min-ttl = 300; - cache-max-ttl = 86400; - prefetch = true; - prefetch-key = true; - hide-identity = true; - hide-version = true; - so-rcvbuf = "1m"; - so-sndbuf = "1m"; - - # Tailnet DNS records from shared services - local-zone = ''"baduhai.dev." transparent''; - local-data = map (e: ''"${e.domain}. IN A ${e.tailscaleIP}"'') services; - }; - - forward-zone = [ - { - name = "."; - forward-addr = [ - "1.1.1.1@853#cloudflare-dns.com" - "1.0.0.1@853#cloudflare-dns.com" - ]; - forward-tls-upstream = true; - } - ]; - }; - }; - - networking.firewall = { - allowedTCPPorts = [ 53 ]; - allowedUDPPorts = [ 53 ]; - }; -} diff --git a/aspects/hosts/alexandria.nix b/aspects/hosts/alexandria.nix deleted file mode 100644 index be5027e..0000000 --- a/aspects/hosts/alexandria.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ inputs, ... }: - -let - mkHost = inputs.self.lib.mkHost; -in - -{ - flake.nixosConfigurations.alexandria = mkHost { - hostname = "alexandria"; - nixpkgs = inputs.nixpkgs-stable; - extraModules = with inputs.self.modules.nixos; [ - # base aspects - server - # other aspects - fwupd - libvirtd - ]; - }; -} diff --git a/aspects/hosts/io.nix b/aspects/hosts/io.nix deleted file mode 100644 index cf5ecec..0000000 --- a/aspects/hosts/io.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ inputs, ... }: - -let - mkHost = inputs.self.lib.mkHost; -in - -{ - flake.nixosConfigurations.io = mkHost { - hostname = "io"; - ephemeralRootDev = "/dev/mapper/cryptroot"; - extraModules = with inputs.self.modules.nixos; [ - # base aspects - desktop - # other aspects - ai - bluetooth - dev - libvirtd - networkmanager - niri - podman - ]; - }; -} diff --git a/aspects/hosts/rotterdam.nix b/aspects/hosts/rotterdam.nix deleted file mode 100644 index f3b6fca..0000000 --- a/aspects/hosts/rotterdam.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ inputs, ... }: - -let - mkHost = inputs.self.lib.mkHost; -in - -{ - flake.nixosConfigurations.rotterdam = mkHost { - hostname = "rotterdam"; - ephemeralRootDev = "/dev/mapper/cryptroot"; - extraModules = with inputs.self.modules.nixos; [ - # base aspects - desktop - gaming - # other aspects - ai - bluetooth - dev - fwupd - libvirtd - networkmanager - niri - podman - ]; - }; -} diff --git a/aspects/hosts/trantor.nix b/aspects/hosts/trantor.nix deleted file mode 100644 index 14f9dd7..0000000 --- a/aspects/hosts/trantor.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ inputs, ... }: - -let - mkHost = inputs.self.lib.mkHost; -in - -{ - flake.nixosConfigurations.trantor = mkHost { - hostname = "trantor"; - system = "aarch64-linux"; - nixpkgs = inputs.nixpkgs-stable; - ephemeralRootDev = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20-part2"; - extraModules = with inputs.self.modules.nixos; [ - # base aspects - server - ]; - }; -} diff --git a/aspects/libvirtd.nix b/aspects/libvirtd.nix deleted file mode 100644 index 360743d..0000000 --- a/aspects/libvirtd.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.libvirtd = - { - config, - lib, - pkgs, - ... - }: - { - virtualisation = { - libvirtd.enable = true; - spiceUSBRedirection.enable = true; - }; - - programs.virt-manager.enable = true; - - environment.systemPackages = with pkgs; [ lima ]; - - networking.firewall.trustedInterfaces = [ "virbr0" ]; - - users.users.user.extraGroups = [ - "libvirt" - "libvirtd" - ]; - }; -} diff --git a/aspects/lxc.nix b/aspects/lxc.nix deleted file mode 100644 index 4225e0c..0000000 --- a/aspects/lxc.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.lxc = - { - config, - lib, - pkgs, - ... - }: - { - virtualisation = { - lxc = { - enable = true; - unprivilegedContainers = true; - }; - incus.enable = true; - }; - - users.users.user.extraGroups = [ "incus-admin" ]; - }; -} diff --git a/aspects/networkmanager.nix b/aspects/networkmanager.nix deleted file mode 100644 index 8bcb1f2..0000000 --- a/aspects/networkmanager.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.networkmanager = - { - config, - lib, - pkgs, - ... - }: - { - networking.networkmanager = { - enable = true; - wifi.backend = "iwd"; - }; - - users.users.user.extraGroups = [ "networkmanager" ]; - }; -} diff --git a/aspects/podman.nix b/aspects/podman.nix deleted file mode 100644 index 6afa327..0000000 --- a/aspects/podman.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.podman = - { - config, - lib, - pkgs, - ... - }: - { - virtualisation.podman = { - enable = true; - autoPrune.enable = true; - extraPackages = [ pkgs.podman-compose ]; - }; - - security.unprivilegedUsernsClone = true; # Needed for rootless podman - - systemd = { - services.podman-auto-update.enable = true; - timers.podman-auto-update.enable = true; - }; - }; -} diff --git a/aspects/stylix.nix b/aspects/stylix.nix deleted file mode 100644 index f7eb9fa..0000000 --- a/aspects/stylix.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ ... }: - -{ - flake.modules = { - nixos.stylix = - { inputs, ... }: - { - imports = [ inputs.stylix.nixosModules.stylix ]; - }; - - homeManager.stylix = - { - config, - inputs, - pkgs, - ... - }: - { - imports = [ inputs.stylix.homeModules.stylix ]; - - stylix = { - enable = true; - polarity = "dark"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/tokyodark.yaml"; - cursor = { - package = pkgs.kdePackages.breeze; - name = "breeze_cursors"; - size = 24; - }; - icons = { - enable = true; - package = pkgs.morewaita-icon-theme; - light = "MoreWaita"; - dark = "MoreWaita"; - }; - opacity = { - applications = 1.0; - desktop = 1.0; - popups = config.stylix.opacity.desktop; - terminal = 1.0; - }; - fonts = { - serif = { - package = pkgs.source-serif; - name = "Source Serif 4 Display"; - }; - sansSerif = { - package = pkgs.inter; - name = "Inter"; - }; - monospace = { - package = pkgs.nerd-fonts.fira-code; - name = "FiraCode Nerd Font"; - }; - emoji = { - package = pkgs.noto-fonts-color-emoji; - name = "Noto Color Emoji"; - }; - sizes = { - applications = 10; - desktop = config.stylix.fonts.sizes.applications; - popups = config.stylix.fonts.sizes.applications; - terminal = 12; - }; - }; - }; - }; - }; -} diff --git a/aspects/systems/base.nix b/aspects/systems/base.nix deleted file mode 100644 index fdfc525..0000000 --- a/aspects/systems/base.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ inputs, ... }: -{ - flake.modules = { - nixos.base = - { lib, pkgs, ... }: - { - imports = with inputs.self.modules.nixos; [ - boot - console - firewall - fish - locale - nix - security - ssh - ]; - environment = { - systemPackages = with pkgs; [ - git - fastfetch - nixos-firewall-tool - sysz - wget - yazi - ]; - shellAliases = { - cat = "${lib.getExe pkgs.bat} --paging=never --style=plain"; - ls = "${lib.getExe pkgs.eza} --git --icons --group-directories-first"; - tree = "ls --tree"; - }; - }; - - programs.command-not-found.enable = false; - - services = { - dbus.implementation = "broker"; - irqbalance.enable = true; - fstrim.enable = true; - tailscale = { - enable = true; - extraUpFlags = [ "--operator=user" ]; - }; - }; - }; - - homeManager.base = - { ... }: - { - imports = with inputs.self.modules.homeManager; [ - bash - fish - ]; - }; - }; -} diff --git a/aspects/systems/cli.nix b/aspects/systems/cli.nix deleted file mode 100644 index 2b95f0e..0000000 --- a/aspects/systems/cli.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ inputs, ... }: - -{ - flake.modules = { - nixos.cli = - { pkgs, ... }: - { - imports = with inputs.self.modules.nixos; [ - btop - helix - tmux - ]; - - environment.systemPackages = with pkgs; [ - p7zip - rclone - ]; - }; - homeManager.cli = - { ... }: - { - imports = with inputs.self.modules.homeManager; [ - btop - comma - direnv - helix - hm-cli - starship - tmux - ]; - }; - }; -} diff --git a/aspects/systems/desktop.nix b/aspects/systems/desktop.nix deleted file mode 100644 index fb3aa1b..0000000 --- a/aspects/systems/desktop.nix +++ /dev/null @@ -1,210 +0,0 @@ -{ - inputs, - ... -}: -{ - flake.modules = { - nixos.desktop = - { - config, - lib, - pkgs, - ... - }: - { - imports = [ - inputs.nix-flatpak.nixosModules.nix-flatpak - ] - ++ (with inputs.self.modules.nixos; [ - graphics - media - office - web - ]); - - boot = { - plymouth.enable = true; - initrd.systemd.enable = true; - loader.efi.efiSysMountPoint = "/boot/efi"; - kernelPackages = pkgs.linuxPackages_xanmod_latest; - extraModprobeConfig = '' - options bluetooth disable_ertm=1 - ''; - kernel.sysctl = { - "net.ipv4.tcp_mtu_probing" = 1; - }; - kernelParams = [ - "quiet" - "splash" - "i2c-dev" - "i2c-piix4" - "loglevel=3" - "udev.log_priority=3" - "rd.udev.log_level=3" - "rd.systemd.show_status=false" - ]; - }; - - nix = { - registry.nixpkgs.flake = inputs.nixpkgs; - nixPath = [ - "nixpkgs=${inputs.nixpkgs}" - "/nix/var/nix/profiles/per-user/root/channels" - ]; - }; - - environment = { - etc."channels/nixpkgs".source = inputs.nixpkgs.outPath; - sessionVariables = { - KDEHOME = "$XDG_CONFIG_HOME/kde4"; # Stops kde from placing a .kde4 folder in the home dir - NIXOS_OZONE_WL = "1"; # Forces chromium and most electron apps to run in wayland - }; - systemPackages = with pkgs; [ - adwaita-icon-theme - ghostty - gnome-disk-utility - junction - libfido2 - mission-center - nautilus - toggleaudiosink - unrar - ]; - }; - - services = { - printing.enable = true; - udev.packages = with pkgs; [ yubikey-personalization ]; - keyd = { - enable = true; - keyboards.all = { - ids = [ "*" ]; - settings.main.capslock = "overload(meta, esc)"; - }; - }; - pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - wireplumber.enable = true; - }; - greetd = { - enable = true; - settings.default_session.user = "greeter"; - }; - flatpak = { - enable = true; - packages = [ - "com.github.tchx84.Flatseal" - "com.rustdesk.RustDesk" - ]; - uninstallUnmanaged = true; - update.auto.enable = true; - }; - gvfs.enable = true; - }; - - security.rtkit.enable = true; # Needed for pipewire to acquire realtime priority - - users = { - users.greeter = { - isSystemUser = true; - group = "greeter"; - }; - groups.greeter = { }; - }; - - programs = { - kdeconnect = { - enable = true; - package = pkgs.valent; - }; - dconf.enable = true; - appimage = { - enable = true; - binfmt = true; - }; - }; - - fonts = { - fontDir.enable = true; - packages = with pkgs; [ - corefonts - inter - nerd-fonts.fira-code - noto-fonts-cjk-sans - noto-fonts-color-emoji - roboto - ]; - }; - - xdg.portal = { - extraPortals = with pkgs; [ - xdg-desktop-portal-gnome - xdg-desktop-portal-gtk - ]; - config.common.default = "*"; - }; - }; - - homeManager.desktop = - { - config, - lib, - pkgs, - inputs, - ... - }: - { - imports = [ - inputs.vicinae.homeManagerModules.default - ] - ++ (with inputs.self.modules.homeManager; [ media ]); - - fonts.fontconfig.enable = true; - - home = { - packages = with pkgs; [ xwayland-satellite ]; - sessionVariables.TERMINAL = "ghostty"; - }; - - services.vicinae = { - enable = true; - systemd = { - enable = true; - autoStart = true; - }; - }; - - programs = { - ghostty = { - enable = true; - settings = { - cursor-style = "block"; - shell-integration-features = "no-cursor"; - cursor-style-blink = false; - custom-shader = "${builtins.fetchurl { - url = "https://raw.githubusercontent.com/hackr-sh/ghostty-shaders/cb6eb4b0d1a3101c869c62e458b25a826f9dcde3/cursor_blaze.glsl"; - sha256 = "sha256:0g2lgqjdrn3c51glry7x2z30y7ml0y61arl5ykmf4yj0p85s5f41"; - }}"; - bell-features = ""; - gtk-titlebar-style = "tabs"; - keybind = [ "shift+enter=text:\\x1b\\r" ]; - }; - }; - - password-store = { - enable = true; - package = pkgs.pass-wayland; - }; - }; - - xdg = { - enable = true; - userDirs.enable = true; - }; - }; - }; -} diff --git a/aspects/systems/gaming.nix b/aspects/systems/gaming.nix deleted file mode 100644 index e73a6fe..0000000 --- a/aspects/systems/gaming.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ inputs, ... }: - -{ - flake.modules = { - nixos.gaming = - { pkgs, ... }: - { - imports = with inputs.self.modules.nixos; [ - mangohud - steam - ]; - hardware = { - xpadneo.enable = true; - steam-hardware.enable = true; # Allow steam client to manage controllers - graphics.enable32Bit = true; # For OpenGL games - }; - - services.flatpak.packages = [ - "com.github.k4zmu2a.spacecadetpinball" - "io.itch.itch" - "io.mrarm.mcpelauncher" - "net.retrodeck.retrodeck" - "org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/25.08" - rec { - appId = "com.hypixel.HytaleLauncher"; - sha256 = "01307s44bklc1ldcigcn9n4lm8hf8q793v9fv7w4w04xd5zyh4rv"; - bundle = "${pkgs.fetchurl { - url = "https://launcher.hytale.com/builds/release/linux/amd64/hytale-launcher-latest.flatpak"; - inherit sha256; - }}"; - } - ]; - - environment.systemPackages = with pkgs; [ - clonehero - heroic - prismlauncher - ]; - }; - homeManager.gaming = - { ... }: - { - imports = with inputs.self.modules.homeManager; [ - mangohud - ]; - }; - }; -} diff --git a/aspects/systems/server.nix b/aspects/systems/server.nix deleted file mode 100644 index c3c24f0..0000000 --- a/aspects/systems/server.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ inputs, ... }: - -{ - flake.modules.nixos.server = - { - config, - lib, - pkgs, - ... - }: - { - boot = { - kernelPackages = pkgs.linuxPackages_hardened; - kernel.sysctl = { - "net.ipv4.ip_forward" = 1; - "net.ipv6.conf.all.forwarding" = 1; - }; - }; - - environment.etc."channels/nixpkgs".source = inputs.nixpkgs-stable.outPath; - - nix = { - registry.nixpkgs.flake = inputs.nixpkgs-stable; - nixPath = [ - "nixpkgs=/etc/channels/nixpkgs" - "/nix/var/nix/profiles/per-user/root/channels" - ]; - }; - - services.tailscale = { - extraSetFlags = [ "--advertise-exit-node" ]; - useRoutingFeatures = "server"; - }; - - }; -} diff --git a/aspects/users/_user/git.nix b/aspects/users/_user/git.nix deleted file mode 100644 index 40a5714..0000000 --- a/aspects/users/_user/git.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: - -{ - programs = { - git = { - enable = true; - settings.user = { - name = "William"; - email = "baduhai@proton.me"; - }; - }; - diff-so-fancy = { - enable = true; - enableGitIntegration = true; - }; - }; -} diff --git a/aspects/users/root.nix b/aspects/users/root.nix deleted file mode 100644 index ff04c56..0000000 --- a/aspects/users/root.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: - -{ - flake.modules.nixos.root = - { pkgs, ... }: - { - users.users.root = { - shell = pkgs.fish; - hashedPassword = "!"; - }; - }; -} diff --git a/aspects/users/user.nix b/aspects/users/user.nix deleted file mode 100644 index 86bcddb..0000000 --- a/aspects/users/user.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ inputs, ... }: - -let - mkHomeConfiguration = inputs.self.lib.mkHomeConfiguration; -in - -{ - flake = { - modules.nixos.user = - { pkgs, ... }: - { - users.users.user = { - isNormalUser = true; - shell = pkgs.fish; - extraGroups = [ - "networkmanager" - "wheel" - ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQPkAyy+Du9Omc2WtnUF2TV8jFAF4H6mJi2D4IZ1nzg user@himalia" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO3Y0PVpGfJHonqDS7qoCFhqzUvqGq9I9sax+F9e/5cs user@io" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL user@rotterdam" - ]; - hashedPassword = "$6$Pj7v/CpstyuWQQV0$cNujVDhfMBdwlGVEnnd8t71.kZPixbo0u25cd.874iaqLTH4V5fa1f98V5zGapjQCz5JyZmsR94xi00sUrntT0"; - }; - }; - homeConfigurations = { - "user@rotterdam" = mkHomeConfiguration { - user = "user"; - hostname = "rotterdam"; - userModules = with inputs.self.modules.homeManager; [ - # system aspects - desktop - gaming - - # other aspects - stylix - niri - ]; - }; - "user@io" = mkHomeConfiguration { - user = "user"; - hostname = "io"; - userModules = with inputs.self.modules.homeManager; [ - # system aspects - desktop - - # other aspects - stylix - niri - ]; - }; - }; - }; -} diff --git a/data/services.nix b/data/services.nix deleted file mode 100644 index ae7395c..0000000 --- a/data/services.nix +++ /dev/null @@ -1,42 +0,0 @@ -# Shared service and host definitions -# This file can be imported directly (unlike aspects which use flake-parts) -{ - hosts = { - alexandria = { - lanIP = "192.168.15.142"; - tailscaleIP = "100.76.19.50"; - }; - trantor = { - tailscaleIP = "100.108.5.90"; - }; - }; - - services = [ - { - name = "kanidm"; - domain = "auth.baduhai.dev"; - host = "alexandria"; - } - { - name = "vaultwarden"; - domain = "pass.baduhai.dev"; - host = "alexandria"; - } - { - name = "forgejo"; - domain = "git.baduhai.dev"; - host = "trantor"; - public = true; - } - { - name = "nextcloud"; - domain = "cloud.baduhai.dev"; - host = "alexandria"; - } - { - name = "jellyfin"; - domain = "jellyfin.baduhai.dev"; - host = "alexandria"; - } - ]; -} diff --git a/flake.lock b/flake.lock index a99cac7..e60ffe3 100644 --- a/flake.lock +++ b/flake.lock @@ -5,16 +5,16 @@ "darwin": "darwin", "home-manager": "home-manager", "nixpkgs": [ - "nixpkgs-stable" + "nixpkgs" ], "systems": "systems" }, "locked": { - "lastModified": 1770165109, - "narHash": "sha256-9VnK6Oqai65puVJ4WYtCTvlJeXxMzAp/69HhQuTdl/I=", + "lastModified": 1736955230, + "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", "owner": "ryantm", "repo": "agenix", - "rev": "b027ee29d959fda4b60b57566d64c98a202e0feb", + "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", "type": "github" }, "original": { @@ -28,11 +28,11 @@ "fromYaml": "fromYaml" }, "locked": { - "lastModified": 1755819240, - "narHash": "sha256-qcMhnL7aGAuFuutH4rq9fvAhCpJWVHLcHVZLtPctPlo=", + "lastModified": 1732200724, + "narHash": "sha256-+R1BH5wHhfnycySb7Sy5KbYEaTJZWm1h+LW1OtyhiTs=", "owner": "SenchoPens", "repo": "base16.nix", - "rev": "75ed5e5e3fce37df22e49125181fa37899c3ccd6", + "rev": "153d52373b0fb2d343592871009a286ec8837aec", "type": "github" }, "original": { @@ -44,28 +44,27 @@ "base16-fish": { "flake": false, "locked": { - "lastModified": 1765809053, - "narHash": "sha256-XCUQLoLfBJ8saWms2HCIj4NEN+xNsWBlU1NrEPcQG4s=", + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", "owner": "tomyun", "repo": "base16-fish", - "rev": "86cbea4dca62e08fb7fd83a70e96472f92574782", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", "type": "github" }, "original": { "owner": "tomyun", "repo": "base16-fish", - "rev": "86cbea4dca62e08fb7fd83a70e96472f92574782", "type": "github" } }, "base16-helix": { "flake": false, "locked": { - "lastModified": 1760703920, - "narHash": "sha256-m82fGUYns4uHd+ZTdoLX2vlHikzwzdu2s2rYM2bNwzw=", + "lastModified": 1736852337, + "narHash": "sha256-esD42YdgLlEh7koBrSqcT7p2fsMctPAcGl/+2sYJa2o=", "owner": "tinted-theming", "repo": "base16-helix", - "rev": "d646af9b7d14bff08824538164af99d0c521b185", + "rev": "03860521c40b0b9c04818f2218d9cc9efc21e7a5", "type": "github" }, "original": { @@ -91,28 +90,6 @@ "type": "github" } }, - "blueprint": { - "inputs": { - "nixpkgs": [ - "nix-ai-tools", - "nixpkgs" - ], - "systems": "systems_2" - }, - "locked": { - "lastModified": 1771437256, - "narHash": "sha256-bLqwib+rtyBRRVBWhMuBXPCL/OThfokA+j6+uH7jDGU=", - "owner": "numtide", - "repo": "blueprint", - "rev": "06ee7190dc2620ea98af9eb225aa9627b68b0e33", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "blueprint", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -121,11 +98,11 @@ ] }, "locked": { - "lastModified": 1744478979, - "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "43975d782b418ebf4969e9ccba82466728c2851b", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -135,32 +112,36 @@ "type": "github" } }, - "disko": { + "deploy-rs": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" }, "locked": { - "lastModified": 1769524058, - "narHash": "sha256-zygdD6X1PcVNR2PsyK4ptzrVEiAdbMqLos7utrMDEWE=", - "owner": "nix-community", - "repo": "disko", - "rev": "71a3fc97d80881e91710fe721f1158d3b96ae14d", + "lastModified": 1727447169, + "narHash": "sha256-3KyjMPUKHkiWhwR91J1YchF6zb6gvckCAY1jOE+ne0U=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "aa07eb05537d4cd025e2310397a6adcedfe72c76", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "disko", + "owner": "serokell", + "repo": "deploy-rs", "type": "github" } }, "firefox-gnome-theme": { "flake": false, "locked": { - "lastModified": 1764873433, - "narHash": "sha256-1XPewtGMi+9wN9Ispoluxunw/RwozuTRVuuQOmxzt+A=", + "lastModified": 1736899990, + "narHash": "sha256-S79Hqn2EtSxU4kp99t8tRschSifWD4p/51++0xNWUxw=", "owner": "rafaelmardojai", "repo": "firefox-gnome-theme", - "rev": "f7ffd917ac0d253dbd6a3bf3da06888f57c69f92", + "rev": "91ca1f82d717b02ceb03a3f423cbe8082ebbb26d", "type": "github" }, "original": { @@ -172,11 +153,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1767039857, - "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -188,11 +169,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1747046372, - "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -201,81 +182,76 @@ "type": "github" } }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, + "flake-compat_3": { + "flake": false, "locked": { - "lastModified": 1769996383, - "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, - "flake-parts_2": { + "flake-utils": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "systems": "systems_3" }, "locked": { - "lastModified": 1765835352, - "narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "a34fae9c08a15ad73f295041fec82323541400a9", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, - "flake-parts_3": { + "flake-utils_2": { "inputs": { - "nixpkgs-lib": [ + "systems": [ "stylix", - "nixpkgs" + "systems" ] }, "locked": { - "lastModified": 1767609335, - "narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "250481aafeb741edfe23d29195671c19b36b6dca", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, - "flake-parts_4": { + "flake-utils_3": { "inputs": { - "nixpkgs-lib": [ - "terranix", - "nixpkgs" - ] + "systems": "systems_5" }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, @@ -295,23 +271,69 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "stylix", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735882644, + "narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "stylix", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gnome-shell": { "flake": false, "locked": { - "host": "gitlab.gnome.org", - "lastModified": 1767737596, - "narHash": "sha256-eFujfIUQDgWnSJBablOuG+32hCai192yRdrNHTv0a+s=", + "lastModified": 1732369855, + "narHash": "sha256-JhUWbcYPjHO3Xs3x9/Z9RuqXbcp5yhPluGjwsdE2GMg=", "owner": "GNOME", "repo": "gnome-shell", - "rev": "ef02db02bf0ff342734d525b5767814770d85b49", - "type": "gitlab" + "rev": "dadd58f630eeea41d645ee225a63f719390829dc", + "type": "github" }, "original": { - "host": "gitlab.gnome.org", "owner": "GNOME", - "ref": "gnome-49", + "ref": "47.2", "repo": "gnome-shell", - "type": "gitlab" + "type": "github" } }, "home-manager": { @@ -322,11 +344,11 @@ ] }, "locked": { - "lastModified": 1745494811, - "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "owner": "nix-community", "repo": "home-manager", - "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "type": "github" }, "original": { @@ -335,6 +357,27 @@ "type": "github" } }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1736373539, + "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "bd65bc3cde04c16755955630b344bc9e35272c56", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, "home-manager_2": { "inputs": { "nixpkgs": [ @@ -342,11 +385,11 @@ ] }, "locked": { - "lastModified": 1770915843, - "narHash": "sha256-ZwU5wXKNqpOQvjNz6aBp1j5peiBZow1++6pLnk5VAhs=", + "lastModified": 1738448366, + "narHash": "sha256-4ATtQqBlgsGqkHTemta0ydY6f7JBRXz4Hf574NHQpkg=", "owner": "nix-community", "repo": "home-manager", - "rev": "6a1f7101d2c3ee87d485a87880d73b4665c6a4bd", + "rev": "18fa9f323d8adbb0b7b8b98a8488db308210ed93", "type": "github" }, "original": { @@ -359,16 +402,16 @@ "home-manager_3": { "inputs": { "nixpkgs": [ - "impermanence", + "stylix", "nixpkgs" ] }, "locked": { - "lastModified": 1768598210, - "narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=", + "lastModified": 1736785676, + "narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=", "owner": "nix-community", "repo": "home-manager", - "rev": "c47b2cc64a629f8e075de52e4742de688f930dc6", + "rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d", "type": "github" }, "original": { @@ -380,16 +423,16 @@ "home-manager_4": { "inputs": { "nixpkgs": [ - "zen-browser", + "tritanium-shell", "nixpkgs" ] }, "locked": { - "lastModified": 1769872935, - "narHash": "sha256-07HMIGQ/WJeAQJooA7Kkg1SDKxhAiV6eodvOwTX6WKI=", + "lastModified": 1730837930, + "narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=", "owner": "nix-community", "repo": "home-manager", - "rev": "f4ad5068ee8e89e4a7c2e963e10dd35cd77b37b7", + "rev": "2f607e07f3ac7e53541120536708e824acccfaa8", "type": "github" }, "original": { @@ -398,17 +441,29 @@ "type": "github" } }, + "homepage": { + "flake": false, + "locked": { + "lastModified": 1727121984, + "narHash": "sha256-sbpLXaFeyIBrGbuw58jwxDcMupFqlqmPGO5/QUgI9eg=", + "owner": "AlexW00", + "repo": "StartTreeV2", + "rev": "cfb8b97b14b23b094878867bef94e3c17a144f3f", + "type": "github" + }, + "original": { + "owner": "AlexW00", + "repo": "StartTreeV2", + "type": "github" + } + }, "impermanence": { - "inputs": { - "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_2" - }, "locked": { - "lastModified": 1769548169, - "narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=", + "lastModified": 1737831083, + "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=", "owner": "nix-community", "repo": "impermanence", - "rev": "7b1d382faf603b6d264f58627330f9faa5cba149", + "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170", "type": "github" }, "original": { @@ -417,69 +472,34 @@ "type": "github" } }, - "import-tree": { - "locked": { - "lastModified": 1763762820, - "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", - "owner": "vic", - "repo": "import-tree", - "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", - "type": "github" - }, - "original": { - "owner": "vic", - "repo": "import-tree", - "type": "github" - } - }, - "nix-ai-tools": { - "inputs": { - "blueprint": "blueprint", - "nixpkgs": "nixpkgs_3", - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1771816560, - "narHash": "sha256-q5Wsb1573qDfIPJctG9CBZP0NMniejoB7SmBLZIVAHg=", - "owner": "numtide", - "repo": "llm-agents.nix", - "rev": "db94a329058a1a37b49d3209af85708b3338559a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "llm-agents.nix", - "type": "github" - } - }, "nix-flatpak": { "locked": { - "lastModified": 1768656715, - "narHash": "sha256-Sbh037scxKFm7xL0ahgSCw+X2/5ZKeOwI2clqrYr9j4=", + "lastModified": 1711997201, + "narHash": "sha256-J71xzQlVYsjagA4AsVwRazhBh2rZrPpKvxTgs6UzL7c=", "owner": "gmodena", "repo": "nix-flatpak", - "rev": "123fe29340a5b8671367055b75a6e7c320d6f89a", + "rev": "b76fa31346db7fc958a9898f3c594696ca71c4fd", "type": "github" }, "original": { "owner": "gmodena", - "ref": "main", + "ref": "v0.4.1", "repo": "nix-flatpak", "type": "github" } }, - "nix-index-database": { + "nix-index-db": { "inputs": { "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1770315571, - "narHash": "sha256-hy0gcAgAcxrnSWKGuNO+Ob0x6jQ2xkR6hoaR0qJBHYs=", + "lastModified": 1738466368, + "narHash": "sha256-PZhUjtvQZOH3PO0EYdTpQvcqkgkq1NkP2A6w9SPHYsk=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "2684bb8080a6f2ca5f9d494de5ef875bc1c4ecdb", + "rev": "46a8f5fc9552b776bfc5c5c96ea3bede33f68f52", "type": "github" }, "original": { @@ -488,96 +508,103 @@ "type": "github" } }, - "nixos-cli": { + "nix-minecraft": { "inputs": { - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_4", - "optnix": "optnix" + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1770862985, - "narHash": "sha256-TFRhwVzPg3ly388J3CYYvjrma/dWjsBVpNE437bWeHk=", + "lastModified": 1738547119, + "narHash": "sha256-cc6AfR7W0AavgqA5nHUXRUus4Rr7oPWQNku5nhR4SYs=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "5b93268c80c3300dbec0fbbb2b50f674f84a474a", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, + "nixlib": { + "locked": { + "lastModified": 1736643958, + "narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=", "owner": "nix-community", - "repo": "nixos-cli", - "rev": "9a2e97e8832b211df22c5cb21a55ebf1c3eb2be1", + "repo": "nixpkgs.lib", + "rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181", "type": "github" }, "original": { "owner": "nix-community", - "repo": "nixos-cli", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1737057290, + "narHash": "sha256-3Pe0yKlCc7EOeq1X/aJVDH0CtNL+tIBm49vpepwL1MQ=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "d002ce9b6e7eb467cd1c6bb9aef9c35d191b5453", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1769330179, - "narHash": "sha256-yxgb4AmkVHY5OOBrC79Vv6EVd4QZEotqv+6jcvA212M=", - "owner": "NixOS", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "48698d12cc10555a4f3e3222d9c669b884a49dfe", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1769909678, - "narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "72716169fe93074c333e8d0173151350670b824c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixpkgs-lib_2": { - "locked": { - "lastModified": 1765674936, - "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixpkgs-stable": { "locked": { - "lastModified": 1770770419, - "narHash": "sha256-iKZMkr6Cm9JzWlRYW/VPoL0A9jVKtZYiU4zSrVeetIs=", + "lastModified": 1738435198, + "narHash": "sha256-5+Hmo4nbqw8FrW85FlNm4IIrRnZ7bn0cmXlScNsNRLo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6c5e707c6b5339359a9a9e215c5e66d6d802fd7a", + "rev": "f6687779bf4c396250831aa5a32cbfeb85bb07a3", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-25.11", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1768564909, - "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=", + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "type": "github" }, "original": { @@ -587,201 +614,22 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1771207753, - "narHash": "sha256-b9uG8yN50DRQ6A7JdZBfzq718ryYrlmGgqkRm9OOwCE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d1c15b7d5806069da59e819999d70e1cec0760bf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1767151656, - "narHash": "sha256-ujL2AoYBnJBN262HD95yer7QYUmYp5kFZGYbyCCKxq8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f665af0cdb70ed27e1bd8f9fdfecaf451260fc55", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { - "locked": { - "lastModified": 1759070547, - "narHash": "sha256-JVZl8NaVRYb0+381nl7LvPE+A774/dRpif01FKLrYFQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "647e5c14cbd5067f44ac86b74f014962df460840", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_6": { - "locked": { - "lastModified": 1770562336, - "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "d6c71932130818840fc8fe9509cf50be8c64634f", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { - "locked": { - "lastModified": 1767767207, - "narHash": "sha256-Mj3d3PfwltLmukFal5i3fFt27L6NiKXdBezC1EBuZs4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5912c1772a44e31bf1c63c0390b90501e5026886", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_8": { - "locked": { - "lastModified": 1762111121, - "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_9": { - "locked": { - "lastModified": 1769461804, - "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "noctalia": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1770922006, - "narHash": "sha256-xg40mnp5KKBepACmvlPzmn5iPyUBxktfv50saSVUn0M=", - "owner": "noctalia-dev", - "repo": "noctalia-shell", - "rev": "d87364964948b9d691f8363f85a5e23bee154df9", - "type": "github" - }, - "original": { - "owner": "noctalia-dev", - "repo": "noctalia-shell", - "type": "github" - } - }, - "nur": { - "inputs": { - "flake-parts": [ - "stylix", - "flake-parts" - ], - "nixpkgs": [ - "stylix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1767810917, - "narHash": "sha256-ZKqhk772+v/bujjhla9VABwcvz+hB2IaRyeLT6CFnT0=", - "owner": "nix-community", - "repo": "NUR", - "rev": "dead29c804adc928d3a69dfe7f9f12d0eec1f1a4", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, - "optnix": { - "inputs": { - "flake-compat": "flake-compat_2", - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1765418479, - "narHash": "sha256-33VCCXiEnEL9N2wVxo9FHLwL8KWH6qk+MNRcSThOPWs=", - "owner": "water-sucks", - "repo": "optnix", - "rev": "01facc3de860bf479723bf19535586564e59fe73", - "type": "github" - }, - "original": { - "owner": "water-sucks", - "repo": "optnix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", - "disko": "disko", - "flake-parts": "flake-parts", + "deploy-rs": "deploy-rs", "home-manager": "home-manager_2", + "home-manager-stable": "home-manager-stable", + "homepage": "homepage", "impermanence": "impermanence", - "import-tree": "import-tree", - "nix-ai-tools": "nix-ai-tools", "nix-flatpak": "nix-flatpak", - "nix-index-database": "nix-index-database", - "nixos-cli": "nixos-cli", - "nixpkgs": "nixpkgs_6", + "nix-index-db": "nix-index-db", + "nix-minecraft": "nix-minecraft", + "nixos-generators": "nixos-generators", + "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", - "noctalia": "noctalia", "stylix": "stylix", - "terranix": "terranix", - "vicinae": "vicinae", - "zen-browser": "zen-browser" + "tritanium-shell": "tritanium-shell" } }, "stylix": { @@ -791,23 +639,26 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts_3", + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", + "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", - "nixpkgs": "nixpkgs_7", - "nur": "nur", - "systems": "systems_3", + "home-manager": "home-manager_3", + "nixpkgs": [ + "nixpkgs-stable" + ], + "systems": "systems_4", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", - "tinted-schemes": "tinted-schemes", "tinted-tmux": "tinted-tmux", "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1770914701, - "narHash": "sha256-QHFYyngohNhih4w+3IqQty5DV+p1txsx1kkk6XJWar8=", + "lastModified": 1738278499, + "narHash": "sha256-q1SUyXSQ9znHTME53/vPLe+Ga3V1wW3X3gWfa8JsBUM=", "owner": "danth", "repo": "stylix", - "rev": "db03fed72e5ca02be34e1d24789345a943329738", + "rev": "b00c9f46ae6c27074d24d2db390f0ac5ebcc329f", "type": "github" }, "original": { @@ -878,38 +729,16 @@ }, "systems_5": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "terranix": { - "inputs": { - "flake-parts": "flake-parts_4", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_4" - }, - "locked": { - "lastModified": 1762472226, - "narHash": "sha256-iVS4sxVgGn+T74rGJjEJbzx+kjsuaP3wdQVXBNJ79A0=", - "owner": "terranix", - "repo": "terranix", - "rev": "3b5947a48da5694094b301a3b1ef7b22ec8b19fc", - "type": "github" - }, - "original": { - "owner": "terranix", - "repo": "terranix", + "repo": "default-linux", "type": "github" } }, @@ -933,43 +762,28 @@ "tinted-kitty": { "flake": false, "locked": { - "lastModified": 1735730497, - "narHash": "sha256-4KtB+FiUzIeK/4aHCKce3V9HwRvYaxX+F1edUrfgzb8=", + "lastModified": 1716423189, + "narHash": "sha256-2xF3sH7UIwegn+2gKzMpFi3pk5DlIlM18+vj17Uf82U=", "owner": "tinted-theming", "repo": "tinted-kitty", - "rev": "de6f888497f2c6b2279361bfc790f164bfd0f3fa", + "rev": "eb39e141db14baef052893285df9f266df041ff8", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-kitty", - "type": "github" - } - }, - "tinted-schemes": { - "flake": false, - "locked": { - "lastModified": 1767710407, - "narHash": "sha256-+W1EB79Jl0/gm4JqmO0Nuc5C7hRdp4vfsV/VdzI+des=", - "owner": "tinted-theming", - "repo": "schemes", - "rev": "2800e2b8ac90f678d7e4acebe4fa253f602e05b2", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "schemes", + "rev": "eb39e141db14baef052893285df9f266df041ff8", "type": "github" } }, "tinted-tmux": { "flake": false, "locked": { - "lastModified": 1767489635, - "narHash": "sha256-e6nnFnWXKBCJjCv4QG4bbcouJ6y3yeT70V9MofL32lU=", + "lastModified": 1735737224, + "narHash": "sha256-FO2hRBkZsjlIRqzNHCPc/52yxg11kHGA8MEtSun9RwE=", "owner": "tinted-theming", "repo": "tinted-tmux", - "rev": "3c32729ccae99be44fe8a125d20be06f8d7d8184", + "rev": "aead506a9930c717ebf81cc83a2126e9ca08fa64", "type": "github" }, "original": { @@ -981,11 +795,11 @@ "tinted-zed": { "flake": false, "locked": { - "lastModified": 1767488740, - "narHash": "sha256-wVOj0qyil8m+ouSsVZcNjl5ZR+1GdOOAooAatQXHbuU=", + "lastModified": 1725758778, + "narHash": "sha256-8P1b6mJWyYcu36WRlSVbuj575QWIFZALZMTg5ID/sM4=", "owner": "tinted-theming", "repo": "base16-zed", - "rev": "11abb0b282ad3786a2aae088d3a01c60916f2e40", + "rev": "122c9e5c0e6f27211361a04fae92df97940eccf9", "type": "github" }, "original": { @@ -994,62 +808,41 @@ "type": "github" } }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nix-ai-tools", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1770228511, - "narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "337a4fe074be1042a35086f15481d763b8ddc0e7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "vicinae": { - "inputs": { - "nixpkgs": "nixpkgs_8", - "systems": "systems_5" - }, - "locked": { - "lastModified": 1770912475, - "narHash": "sha256-21lurBRyHgJbVD3E0/i7Fhxi4rBUxyznGfKpdGVtEdc=", - "owner": "vicinaehq", - "repo": "vicinae", - "rev": "0c70267ab7e07d7972012fcf8ae58808a32a2e86", - "type": "github" - }, - "original": { - "owner": "vicinaehq", - "repo": "vicinae", - "type": "github" - } - }, - "zen-browser": { + "tritanium-shell": { "inputs": { + "flake-utils": "flake-utils_3", "home-manager": "home-manager_4", - "nixpkgs": "nixpkgs_9" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1771000521, - "narHash": "sha256-5UDaXr770MaDac9HcFvGlUjsqyOoNbFdHArmjmtHcVk=", - "owner": "0xc000022070", - "repo": "zen-browser-flake", - "rev": "80ce62fd26af1934454f405bcb2510ceeea8d3a2", + "lastModified": 1738888826, + "narHash": "sha256-xjUMyq7fTidbTwVqKEZ16SZSKECNx7mVDFicQswuZh8=", + "owner": "baduhai", + "repo": "tritanium-shell", + "rev": "d788a288ffc49847849d691824c2f46999b9b864", "type": "github" }, "original": { - "owner": "0xc000022070", - "repo": "zen-browser-flake", + "owner": "baduhai", + "repo": "tritanium-shell", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", "type": "github" } } diff --git a/flake.nix b/flake.nix index 2036828..56c9561 100644 --- a/flake.nix +++ b/flake.nix @@ -2,70 +2,191 @@ description = "My nix hosts"; inputs = { - # nix tools - flake-parts.url = "github:hercules-ci/flake-parts"; - import-tree.url = "github:vic/import-tree"; - - # nixos/hm nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.11"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11"; + home-manager = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; }; - - # nixos/hm functionality modules - agenix = { - url = "github:ryantm/agenix"; + home-manager-stable = { + url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs-stable"; }; - disko.url = "github:nix-community/disko"; - impermanence.url = "github:nix-community/impermanence"; - nixos-cli.url = "github:nix-community/nixos-cli"; - nix-flatpak.url = "github:gmodena/nix-flatpak/main"; - stylix.url = "github:danth/stylix"; - # nixos/hm program modules - nix-ai-tools.url = "github:numtide/llm-agents.nix"; - nix-index-database = { + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + deploy-rs = { + url = "github:serokell/deploy-rs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + homepage = { + url = "github:AlexW00/StartTreeV2"; + flake = false; + }; + + impermanence.url = "github:nix-community/impermanence"; + + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; + + nix-index-db = { url = "github:nix-community/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; - noctalia = { - url = "github:noctalia-dev/noctalia-shell"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - vicinae.url = "github:vicinaehq/vicinae"; - zen-browser.url = "github:0xc000022070/zen-browser-flake"; - # stand-alone tools - terranix = { - url = "github:terranix/terranix"; + nix-minecraft = { + url = "github:Infinidoge/nix-minecraft"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nixos-generators = { + url = "github:nix-community/nixos-generators"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + + stylix = { + url = "github:danth/stylix"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + + tritanium-shell.url = "github:baduhai/tritanium-shell"; }; outputs = - inputs@{ flake-parts, import-tree, ... }: - let - aspectsModules = import-tree ./aspects; - packagesModules = import-tree ./packages; - shellsModules = import-tree ./shells; - terranixModules = import-tree ./terranix; - in - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; + inputs@{ + self, + nixpkgs, + nixpkgs-stable, + home-manager, + home-manager-stable, + agenix, + deploy-rs, + homepage, + impermanence, + nix-flatpak, + nix-index-db, + nix-minecraft, + nixos-generators, + stylix, + tritanium-shell, + ... + }: + { + nixosConfigurations = { + rotterdam = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/desktops/rotterdam.nix + agenix.nixosModules.default + home-manager.nixosModules.default + impermanence.nixosModules.impermanence + nix-index-db.nixosModules.nix-index + nix-flatpak.nixosModules.nix-flatpak + stylix.nixosModules.stylix + { + nixpkgs.overlays = [ + agenix.overlays.default + self.overlays.custom + ]; + } + ]; + }; - imports = [ - flake-parts.flakeModules.modules - inputs.terranix.flakeModule - ] - ++ aspectsModules.imports - ++ packagesModules.imports - ++ shellsModules.imports - ++ terranixModules.imports; + io = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/desktops/io.nix + agenix.nixosModules.default + home-manager.nixosModules.default + impermanence.nixosModules.impermanence + nix-index-db.nixosModules.nix-index + nix-flatpak.nixosModules.nix-flatpak + stylix.nixosModules.stylix + { + nixpkgs.overlays = [ + agenix.overlays.default + self.overlays.custom + ]; + } + ]; + }; + + alexandria = nixpkgs-stable.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/servers/alexandria.nix + agenix.nixosModules.default + home-manager-stable.nixosModules.default + self.nixosModules.qbittorrent + ({ + nixpkgs.overlays = [ + agenix.overlays.default + nix-minecraft.overlay + ]; + imports = [ nix-minecraft.nixosModules.minecraft-servers ]; + }) + ]; + }; + }; + + overlays = { + custom = final: prev: { + plasticity = nixpkgs.legacyPackages."x86_64-linux".callPackage ./packages/plasticity.nix { }; + }; + }; + + deploy = { + autoRollback = true; + magicRollback = false; + nodes = { + alexandria = { + hostname = "alexandria"; + profiles = { + system = { + user = "root"; + sshUser = "root"; + remoteBuild = true; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.alexandria; + }; + }; + }; + + io = { + hostname = "io"; + profiles = { + system = { + user = "root"; + sshUser = "root"; + remoteBuild = false; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.io; + }; + }; + }; + }; + }; + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; + + devShells."x86_64-linux".default = nixpkgs.legacyPackages."x86_64-linux".mkShell { + packages = with nixpkgs.legacyPackages."x86_64-linux"; [ + nil + nixfmt-rfc-style + ]; + }; + + nixosModules.qbittorrent = import ./modules/qbittorrent.nix; }; } diff --git a/hosts/common/boot.nix b/hosts/common/boot.nix new file mode 100644 index 0000000..651c90c --- /dev/null +++ b/hosts/common/boot.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + boot = { + loader = { + timeout = 1; + efi.canTouchEfiVariables = true; + systemd-boot = { + enable = true; + editor = false; + consoleMode = "max"; + sortKey = "aa"; + netbootxyz = { + enable = true; + sortKey = "zz"; + }; + }; + }; + }; +} diff --git a/hosts/common/console.nix b/hosts/common/console.nix new file mode 100644 index 0000000..9cb99d4 --- /dev/null +++ b/hosts/common/console.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + console = { + useXkbConfig = true; + earlySetup = true; + }; +} diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..aeb88ef --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = [ + ./boot.nix + ./console.nix + ./locale.nix + ./networking.nix + ./nix.nix + ./packages.nix + ./security.nix + ./services.nix + ./users.nix + ./virtualisation.nix + ./environment.nix + ]; +} diff --git a/hosts/common/environment.nix b/hosts/common/environment.nix new file mode 100644 index 0000000..43d1dee --- /dev/null +++ b/hosts/common/environment.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + environment.shellAliases = { + ls = "${pkgs.eza}/bin/eza --icons --group-directories-first"; + neofetch = "fastfetch"; + tree = "ls --tree"; + syscleanup = "sudo nix-collect-garbage -d; sudo /run/current-system/bin/switch-to-configuration boot"; + }; +} diff --git a/hosts/common/locale.nix b/hosts/common/locale.nix new file mode 100644 index 0000000..7e07d85 --- /dev/null +++ b/hosts/common/locale.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + time.timeZone = "America/Bahia"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "pt_BR.utf8"; + LC_IDENTIFICATION = "pt_BR.utf8"; + LC_MEASUREMENT = "pt_BR.utf8"; + LC_MONETARY = "pt_BR.utf8"; + LC_NAME = "pt_BR.utf8"; + LC_NUMERIC = "pt_BR.utf8"; + LC_PAPER = "pt_BR.utf8"; + LC_TELEPHONE = "pt_BR.utf8"; + LC_TIME = "en_IE.utf8"; + }; + }; +} diff --git a/hosts/common/networking.nix b/hosts/common/networking.nix new file mode 100644 index 0000000..fdb6378 --- /dev/null +++ b/hosts/common/networking.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + networking = { + networkmanager.enable = true; + firewall.enable = true; + }; +} diff --git a/hosts/common/nix.nix b/hosts/common/nix.nix new file mode 100644 index 0000000..4253f7b --- /dev/null +++ b/hosts/common/nix.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + nix = { + settings = { + auto-optimise-store = true; + connect-timeout = 10; + log-lines = 25; + min-free = 128000000; + max-free = 1000000000; + trusted-users = [ "@wheel" ]; + }; + extraOptions = "experimental-features = nix-command flakes"; + gc = { + automatic = true; + options = "--delete-older-than 8d"; + }; + }; + + nixpkgs.config = { + allowUnfree = true; + enableParallelBuilding = true; + buildManPages = false; + buildDocs = false; + }; + + system.stateVersion = "22.11"; +} diff --git a/hosts/common/packages.nix b/hosts/common/packages.nix new file mode 100644 index 0000000..16463b3 --- /dev/null +++ b/hosts/common/packages.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + agenix + bind + btop + fastfetch + git + helix + killall + sysz + tmux + wget + ]; + + programs = { + fish.enable = true; + command-not-found.enable = false; + }; +} diff --git a/hosts/common/security.nix b/hosts/common/security.nix new file mode 100644 index 0000000..33d4953 --- /dev/null +++ b/hosts/common/security.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + security = { + unprivilegedUsernsClone = true; # Needed for rootless podman + sudo = { + wheelNeedsPassword = false; + extraConfig = '' + Defaults lecture = never + ''; + }; + }; +} diff --git a/hosts/common/services.nix b/hosts/common/services.nix new file mode 100644 index 0000000..2cfb61e --- /dev/null +++ b/hosts/common/services.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + services = { + fwupd.enable = true; + fstrim.enable = true; + tailscale = { + enable = true; + extraUpFlags = [ "--operator=user" ]; + }; + openssh.enable = true; + keyd = { + enable = true; + keyboards.all = { + ids = [ "*" ]; + settings.main.capslock = "overload(meta, esc)"; + }; + }; + }; +} diff --git a/hosts/common/users.nix b/hosts/common/users.nix new file mode 100644 index 0000000..41d2253 --- /dev/null +++ b/hosts/common/users.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + users.users = { + user = { + isNormalUser = true; + shell = pkgs.fish; + extraGroups = [ + "networkmanager" + "docker" + "wheel" + ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKcwF1yuWEfYGScNocEbs0AmGxyTIzGc4/IhpU587SJE" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL" + ]; + hashedPassword = "$6$Pj7v/CpstyuWQQV0$cNujVDhfMBdwlGVEnnd8t71.kZPixbo0u25cd.874iaqLTH4V5fa1f98V5zGapjQCz5JyZmsR94xi00sUrntT0"; + }; + root = { + shell = pkgs.fish; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKcwF1yuWEfYGScNocEbs0AmGxyTIzGc4/IhpU587SJE" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL" + ]; + hashedPassword = "!"; + }; + }; +} diff --git a/hosts/common/virtualisation.nix b/hosts/common/virtualisation.nix new file mode 100644 index 0000000..1235555 --- /dev/null +++ b/hosts/common/virtualisation.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + virtualisation.podman = { + enable = true; + dockerCompat = true; + autoPrune.enable = true; + extraPackages = [ pkgs.podman-compose ]; + }; + + systemd = { + services.podman-auto-update.enable = true; + timers.podman-auto-update.enable = true; + }; +} diff --git a/hosts/desktops/common/boot.nix b/hosts/desktops/common/boot.nix new file mode 100644 index 0000000..0ac4847 --- /dev/null +++ b/hosts/desktops/common/boot.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: + +{ + boot = { + plymouth.enable = true; + initrd.systemd.enable = true; + loader.efi.efiSysMountPoint = "/boot/efi"; + kernelPackages = pkgs.linuxPackages_xanmod_latest; + extraModprobeConfig = '' + options bluetooth disable_ertm=1 + ''; + kernel.sysctl = { + "net.ipv4.tcp_mtu_probing" = 1; + }; + kernelParams = [ + "quiet" + "splash" + "i2c-dev" + "i2c-piix4" + "loglevel=3" + "udev.log_priority=3" + "rd.udev.log_level=3" + "rd.systemd.show_status=false" + ]; + }; +} diff --git a/hosts/desktops/common/default.nix b/hosts/desktops/common/default.nix new file mode 100644 index 0000000..bc5dc51 --- /dev/null +++ b/hosts/desktops/common/default.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + imports = [ + ./boot.nix + ./hardware.nix + ./home-manager.nix + ./impermanence.nix + ./nix.nix + ./packages.nix + ./services.nix + ./stylix.nix + ./users.nix + ./virtualisation.nix + ]; +} diff --git a/hosts/desktops/common/hardware.nix b/hosts/desktops/common/hardware.nix new file mode 100644 index 0000000..18cf38f --- /dev/null +++ b/hosts/desktops/common/hardware.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + hardware = { + xpadneo.enable = true; + bluetooth.enable = true; + steam-hardware.enable = true; # Allow steam client to manage controllers + graphics.enable32Bit = true; # For OpenGL games + i2c.enable = true; + }; + + security.rtkit.enable = true; # Needed for pipewire to acquire realtime priority +} diff --git a/hosts/desktops/common/home-manager.nix b/hosts/desktops/common/home-manager.nix new file mode 100644 index 0000000..6046b3a --- /dev/null +++ b/hosts/desktops/common/home-manager.nix @@ -0,0 +1,15 @@ +{ inputs, ... }: + +{ + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "bkp"; + users.user = { + imports = [ + ../../../users/desktops/user.nix + inputs.tritanium-shell.homeManagerModules.default + ]; + }; + }; +} diff --git a/hosts/desktops/common/impermanence.nix b/hosts/desktops/common/impermanence.nix new file mode 100644 index 0000000..d1ceacc --- /dev/null +++ b/hosts/desktops/common/impermanence.nix @@ -0,0 +1,23 @@ +{ ... }: + +{ + environment.persistence.main = { + persistentStoragePath = "/persistent"; + files = [ + "/etc/machine-id" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + ]; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/flatpak" + "/var/lib/tailscale" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + ]; + }; +} diff --git a/hosts/desktops/common/nix.nix b/hosts/desktops/common/nix.nix new file mode 100644 index 0000000..54a3549 --- /dev/null +++ b/hosts/desktops/common/nix.nix @@ -0,0 +1,13 @@ +{ inputs, ... }: + +{ + environment.etc."channels/nixpkgs".source = inputs.nixpkgs.outPath; + + nix = { + registry.nixpkgs.flake = inputs.nixpkgs; + nixPath = [ + "nixpkgs=${inputs.nixpkgs}" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + }; +} diff --git a/hosts/desktops/common/packages.nix b/hosts/desktops/common/packages.nix new file mode 100644 index 0000000..6fb9738 --- /dev/null +++ b/hosts/desktops/common/packages.nix @@ -0,0 +1,139 @@ +{ pkgs, ... }: +let + kdepkgs = with pkgs.kdePackages; [ + ark + dolphin-plugins + kolourpaint + ]; + kwrite = pkgs.symlinkJoin { + name = "kwrite"; + paths = [ pkgs.kdePackages.kate ]; + postBuild = '' + rm -rf $out/bin/kate \ + $out/bin/.kate-wrapped \ + $out/share/applications/org.kde.kate.desktop \ + $out/share/man \ + $out/share/icons/hicolor/*/apps/kate.png \ + $out/share/icons/hicolor/scalable/apps/kate.svg \ + $out/share/appdata/org.kde.kate.appdata.xml + ''; + }; +in +{ + environment.systemPackages = + with pkgs; + [ + adwaita-icon-theme + aspell + aspellDicts.de + aspellDicts.en + aspellDicts.en-computers + aspellDicts.pt_BR + bat + clonehero + deploy-rs + distrobox + fd + firefox + freecad-wayland + fzf + ghostty + gimp + heroic + inkscape + junction + kara + kde-rounded-corners + kwrite + libfido2 + libreoffice-qt + # lilipod BROKEN + mangohud + microsoft-edge + mission-center + mpv + nextcloud-client + nixfmt-rfc-style + nixos-firewall-tool + nix-init + nix-output-monitor + obsidian + obs-studio + orca-slicer + p7zip + plasma-panel-colorizer + plasticity + protonup + quickemu + quickgui + qview + qbittorrent + ripgrep + rnote + steam-run + tor-browser + ungoogled-chromium + unrar + ventoy + vesktop + ] + ++ kdepkgs; + + services.flatpak = { + enable = true; + packages = [ + "com.github.k4zmu2a.spacecadetpinball" + "com.github.tchx84.Flatseal" + "com.modrinth.ModrinthApp" + "com.steamgriddb.SGDBoop" + "app.zen_browser.zen" + "io.github.Foldex.AdwSteamGtk" + "io.itch.itch" + "org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/24.08" + ]; + uninstallUnmanaged = true; + update.auto.enable = true; + }; + + programs = { + adb.enable = true; + steam.enable = true; + dconf.enable = true; + nix-ld.enable = true; + kdeconnect.enable = true; + partition-manager.enable = true; + gamemode.enable = true; + hyprland.enable = true; + nix-index-database.comma.enable = true; + appimage = { + enable = true; + binfmt = true; + }; + nh = { + enable = true; + flake = "/home/user/Projects/personal/nix-config"; + }; + }; + + fonts = { + fontDir.enable = true; + packages = with pkgs; [ + corefonts + noto-fonts-cjk-sans + roboto + nerd-fonts.jetbrains-mono + ]; + }; + + environment.plasma6.excludePackages = ( + with pkgs.kdePackages; + [ + discover + elisa + gwenview + kate + khelpcenter + oxygen + ] + ); +} diff --git a/hosts/desktops/common/services.nix b/hosts/desktops/common/services.nix new file mode 100644 index 0000000..12a64e9 --- /dev/null +++ b/hosts/desktops/common/services.nix @@ -0,0 +1,61 @@ +{ + inputs, + config, + pkgs, + ... +}: + +{ + services = { + printing.enable = true; + udev.packages = with pkgs; [ yubikey-personalization ]; + desktopManager.plasma6.enable = true; + tailscale.useRoutingFeatures = "client"; + nginx = { + enable = true; + virtualHosts."localhost".root = inputs.homepage; + }; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + }; + greetd = { + enable = true; + settings = { + default_session.command = + let + xSessions = "${config.services.displayManager.sessionData.desktops}/share/xsessions"; + wlSessions = "${config.services.displayManager.sessionData.desktops}/share/wayland-sessions"; + in + '' + ${pkgs.greetd.tuigreet}/bin/tuigreet \ + --remember \ + --asterisks \ + --time \ + --greeting "NixOS" \ + --sessions ${xSessions}:${wlSessions} + ''; + initial_session = { + command = '' + ${pkgs.kdePackages.plasma-workspace}/bin/startplasma-wayland &> /dev/null + ''; + user = "user"; + }; + }; + }; + }; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-kde + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + ]; + }; +} diff --git a/hosts/desktops/common/stylix.nix b/hosts/desktops/common/stylix.nix new file mode 100644 index 0000000..f1760b1 --- /dev/null +++ b/hosts/desktops/common/stylix.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: + +{ + stylix = { + enable = true; + image = pkgs.fetchurl { + url = "https://w.wallhaven.cc/full/dp/wallhaven-dpwvl3.jpg"; + sha256 = "sha256-h9UeYj8jSRgSv8XL+zgds4KtooLlJ+IqwxZbQEXdCh4="; + }; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + cursor = { + package = pkgs.kdePackages.breeze-icons; + name = "Breeze_Light"; + size = 24; + }; + opacity = { + applications = 1.0; + desktop = 0.8; + popups = config.stylix.opacity.desktop; + terminal = 1.0; + }; + fonts = { + serif = { + package = pkgs.source-serif; + name = "Source Serif 4 Display"; + }; + sansSerif = { + package = pkgs.inter; + name = "Inter"; + }; + monospace = { + package = pkgs.nerd-fonts.fira-code; + name = "FiraCode Nerd Font"; + }; + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + sizes = { + applications = 10; + desktop = config.stylix.fonts.sizes.applications; + popups = config.stylix.fonts.sizes.applications; + terminal = 12; + }; + }; + }; +} diff --git a/hosts/desktops/common/users.nix b/hosts/desktops/common/users.nix new file mode 100644 index 0000000..c62d425 --- /dev/null +++ b/hosts/desktops/common/users.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + environment.sessionVariables = rec { + KDEHOME = "$XDG_CONFIG_HOME/kde4"; # Stops kde from placing a .kde4 folder in the home dir + NIXOS_OZONE_WL = "1"; # Forces chromium and most electron apps to run in wayland + }; + + users.users.user = { + description = "William"; + extraGroups = [ + "uaccess" # Needed for HID dev + "dialout" # Needed for arduino dev + "libvirt" + "libvirtd" + "adbusers" + "i2c" + ]; + }; +} diff --git a/hosts/desktops/common/virtualisation.nix b/hosts/desktops/common/virtualisation.nix new file mode 100644 index 0000000..461eb36 --- /dev/null +++ b/hosts/desktops/common/virtualisation.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + virtualisation = { + libvirtd.enable = true; + lxd.enable = true; + }; +} diff --git a/aspects/hosts/_io/services.nix b/hosts/desktops/io.nix similarity index 51% rename from aspects/hosts/_io/services.nix rename to hosts/desktops/io.nix index df41a6f..1839968 100644 --- a/aspects/hosts/_io/services.nix +++ b/hosts/desktops/io.nix @@ -1,6 +1,67 @@ { pkgs, ... }: +let + cml-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs { + wttsrc = pkgs.fetchFromGitHub { + owner = "WeirdTreeThing"; + repo = "chromebook-ucm-conf"; + rev = "b6ce2a7"; + hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc="; + }; + postInstall = '' + echo "v0.4.1" > $out/chromebook.patched + cp -R $wttsrc/{common,codecs,platforms} $out/share/alsa/ucm2 + cp -R $wttsrc/{cml,sof-rt5682} $out/share/alsa/ucm2/conf.d + ''; + }; +in { + imports = [ + # Host-common imports + ../common + # Desktop-common imports + ./common + # Host-specific imports + ./io + ]; + + networking.hostName = "io"; + + nix.nixPath = [ "nixos-config=${./io.nix}" ]; + + zramSwap = { + enable = true; + memoryPercent = 100; + }; + + boot = { + # TODO check if future kernel versions fix boot issue with systemd initrd with tpm + initrd.systemd.tpm2.enable = false; + kernelParams = [ + "nosgx" + "i915.fastboot=1" + "mem_sleep_default=deep" + ]; + extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=3 + ''; + }; + + environment = { + systemPackages = with pkgs; [ + maliit-keyboard + sof-firmware + ]; + sessionVariables.ALSA_CONFIG_UCM2 = "${cml-ucm-conf}/share/alsa/ucm2"; + }; + + # TODO: remove once gmodena/nix-flatpak/issues/45 fixed + systemd.services."flatpak-managed-install" = { + serviceConfig = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 5"; + }; + }; + services = { keyd = { enable = true; @@ -39,7 +100,7 @@ f9 = "f10"; f10 = "f11"; f13 = "f12"; - y = "sysrq"; + u = "sysrq"; k = "home"; l = "pageup"; "," = "end"; @@ -48,14 +109,5 @@ }; }; }; - upower.enable = true; - power-profiles-daemon.enable = true; - }; - - # TODO: remove once gmodena/nix-flatpak/issues/45 fixed - systemd.services."flatpak-managed-install" = { - serviceConfig = { - ExecStartPre = "${pkgs.coreutils}/bin/sleep 5"; - }; }; } diff --git a/hosts/desktops/io/default.nix b/hosts/desktops/io/default.nix new file mode 100644 index 0000000..a480ae0 --- /dev/null +++ b/hosts/desktops/io/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./ephermal.nix + ./hardware-configuration.nix + ]; +} diff --git a/hosts/desktops/io/ephermal.nix b/hosts/desktops/io/ephermal.nix new file mode 100644 index 0000000..35542f8 --- /dev/null +++ b/hosts/desktops/io/ephermal.nix @@ -0,0 +1,46 @@ +{ ... }: + +{ + boot.initrd.systemd.services.recreate-root = { + description = "Rolling over and creating new filesystem root"; + requires = [ "initrd-root-device.target" ]; + after = [ + "local-fs-pre.target" + "initrd-root-device.target" + ]; + requiredBy = [ "initrd-root-fs.target" ]; + before = [ "sysroot.mount" ]; + unitConfig = { + AssertPathExists = "/etc/initrd-release"; + DefaultDependencies = false; + }; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + mkdir /btrfs_tmp + mount /dev/disk/by-uuid/3638cea6-5503-43cc-aa4f-3d37ebedad2f /btrfs_tmp + if [[ -e /btrfs_tmp/@root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/@root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } + + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/@root + umount /btrfs_tmp + ''; + }; +} diff --git a/hosts/desktops/io/hardware-configuration.nix b/hosts/desktops/io/hardware-configuration.nix new file mode 100644 index 0000000..037a503 --- /dev/null +++ b/hosts/desktops/io/hardware-configuration.nix @@ -0,0 +1,83 @@ +{ + config, + lib, + modulesPath, + ... +}: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot = { + initrd = { + availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + "sdhci_pci" + ]; + luks.devices."enc" = { + device = "/dev/disk/by-uuid/8018720e-42dd-453c-b374-adaa02eb48c9"; + keyFile = "/dev/disk/by-partuuid/cbc7e305-d32d-4250-b6ae-6a8264ea096e"; + }; + }; + kernelModules = [ "kvm-intel" ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/3638cea6-5503-43cc-aa4f-3d37ebedad2f"; + fsType = "btrfs"; + options = [ + "subvol=@root" + "noatime" + "compress=zstd" + ]; + }; + "/home" = { + device = "/dev/disk/by-uuid/3638cea6-5503-43cc-aa4f-3d37ebedad2f"; + fsType = "btrfs"; + options = [ + "subvol=@home" + "noatime" + "compress=zstd" + ]; + }; + "/nix" = { + device = "/dev/disk/by-uuid/3638cea6-5503-43cc-aa4f-3d37ebedad2f"; + fsType = "btrfs"; + options = [ + "subvol=@nix" + "noatime" + "compress=zstd" + ]; + }; + "/persistent" = { + device = "/dev/disk/by-uuid/3638cea6-5503-43cc-aa4f-3d37ebedad2f"; + fsType = "btrfs"; + options = [ + "subvol=@persistent" + "noatime" + "compress=zstd" + ]; + }; + "/boot/efi" = { + device = "/dev/disk/by-uuid/31C9-08FF"; + fsType = "vfat"; + options = [ + "noatime" + "fmask=0077" + "dmask=0077" + ]; + }; + }; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/desktops/rotterdam.nix b/hosts/desktops/rotterdam.nix new file mode 100644 index 0000000..9294f82 --- /dev/null +++ b/hosts/desktops/rotterdam.nix @@ -0,0 +1,90 @@ +{ pkgs, ... }: + +let + qubesnsh = pkgs.writeTextFile { + name = "qubes.nsh"; + text = "HD1f65535a1:EFI\\qubes\\grubx64.efi"; + }; + + reboot-into-qubes = pkgs.makeDesktopItem { + name = "reboot-into-qubes"; + icon = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/vinceliuice/Qogir-icon-theme/31f267e1f5fd4e9596bfd78dfb41a03d3a9f33ee/src/scalable/apps/distributor-logo-qubes.svg"; + sha256 = "sha256-QbHr7s5Wcs7uFtfqZctMyS0iDbMfiiZOKy2nHhDOfn0="; + }; + desktopName = "Qubes OS"; + genericName = "Reboot into Qubes OS"; + categories = [ "System" ]; + startupNotify = true; + exec = pkgs.writeShellScript "reboot-into-qubes" '' + ${pkgs.yad}/bin/yad --form \ + --title="Qubes OS" \ + --image distributor-logo-qubes \ + --text "Are you sure you want to reboot into Qubes OS?" \ + --button="Yes:0" --button="Cancel:1" + if [ $? -eq 0 ]; then + systemctl reboot --boot-loader-entry=qubes.conf + fi + ''; + }; +in +{ + imports = [ + # Host-common imports + ../common + # Desktop-common imports + ./common + # Host-specific imports + ./rotterdam + ]; + + networking.hostName = "rotterdam"; + + services = { + flatpak.packages = [ "net.retrodeck.retrodeck" ]; + keyd = { + enable = true; + keyboards.main = { + ids = [ "5653:0001" ]; + settings.main = { + esc = "overload(meta, esc)"; + }; + }; + }; + }; + + environment.systemPackages = with pkgs; [ reboot-into-qubes ]; + + # hardware.graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ]; + + systemd.targets.hibernate.enable = false; # disable non-functional hibernate + + nix.nixPath = [ "nixos-config=${./rotterdam.nix}" ]; + + boot = { + kernelParams = [ + "processor.max_cstate=1" # Fixes bug where ryzen cpus freeze when in highest C state + "clearcpuid=514" + # Fixes amdgpu freezing + "amdgpu.noretry=0" + "amdgpu.ppfeaturemask=0xfffd3fff" + "amdgpu.gpu_recovery=1" + "amdgpu.lockup_timeout=1000" + ]; + # QubesOS boot entry + loader.systemd-boot = { + extraFiles = { + "efi/edk2-shell/shell.efi" = "${pkgs.edk2-uefi-shell}/shell.efi"; + "qubes.nsh" = qubesnsh; + }; + extraEntries."qubes.conf" = '' + title Qubes OS + efi /efi/edk2-shell/shell.efi + options -nointerrupt qubes.nsh + sort-key ab + ''; + }; + }; + + programs.steam.dedicatedServer.openFirewall = true; +} diff --git a/hosts/desktops/rotterdam/default.nix b/hosts/desktops/rotterdam/default.nix new file mode 100644 index 0000000..eedd2b4 --- /dev/null +++ b/hosts/desktops/rotterdam/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./ephermal.nix + ]; +} diff --git a/hosts/desktops/rotterdam/ephermal.nix b/hosts/desktops/rotterdam/ephermal.nix new file mode 100644 index 0000000..8161a99 --- /dev/null +++ b/hosts/desktops/rotterdam/ephermal.nix @@ -0,0 +1,47 @@ +{ ... }: + +{ + boot.initrd.systemd.services.recreate-root = { + description = "Rolling over and creating new filesystem root"; + requires = [ "initrd-root-device.target" ]; + after = [ + "local-fs-pre.target" + "initrd-root-device.target" + ]; + requiredBy = [ "initrd-root-fs.target" ]; + before = [ "sysroot.mount" ]; + unitConfig = { + AssertPathExists = "/etc/initrd-release"; + DefaultDependencies = false; + }; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + mkdir /btrfs_tmp + mount /dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8 /btrfs_tmp + + if [[ -e /btrfs_tmp/@root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/@root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } + + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/@root + umount /btrfs_tmp + ''; + }; +} diff --git a/aspects/hosts/_rotterdam/hardware-configuration.nix b/hosts/desktops/rotterdam/hardware-configuration.nix similarity index 88% rename from aspects/hosts/_rotterdam/hardware-configuration.nix rename to hosts/desktops/rotterdam/hardware-configuration.nix index 169c53f..524d0ab 100644 --- a/aspects/hosts/_rotterdam/hardware-configuration.nix +++ b/hosts/desktops/rotterdam/hardware-configuration.nix @@ -72,8 +72,18 @@ "compress=zstd" ]; }; + "/swap" = { + device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8"; + fsType = "btrfs"; + options = [ + "subvol=@swap" + "noatime" + ]; + }; }; + swapDevices = [ { device = "/swap/swapfile"; } ]; + networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/hosts/servers/alexandria.nix b/hosts/servers/alexandria.nix new file mode 100644 index 0000000..4154097 --- /dev/null +++ b/hosts/servers/alexandria.nix @@ -0,0 +1,34 @@ +{ ... }: + +{ + imports = [ + # Host-common imports + ../common + # Server-common imports + ./common + # Host-specific imports + ./alexandria + ]; + + nix.nixPath = [ "nixos-config=${./alexandria.nix}" ]; + + swapDevices = [ + { + device = "/swapfile"; + size = 8192; + } + ]; + + networking = { + hostName = "alexandria"; + firewall = { + allowedTCPPorts = [ + 80 + 443 + 8010 + 9666 + ]; + allowedUDPPorts = [ 24454 ]; + }; + }; +} diff --git a/hosts/servers/alexandria/changedetection.nix b/hosts/servers/alexandria/changedetection.nix new file mode 100644 index 0000000..702952f --- /dev/null +++ b/hosts/servers/alexandria/changedetection.nix @@ -0,0 +1,20 @@ +{ config, lib, ... }: + +{ + services = { + changedetection-io = { + enable = true; + behindProxy = true; + datastorePath = "/data/changedetection"; + port = lib.toInt "${config.ports.changedetection-io}"; + baseURL = "https://detect.baduhai.dev"; + }; + + nginx.virtualHosts."detect.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.changedetection-io}"; + }; + }; +} diff --git a/hosts/servers/alexandria/cinny.nix b/hosts/servers/alexandria/cinny.nix new file mode 100644 index 0000000..fc4770f --- /dev/null +++ b/hosts/servers/alexandria/cinny.nix @@ -0,0 +1,23 @@ +{ config, ... }: + +{ + virtualisation.oci-containers.containers."cinny" = { + image = "ghcr.io/cinnyapp/cinny:latest"; + ports = [ "${config.ports.cinny}:80" ]; + environment = { + TZ = "America/Bahia"; + }; + volumes = [ "/data/matrix/cinny-config.json:/app/config.json" ]; + extraOptions = [ + "--pull=newer" + "--label=io.containers.autoupdate=registry" + ]; + }; + + services.nginx.virtualHosts."matrix.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.cinny}"; + }; +} diff --git a/hosts/servers/alexandria/default.nix b/hosts/servers/alexandria/default.nix new file mode 100644 index 0000000..d5069a1 --- /dev/null +++ b/hosts/servers/alexandria/default.nix @@ -0,0 +1,51 @@ +{ lib, ... }: + +let + mkStringOption = + default: + lib.mkOption { + inherit default; + type = lib.types.str; + }; + +in + +{ + imports = [ + ./changedetection.nix + ./cinny.nix + ./forgejo.nix + ./hardware-configuration.nix + ./jellyfin.nix + ./librespeed.nix + ./memos.nix + ./minecraft.nix + ./nextcloud.nix + ./nginx.nix + ./paperless.nix + ./searx.nix + ./services.nix + ./users.nix + ./vaultwarden.nix + ]; + + options.ports = { + bazaar = mkStringOption "6767"; + radarr = mkStringOption "7878"; + vaultwarden = mkStringOption "8000"; + changedetection-io = mkStringOption "8001"; + cinny = mkStringOption "8002"; + librespeed = mkStringOption "8003"; + paperless = mkStringOption "8004"; + yousable = mkStringOption "8005"; + cinny2 = mkStringOption "8006"; + searx = mkStringOption "8007"; + qbittorrent = mkStringOption "8008"; + actual = mkStringOption "8009"; + memos = mkStringOption "8010"; + collabora = mkStringOption "8011"; + jellyfin = mkStringOption "8096"; + sonarr = mkStringOption "8989"; + jackett = mkStringOption "9117"; + }; +} diff --git a/hosts/servers/alexandria/forgejo.nix b/hosts/servers/alexandria/forgejo.nix new file mode 100644 index 0000000..a51c050 --- /dev/null +++ b/hosts/servers/alexandria/forgejo.nix @@ -0,0 +1,33 @@ +{ config, ... }: + +let + domain = "git.baduhai.dev"; +in + +{ + services = { + forgejo = { + enable = true; + repositoryRoot = "/data/forgejo"; + settings = { + session.COOKIE_SECURE = true; + server = { + PROTOCOL = "http+unix"; + DOMAIN = domain; + ROOT_URL = "https://${domain}"; + OFFLINE_MODE = true; # disable use of CDNs + SSH_DOMAIN = "baduhai.dev"; + }; + log.LEVEL = "Warn"; + mailer.ENABLED = false; + actions.ENABLED = false; + }; + }; + nginx.virtualHosts.${domain} = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}:/"; + }; + }; +} diff --git a/aspects/hosts/_alexandria/hardware-configuration.nix b/hosts/servers/alexandria/hardware-configuration.nix similarity index 66% rename from aspects/hosts/_alexandria/hardware-configuration.nix rename to hosts/servers/alexandria/hardware-configuration.nix index 63ecba5..a5f9767 100644 --- a/aspects/hosts/_alexandria/hardware-configuration.nix +++ b/hosts/servers/alexandria/hardware-configuration.nix @@ -23,23 +23,17 @@ extraModulePackages = [ ]; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/31289617-1d84-4432-a833-680b52e88525"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/4130-BE54"; - fsType = "vfat"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/31289617-1d84-4432-a833-680b52e88525"; + fsType = "ext4"; }; - swapDevices = [ - { - device = "/swapfile"; - size = 8192; - } - ]; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4130-BE54"; + fsType = "vfat"; + }; + + swapDevices = [ ]; networking.useDHCP = lib.mkDefault true; diff --git a/hosts/servers/alexandria/jellyfin.nix b/hosts/servers/alexandria/jellyfin.nix new file mode 100644 index 0000000..015f4aa --- /dev/null +++ b/hosts/servers/alexandria/jellyfin.nix @@ -0,0 +1,19 @@ +{ config, ... }: + +{ + services = { + jellyfin = { + enable = true; + user = "user"; + group = "hosted"; + openFirewall = true; + }; + + nginx.virtualHosts."jellyfin.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.jellyfin}"; + }; + }; +} diff --git a/hosts/servers/alexandria/librespeed.nix b/hosts/servers/alexandria/librespeed.nix new file mode 100644 index 0000000..6b830b7 --- /dev/null +++ b/hosts/servers/alexandria/librespeed.nix @@ -0,0 +1,22 @@ +{ config, ... }: + +{ + virtualisation.oci-containers.containers."librespeed" = { + image = "lscr.io/linuxserver/librespeed:latest"; + environment = { + TZ = "America/Bahia"; + }; + ports = [ "${config.ports.librespeed}:80" ]; + extraOptions = [ + "--pull=newer" + "--label=io.containers.autoupdate=registry" + ]; + }; + + services.nginx.virtualHosts."speed.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.librespeed}"; + }; +} diff --git a/hosts/servers/alexandria/memos.nix b/hosts/servers/alexandria/memos.nix new file mode 100644 index 0000000..2d41cc0 --- /dev/null +++ b/hosts/servers/alexandria/memos.nix @@ -0,0 +1,23 @@ +{ config, ... }: + +{ + virtualisation.oci-containers.containers."memos" = { + image = "docker.io/neosmemo/memos:stable"; + ports = [ "${config.ports.memos}:5230" ]; + environment = { + TZ = "America/Bahia"; + }; + volumes = [ "/data/memos/:/var/opt/memos" ]; + extraOptions = [ + "--pull=newer" + "--label=io.containers.autoupdate=registry" + ]; + }; + + services.nginx.virtualHosts."notes.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.memos}"; + }; +} diff --git a/hosts/servers/alexandria/minecraft.nix b/hosts/servers/alexandria/minecraft.nix new file mode 100644 index 0000000..2ce951f --- /dev/null +++ b/hosts/servers/alexandria/minecraft.nix @@ -0,0 +1,73 @@ +{ pkgs, ... }: + +{ + services.minecraft-servers = { + enable = true; + eula = true; + dataDir = "/data/minecraft"; + servers."kingdomcums" = { + enable = true; + package = pkgs.fabricServers.fabric-1_20_1; + openFirewall = true; + serverProperties = { + difficulty = "normal"; + gamemode = "survival"; + motd = "Kingdom Cums"; + online-mode = false; + spawn-protection = false; + }; + symlinks."mods" = pkgs.linkFarmFromDrvs "mods" ( + builtins.attrValues { + villagerNames = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/gqRXDo8B/versions/rzXhJ2pH/villagernames-1.20.1-8.1.jar"; + sha256 = "0hcbbp3zi3nnr12kian9l645f22jr7495bcrlbng46nxp9h08pg5"; + }; + lithium = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/ZSNsJrPI/lithium-fabric-mc1.20.1-0.11.2.jar"; + sha256 = "1ycdvrs46bbdxsa6i38sfx70v47nvzzbmblfpy3hq3k8blsrbid0"; + }; + lootr = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/EltpO5cN/versions/fqmzdpE2/lootr-fabric-1.20-0.7.33.81.jar"; + sha256 = "0db0472rb07nbc9i925qp3n7s7nmrq6q3alhprflgc9gqg0j0f14"; + }; + malilib = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/GcWjdA9I/versions/V7yLDtJV/malilib-fabric-1.20.1-0.16.3.jar"; + sha256 = "129m1jnk58p0wid5fmagqx13wp6pw4gja01yx14aljdxgzr8kqas"; + }; + immersivePaintings = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/6txNkua3/versions/UjL11A4h/immersive_paintings-0.6.7%2B1.20.1-fabric.jar"; + sha256 = "1di9a67q372z6lplnsa1kmh86armya83mimn61c8ai7izjlsfnid"; + }; + entityCulling = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/NNAgCjsB/versions/mahLIqpj/entityculling-fabric-1.6.7-mc1.20.1.jar"; + sha256 = "01iz8rgljgzl0d8gcwpmr6wcvv3b0cf1siggp3dn8q5hv9przk9k"; + }; + fabricAPI = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/P7uGFii0/fabric-api-0.92.2%2B1.20.1.jar"; + sha256 = "1z3hcxng2p9ymph1c0k729vxxaasi34n6fcdsqwx0wsmqi2gh025"; + }; + fallingTree = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/Fb4jn8m6/versions/NrtzFkZE/FallingTree-1.20.1-4.3.4.jar"; + sha256 = "0sfv2laxzgmkhmr0kizi7g09r6fkccjhj9p5j0viqywnwx02r7fs"; + }; + carryOn = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/joEfVgkn/versions/Mkla4B3q/carryon-fabric-1.20.1-2.1.2.7.jar"; + sha256 = "1pgbqrjrxw7bgwn6phpywgpjfmf5h341ba93j76ibk649wbgn9cd"; + }; + collective = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/e0M1UDsY/versions/jo7YkyNS/collective-1.20.1-7.84.jar"; + sha256 = "01qvaqmd5kmxq7sins6703xq5ckc47qs5kd62gnjyfq1dbjp2y2b"; + }; + dynamicLights = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/7YjclEGc/versions/eU6PA0pr/dynamiclights-v1.8.3-mc1.17x-1.21x-mod.jar"; + sha256 = "0vdv525gis1vj514iqh4rbl6byp7k0ls3lsyj0c3db8g58d784gm"; + }; + appleSkin = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/EsAfCjCV/versions/xcauwnEB/appleskin-fabric-mc1.20.1-2.5.1.jar"; + sha256 = "1d9qmzjlk763ycmizqpmhcq0hhqw9j8hij6xk8p8l11ljr13mql5"; + }; + } + ); + }; + }; +} diff --git a/aspects/hosts/_alexandria/nextcloud.nix b/hosts/servers/alexandria/nextcloud.nix similarity index 67% rename from aspects/hosts/_alexandria/nextcloud.nix rename to hosts/servers/alexandria/nextcloud.nix index cb9f2ac..04d7407 100644 --- a/aspects/hosts/_alexandria/nextcloud.nix +++ b/hosts/servers/alexandria/nextcloud.nix @@ -1,36 +1,23 @@ { + lib, config, - inputs, pkgs, ... }: -let - mkNginxVHosts = inputs.self.lib.mkNginxVHosts; -in - { services = { nextcloud = { enable = true; - package = pkgs.nextcloud32; + package = pkgs.nextcloud30; datadir = "/data/nextcloud"; hostName = "cloud.baduhai.dev"; configureRedis = true; https = true; + autoUpdateApps.enable = true; secretFile = config.age.secrets."nextcloud-secrets.json".path; database.createLocally = true; maxUploadSize = "16G"; - extraApps = { - inherit (config.services.nextcloud.package.packages.apps) - calendar - contacts - notes - tasks - user_oidc - ; - }; - extraAppsEnable = true; caching = { apcu = true; redis = true; @@ -39,7 +26,6 @@ in trusted_proxies = [ "127.0.0.1" ]; default_phone_region = "BR"; maintenance_window_start = "4"; - allow_local_remote_servers = true; enabledPreviewProviders = [ "OC\\Preview\\BMP" "OC\\Preview\\EMF" @@ -75,21 +61,43 @@ in }; }; - nginx.virtualHosts = mkNginxVHosts { - domains."cloud.baduhai.dev" = { }; + collabora-online = { + enable = true; + port = lib.strings.toInt config.ports.collabora; + settings.ssl = { + enable = false; + termination = true; + }; + }; + + nginx.virtualHosts = { + ${config.services.nextcloud.hostName} = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + }; + "office.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/" = { + proxyPass = "http://127.0.0.1:${config.ports.collabora}"; + proxyWebsockets = true; + }; + }; }; }; age.secrets = { "nextcloud-secrets.json" = { - file = "${inputs.self}/secrets/nextcloud-secrets.json.age"; + file = ../../../secrets/nextcloud-secrets.json.age; owner = "nextcloud"; - group = "nextcloud"; + group = "hosted"; }; nextcloud-adminpass = { - file = "${inputs.self}/secrets/nextcloud-adminpass.age"; + file = ../../../secrets/nextcloud-adminpass.age; owner = "nextcloud"; - group = "nextcloud"; + group = "hosted"; }; }; } diff --git a/hosts/servers/alexandria/nginx.nix b/hosts/servers/alexandria/nginx.nix new file mode 100644 index 0000000..5075bcf --- /dev/null +++ b/hosts/servers/alexandria/nginx.nix @@ -0,0 +1,37 @@ +{ config, ... }: + +{ + services.nginx = { + enable = true; + group = "hosted"; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + }; + + security.acme = { + acceptTerms = true; + defaults = { + email = "baduhai@proton.me"; + dnsResolver = "1.1.1.1:53"; + dnsProvider = "cloudflare"; + credentialsFile = config.age.secrets.cloudflare.path; + }; + certs."baduhai.dev" = { + extraDomainNames = [ "*.baduhai.dev" ]; + }; + }; + + boot.kernel.sysctl = { + "net.ipv4.ip_forward" = 1; + "net.ipv6.conf.all.forwarding" = 1; + }; + + age.secrets.cloudflare = { + file = ../../../secrets/cloudflare.age; + owner = "nginx"; + group = "hosted"; + }; + +} diff --git a/hosts/servers/alexandria/paperless.nix b/hosts/servers/alexandria/paperless.nix new file mode 100644 index 0000000..d78d107 --- /dev/null +++ b/hosts/servers/alexandria/paperless.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: + +{ + services = { + paperless = { + enable = true; + dataDir = "/data/paperless/data"; + mediaDir = "/data/paperless/media"; + passwordFile = config.age.secrets.paperless.path; + port = lib.toInt "${config.ports.paperless}"; + consumptionDirIsPublic = true; + settings = { + PAPERLESS_OCR_LANGUAGE = "eng+por+deu"; + }; + }; + + nginx.virtualHosts."docs.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.paperless}"; + }; + }; + + age.secrets.paperless = { + file = ../../../secrets/paperless.age; + owner = "paperless"; + group = "hosted"; + }; +} diff --git a/hosts/servers/alexandria/searx.nix b/hosts/servers/alexandria/searx.nix new file mode 100644 index 0000000..94f3017 --- /dev/null +++ b/hosts/servers/alexandria/searx.nix @@ -0,0 +1,28 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + services = { + searx = { + enable = true; + package = pkgs.searxng; + settings.server = { + port = lib.toInt "${config.ports.searx}"; + bind_address = "0.0.0.0"; + secret_key = "&yEf!xLA@y3FdJ5BjKnUnNAkqer$iW!9"; + method = "GET"; + }; + }; + + nginx.virtualHosts."search.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.searx}"; + }; + }; +} diff --git a/hosts/servers/alexandria/services.nix b/hosts/servers/alexandria/services.nix new file mode 100644 index 0000000..08b927a --- /dev/null +++ b/hosts/servers/alexandria/services.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + services.postgresql.enable = true; + + # TODO: remove when bug fux + # Workaround for upstream bug in NetworkManager-wait-online.service + systemd.services.NetworkManager-wait-online.enable = false; +} diff --git a/hosts/servers/alexandria/users.nix b/hosts/servers/alexandria/users.nix new file mode 100644 index 0000000..db3f3ed --- /dev/null +++ b/hosts/servers/alexandria/users.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + users = { + users = { + nginx.extraGroups = [ "acme" ]; + }; + groups = { + hosted = { + gid = 1005; + members = [ + "user" + "minecraft" + "paperless" + "vaultwarden" + ]; + }; + }; + }; +} diff --git a/hosts/servers/alexandria/vaultwarden.nix b/hosts/servers/alexandria/vaultwarden.nix new file mode 100644 index 0000000..2207c08 --- /dev/null +++ b/hosts/servers/alexandria/vaultwarden.nix @@ -0,0 +1,22 @@ +{ config, ... }: + +{ + services = { + vaultwarden = { + enable = true; + config = { + DOMAIN = "https://pass.baduhai.dev"; + SIGNUPS_ALLOWED = true; + ROCKET_ADDRESS = "127.0.0.1"; + ROCKET_PORT = "${config.ports.vaultwarden}"; + }; + }; + + nginx.virtualHosts."pass.baduhai.dev" = { + useACMEHost = "baduhai.dev"; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://127.0.0.1:${config.ports.vaultwarden}"; + }; + }; +} diff --git a/hosts/servers/common/boot.nix b/hosts/servers/common/boot.nix new file mode 100644 index 0000000..5d6e482 --- /dev/null +++ b/hosts/servers/common/boot.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + boot.kernelPackages = pkgs.linuxPackages_hardened; +} diff --git a/hosts/servers/common/default.nix b/hosts/servers/common/default.nix new file mode 100644 index 0000000..db2cb46 --- /dev/null +++ b/hosts/servers/common/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ./boot.nix + ./home-manager.nix + ./nix.nix + ./services.nix + ]; +} diff --git a/hosts/servers/common/home-manager.nix b/hosts/servers/common/home-manager.nix new file mode 100644 index 0000000..20186df --- /dev/null +++ b/hosts/servers/common/home-manager.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "bkp"; + users.user = import ../../../users/servers/user.nix; + }; +} diff --git a/hosts/servers/common/nix.nix b/hosts/servers/common/nix.nix new file mode 100644 index 0000000..af57cae --- /dev/null +++ b/hosts/servers/common/nix.nix @@ -0,0 +1,13 @@ +{ inputs, ... }: + +{ + environment.etc."channels/nixpkgs".source = inputs.nixpkgs-stable.outPath; + + nix = { + registry.nixpkgs.flake = inputs.nixpkgs-stable; + nixPath = [ + "nixpkgs=/etc/channels/nixpkgs" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + }; +} diff --git a/hosts/servers/common/services.nix b/hosts/servers/common/services.nix new file mode 100644 index 0000000..035de35 --- /dev/null +++ b/hosts/servers/common/services.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + services.tailscale = { + extraSetFlags = [ "--advertise-exit-node" ]; + useRoutingFeatures = "server"; + }; +} diff --git a/modules/qbittorrent.nix b/modules/qbittorrent.nix new file mode 100644 index 0000000..09123a5 --- /dev/null +++ b/modules/qbittorrent.nix @@ -0,0 +1,123 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; +let + cfg = config.services.qbittorrent; + configDir = "${cfg.dataDir}/.config"; + openFilesLimit = 4096; +in +{ + options.services.qbittorrent = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Run qBittorrent headlessly as systemwide daemon + ''; + }; + + dataDir = mkOption { + type = types.path; + default = "/var/lib/qbittorrent"; + description = '' + The directory where qBittorrent will create files. + ''; + }; + + user = mkOption { + type = types.str; + default = "qbittorrent"; + description = '' + User account under which qBittorrent runs. + ''; + }; + + group = mkOption { + type = types.str; + default = "qbittorrent"; + description = '' + Group under which qBittorrent runs. + ''; + }; + + port = mkOption { + type = types.port; + default = 8080; + description = '' + qBittorrent web UI port. + ''; + }; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Open services.qBittorrent.port to the outside network. + ''; + }; + + openFilesLimit = mkOption { + default = openFilesLimit; + description = '' + Number of files to allow qBittorrent to open. + ''; + }; + }; + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.qbittorrent ]; + + nixpkgs.overlays = [ + (final: prev: { + qbittorrent = prev.qbittorrent.override { guiSupport = false; }; + }) + ]; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [ cfg.port ]; + allowedUDPPorts = [ cfg.port ]; + }; + + systemd.services.qbittorrent = { + after = [ "network.target" ]; + description = "qBittorrent Daemon"; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.qbittorrent ]; + serviceConfig = { + ExecStart = '' + ${pkgs.qbittorrent}/bin/qbittorrent-nox \ + --profile=${configDir} \ + --webui-port=${toString cfg.port} + ''; + # To prevent "Quit & shutdown daemon" from working; we want systemd to + # manage it! + Restart = "on-success"; + User = cfg.user; + Group = cfg.group; + UMask = "0002"; + LimitNOFILE = cfg.openFilesLimit; + }; + }; + + users.users = mkIf (cfg.user == "qbittorrent") { + qbittorrent = { + group = cfg.group; + home = cfg.dataDir; + createHome = true; + description = "qBittorrent Daemon user"; + }; + }; + + users.groups = mkIf (cfg.group == "qbittorrent") { + qbittorrent = { + gid = null; + }; + }; + }; +} diff --git a/packages/base16-schemes.nix b/packages/base16-schemes.nix deleted file mode 100644 index fbb1341..0000000 --- a/packages/base16-schemes.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - packages.base16-schemes = pkgs.stdenv.mkDerivation (finalAttrs: { - pname = "base16-schemes"; - version = "0-unstable-2025-06-04"; - - src = pkgs.fetchFromGitHub { - owner = "tinted-theming"; - repo = "schemes"; - rev = "317a5e10c35825a6c905d912e480dfe8e71c7559"; - hash = "sha256-d4km8W7w2zCUEmPAPUoLk1NlYrGODuVa3P7St+UrqkM="; - }; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/themes/ - install base16/*.yaml $out/share/themes/ - - runHook postInstall - ''; - - meta = { - description = "All the color schemes for use in base16 packages"; - homepage = "https://github.com/tinted-theming/schemes"; - maintainers = [ pkgs.lib.maintainers.DamienCassou ]; - license = pkgs.lib.licenses.mit; - }; - }); - }; -} diff --git a/packages/fastfetch.nix b/packages/fastfetch.nix deleted file mode 100644 index aa8d616..0000000 --- a/packages/fastfetch.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, lib, ... }: - let - fastfetch-logo = pkgs.fetchurl { - url = "https://discourse.nixos.org/uploads/default/original/3X/3/6/36954e6d6aa32c8b00f50ca43f142d898c1ff535.png"; - hash = "sha256-aLHz8jSAFocrn+Pb4vRq0wtkYFJpBpZRevd+VoZC/PQ="; - }; - - fastfetch-config = pkgs.writeText "fastfetch-config.json" ( - builtins.toJSON { - "$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"; - modules = [ - "title" - "separator" - { - type = "os"; - keyWidth = 9; - } - { - type = "kernel"; - keyWidth = 9; - } - { - type = "uptime"; - keyWidth = 9; - } - { - type = "shell"; - keyWidth = 9; - } - "break" - { - type = "cpu"; - keyWidth = 11; - } - { - type = "memory"; - keyWidth = 11; - } - { - type = "swap"; - keyWidth = 11; - } - { - type = "disk"; - folders = "/"; - keyWidth = 11; - } - { - type = "command"; - key = "Systemd"; - keyWidth = 11; - text = "echo \"$(systemctl list-units --state=failed --no-legend | wc -l) failed units, $(systemctl list-jobs --no-legend | wc -l) queued jobs\""; - } - "break" - { - type = "command"; - key = "Public IP"; - keyWidth = 15; - text = "curl -s -4 ifconfig.me 2>/dev/null || echo 'N/A'"; - } - { - type = "command"; - key = "Tailscale IP"; - keyWidth = 15; - text = "tailscale ip -4 2>/dev/null || echo 'N/A'"; - } - { - type = "command"; - key = "Local IP"; - keyWidth = 15; - text = "ip -4 addr show scope global | grep inet | head -n1 | awk '{print $2}' | cut -d/ -f1"; - } - ]; - } - ); - in - { - packages.fastfetch = pkgs.writeShellScriptBin "fastfetch" ''exec ${lib.getExe pkgs.fastfetch} --config ${fastfetch-config} --logo-type kitty --logo ${fastfetch-logo} --logo-padding-right 1 --logo-width 36 "$@" ''; - }; -} diff --git a/packages/hm-cli.nix b/packages/hm-cli.nix deleted file mode 100644 index 59f4b4f..0000000 --- a/packages/hm-cli.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - packages.hm-cli = pkgs.writeShellScriptBin "hm" '' - HM="${pkgs.lib.getExe pkgs.home-manager}" - FLAKE_PATH="''${HM_PATH:-$HOME/.config/home-manager}" - FLAKE_OUTPUT="''${HM_USER:-$(whoami)@$(hostname)}" - - show_usage() { - cat < [args] - - Commands: - apply Switch to a new generation - generation list List all generations - generation delete ID... Delete specified generation(s) - generation rollback Rollback to the previous generation - generation switch ID Switch to the specified generation - generation cleanup Delete all but the current generation - - Environment Variables: - HM_PATH Override default flake path (~/.config/home-manager) - Currently set to "''${HM_PATH:-}" - HM_USER Override default user output ("$(whoami)@$(hostname)") - Currently set to "''${HM_USER:-}" - EOF - } - - if [[ $# -eq 0 ]]; then - show_usage - exit 1 - fi - - case "$1" in - apply) - "$HM" switch --flake "$FLAKE_PATH#$FLAKE_OUTPUT" -b bkp - ;; - generation) - if [[ $# -lt 2 ]]; then - echo "Error: generation command requires a subcommand" - show_usage - exit 1 - fi - - case "$2" in - list) - "$HM" generations - ;; - delete) - if [[ $# -lt 3 ]]; then - echo "Error: delete requires at least one generation ID" - exit 1 - fi - shift 2 - "$HM" remove-generations "$@" - ;; - rollback) - PREV_GEN=$("$HM" generations | \ - sed -n 's/^[[:space:]]*id \([0-9]\+\).*/\1/p' | \ - head -n 2 | tail -n 1) - if [[ -z "$PREV_GEN" ]]; then - echo "Error: could not determine previous generation (possibly only one generation exists)" - exit 1 - fi - "$HM" switch --flake "$FLAKE_PATH" --switch-generation "$PREV_GEN" -b bkp - ;; - switch) - if [[ $# -ne 3 ]]; then - echo "Error: switch requires exactly one generation ID" - exit 1 - fi - "$HM" switch --flake "$FLAKE_PATH" --switch-generation "$3" -b bkp - ;; - cleanup) - CURRENT_GEN=$("$HM" generations | sed -n 's/^.*id \([0-9]\+\) .* (current)$/\1/p') - if [[ -z "$CURRENT_GEN" ]]; then - echo "Error: could not determine current generation" - exit 1 - fi - OLD_GENS=$("$HM" generations | sed -n 's/^.*id \([0-9]\+\) .*/\1/p' | grep -v "^$CURRENT_GEN$") - if [[ -z "$OLD_GENS" ]]; then - echo "No old generations to delete" - else - echo "Deleting generations: $(echo $OLD_GENS | tr '\n' ' ')" - echo "$OLD_GENS" | xargs "$HM" remove-generations - echo "Cleanup complete. Current generation $CURRENT_GEN preserved." - fi - ;; - *) - echo "Error: unknown generation subcommand '$2'" - show_usage - exit 1 - ;; - esac - ;; - *) - echo "Error: unknown command '$1'" - show_usage - exit 1 - ;; - esac - ''; - }; -} diff --git a/packages/kwrite.nix b/packages/kwrite.nix deleted file mode 100644 index 67ce69e..0000000 --- a/packages/kwrite.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - packages.kwrite = pkgs.symlinkJoin { - name = "kwrite"; - paths = [ pkgs.kdePackages.kate ]; - postBuild = '' - rm -rf $out/bin/kate \ - $out/bin/.kate-wrapped \ - $out/share/applications/org.kde.kate.desktop \ - $out/share/man \ - $out/share/icons/hicolor/*/apps/kate.png \ - $out/share/icons/hicolor/scalable/apps/kate.svg \ - $out/share/appdata/org.kde.kate.appdata.xml - ''; - }; - }; -} diff --git a/packages/niri-auto-centre.nix b/packages/niri-auto-centre.nix deleted file mode 100644 index dd7b04c..0000000 --- a/packages/niri-auto-centre.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - packages.niri-auto-centre = pkgs.writeShellApplication { - name = "niri-auto-centre"; - runtimeInputs = [ pkgs.jq ]; - text = '' - while true; do - ACTIVE_WORKSPACE=$(niri msg --json workspaces | jq -r '.[] | select(.is_active == true)') - WORKSPACE_ID=$(echo "$ACTIVE_WORKSPACE" | jq -r '.id') - OUTPUT_NAME=$(echo "$ACTIVE_WORKSPACE" | jq -r '.output') - - MONITOR_WIDTH=$(niri msg --json outputs | jq -r ".\"$OUTPUT_NAME\".logical.width") - - SUMMED_TILE_WIDTH=$(niri msg --json windows | jq --argjson wid "$WORKSPACE_ID" -r ' - [.[] | select(.workspace_id == $wid) | {col: .layout.pos_in_scrolling_layout[0], width: .layout.tile_size[0]}] - | group_by(.col) | map(first.width) | add - ') - - if awk "BEGIN {exit !($SUMMED_TILE_WIDTH < $MONITOR_WIDTH)}"; then - niri msg action center-visible-columns - fi - - sleep 0.1 - done - ''; - }; - }; -} diff --git a/packages/overlays.nix b/packages/overlays.nix deleted file mode 100644 index 169a67b..0000000 --- a/packages/overlays.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ inputs, ... }: - -let - packageDir = builtins.readDir ./.; - - # Filter to .nix files, excluding overlays.nix - isPackageFile = name: name != "overlays.nix" && builtins.match ".*\\.nix$" name != null; - - # Extract package name from filename (e.g., "foo-bar.nix" -> "foo-bar") - toPackageName = filename: builtins.head (builtins.match "(.+)\\.nix$" filename); - - packageNames = map toPackageName (builtins.filter isPackageFile (builtins.attrNames packageDir)); -in -{ - flake.overlays.default = - final: prev: - builtins.listToAttrs ( - map (name: { - inherit name; - value = inputs.self.packages.${final.system}.${name}; - }) packageNames - ); -} diff --git a/packages/plasticity.nix b/packages/plasticity.nix new file mode 100644 index 0000000..5ffbaeb --- /dev/null +++ b/packages/plasticity.nix @@ -0,0 +1,133 @@ +{ + alsa-lib, + at-spi2-atk, + autoPatchelfHook, + cairo, + cups, + dbus, + desktop-file-utils, + expat, + fetchurl, + gdk-pixbuf, + gtk3, + gvfs, + hicolor-icon-theme, + lib, + libdrm, + libglvnd, + libnotify, + libsForQt5, + libxkbcommon, + mesa, + nspr, + nss, + openssl, + pango, + rpmextract, + stdenv, + systemd, + trash-cli, + vulkan-loader, + wrapGAppsHook3, + xdg-utils, + xorg, +}: +stdenv.mkDerivation rec { + pname = "plasticity"; + version = "24.2.3"; + + src = fetchurl { + url = "https://github.com/nkallen/plasticity/releases/download/v${version}/Plasticity-${version}-1.x86_64.rpm"; + hash = "sha256-iiVh4k5r5PXN1/VJZcropTMu36N2B/ECq2L5e59QxJY="; + }; + + passthru.updateScript = ./update.sh; + + nativeBuildInputs = [ + wrapGAppsHook3 + autoPatchelfHook + rpmextract + mesa + ]; + + buildInputs = [ + alsa-lib + at-spi2-atk + cairo + cups + dbus + desktop-file-utils + expat + gdk-pixbuf + gtk3 + gvfs + hicolor-icon-theme + libdrm + libnotify + libsForQt5.kde-cli-tools + libxkbcommon + nspr + nss + openssl + pango + stdenv.cc.cc.lib + trash-cli + xdg-utils + ]; + + runtimeDependencies = [ + systemd + libglvnd + vulkan-loader # may help with nvidia users + xorg.libX11 + xorg.libxcb + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXrandr + xorg.libXtst + ]; + + dontUnpack = true; + + # can't find anything on the internet about these files, no clue what they do + autoPatchelfIgnoreMissingDeps = [ + "ACCAMERA.tx" + "AcMPolygonObj15.tx" + "ATEXT.tx" + "ISM.tx" + "RText.tx" + "SCENEOE.tx" + "TD_DbEntities.tx" + "TD_DbIO.tx" + "WipeOut.tx" + ]; + + installPhase = '' + runHook preInstall + + mkdir $out + cd $out + rpmextract $src + mv $out/usr/* $out + rm -r $out/usr + + runHook postInstall + ''; + + #--use-gl=egl for it to use hardware rendering it seems. Otherwise there are terrible framerates + postInstall = '' + substituteInPlace share/applications/Plasticity.desktop \ + --replace-fail 'Exec=Plasticity %U' "Exec=Plasticity --use-gl=egl %U" + ''; + + meta = with lib; { + description = "CAD for artists"; + homepage = "https://www.plasticity.xyz"; + mainProgram = "Plasticity"; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with maintainers; [ imadnyc ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/packages/toggleaudiosink.nix b/packages/toggleaudiosink.nix deleted file mode 100644 index 22e0d44..0000000 --- a/packages/toggleaudiosink.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - packages.toggleaudiosink = pkgs.writeShellScriptBin "toggleaudiosink" '' - #!/usr/bin/env bash - - sound_server="pipewire" - - # Grab a count of how many audio sinks we have - sink_count=$(${pkgs.pulseaudio}/bin/pactl list sinks | grep -c "Sink #[[:digit:]]") - # Create an array of the actual sink IDs - sinks=() - mapfile -t sinks < <(${pkgs.pulseaudio}/bin/pactl list sinks | grep 'Sink #[[:digit:]]' | sed -n -e 's/.*Sink #\([[:digit:]]\)/\1/p') - # Get the ID of the active sink - active_sink_name=$(${pkgs.pulseaudio}/bin/pactl info | grep 'Default Sink:' | sed -n -e 's/.*Default Sink:[[:space:]]\+\(.*\)/\1/p') - active_sink=$(${pkgs.pulseaudio}/bin/pactl list sinks | grep -B 2 "$active_sink_name" | sed -n -e 's/Sink #\([[:digit:]]\)/\1/p' | head -n 1) - - # Get the ID of the last sink in the array - final_sink=''${sinks[$((sink_count - 1))]} - - # Find the index of the active sink - for index in "''${!sinks[@]}"; do - if [[ "''${sinks[$index]}" == "$active_sink" ]]; then - active_sink_index=$index - fi - done - - # Default to the first sink in the list - next_sink=''${sinks[0]} - next_sink_index=0 - - # If we're not at the end of the list, move up the list - if [[ $active_sink -ne $final_sink ]]; then - next_sink_index=$((active_sink_index + 1)) - next_sink=''${sinks[$next_sink_index]} - fi - - # Change the default sink - # Get the name of the next sink - next_sink_name=$(${pkgs.pulseaudio}/bin/pactl list sinks | grep -C 2 "Sink #$next_sink" | sed -n -e 's/.*Name:[[:space:]]\+\(.*\)/\1/p' | head -n 1) - ${pkgs.pulseaudio}/bin/pactl set-default-sink "$next_sink_name" - - # Move all inputs to the new sink - for app in $(${pkgs.pulseaudio}/bin/pactl list sink-inputs | sed -n -e 's/.*Sink Input #\([[:digit:]]\)/\1/p'); do - ${pkgs.pulseaudio}/bin/pactl "move-sink-input $app $next_sink" - done - ''; - }; -} diff --git a/readme.md b/readme.md index e36ccec..f19ab12 100644 --- a/readme.md +++ b/readme.md @@ -1,73 +1,7 @@ -# NixOS Flake Configuration +All my personal Nix and NixOS hosts, in a flake. -Modular NixOS configuration using flake-parts with the [dendritic](https://github.com/gytis-ivaskevicius/dendritic) pattern. - -## Structure - -``` -. -├── aspects/ # Reusable NixOS/home-manager modules (dendritic) -│ ├── base/ # Base system configuration -│ ├── hosts/ # Host-specific configurations -│ │ ├── _alexandria/ -│ │ ├── _io/ -│ │ ├── _rotterdam/ -│ │ └── _trantor/ -│ ├── systems/ # System type modules (desktop, server, cli, gaming) -│ └── users/ # User account configurations -├── data/ # Shared host/service definitions -├── packages/ # Custom packages and overlays -├── shells/ # Shell configurations -└── terranix/ # Terraform configurations for cloud resources -``` - -## Hosts - -| Host | Architecture | Type | Description | -|------|--------------|------|-------------| -| trantor | aarch64-linux | server | ARM server running Forgejo | -| alexandria | x86_64-linux | server | x86 server (Kanidm, Vaultwarden, Nextcloud, Jellyfin) | -| rotterdam | x86_64-linux | desktop | Main workstation setup for gaming | -| io | x86_64-linux | desktop | Workstation | - -## Services - -- **git.baduhai.dev** (Forgejo) - Publicly accessible on trantor - -Other services (LAN/Tailscale only): Vaultwarden, Nextcloud, Jellyfin - -## Features - -- **Ephemeral root**: Automatic btrfs subvolume rollover with impermanence -- **Secrets**: Managed via agenix with age encryption -- **Disk management**: disko for declarative disk partitioning -- **Modular architecture**: Each aspect is a separate module imported via import-tree -- **Dendritic pattern**: Aspects are imported as a unified flake module - -## Building - -```bash -# Build specific host -nix build .#nixosConfigurations.trantor.config.system.build.toplevel - -# Rebuild host (if using nixos-cli on the host) -sudo nixos apply -``` - -## Terranix - -Terraform configurations for cloud infrastructure managed via terranix: - -- baduhai.dev DNS on CloudFlare -- VPS provisioning on OCI -- Tailscale subnet routers - -## Key Dependencies - -- nixpkgs (nixos-unstable for workstations, nixos for servers) -- home-manager -- agenix -- disko -- impermanence -- nix-flatpak -- nixos-cli +|Host|Description|Nixpkgs version| +|:---|:---:|---:| +|alexandria|Personal server/NAS|24.05| +|io|Mobile workstation|unstable| +|rotterdam|Workstation|unstable| diff --git a/secrets/cloudflare.age b/secrets/cloudflare.age index 028e964..a2ea31f 100644 Binary files a/secrets/cloudflare.age and b/secrets/cloudflare.age differ diff --git a/secrets/forgejo-root-password.age b/secrets/forgejo-root-password.age deleted file mode 100644 index 90be612..0000000 Binary files a/secrets/forgejo-root-password.age and /dev/null differ diff --git a/secrets/nextcloud-adminpass.age b/secrets/nextcloud-adminpass.age index b4a29fa..4adb2b1 100644 Binary files a/secrets/nextcloud-adminpass.age and b/secrets/nextcloud-adminpass.age differ diff --git a/secrets/nextcloud-secrets.json.age b/secrets/nextcloud-secrets.json.age index 02d170d..3860d4e 100644 Binary files a/secrets/nextcloud-secrets.json.age and b/secrets/nextcloud-secrets.json.age differ diff --git a/secrets/paperless.age b/secrets/paperless.age new file mode 100644 index 0000000..01199b7 --- /dev/null +++ b/secrets/paperless.age @@ -0,0 +1,13 @@ +age-encryption.org/v1 +-> ssh-ed25519 hi+lKA 3Oayrcg8bbzLNyuFqv8J0W9IJXL9SttFfU9yyysoD2Y +Uoxk9Ns1TwreeCyJ/7Euyqn57DY1spd6j3oZDqL65X0 +-> ssh-ed25519 SP9f6A FInq9erSMD008Le4Va/28fAPXnTLSWioYWsTBlkJg2k +SG9fEh+eLnUHcC36PHZbkD+pQVRX4RLJj1vxMeSKdNk +-> ssh-ed25519 8YSAiw hOqCc9a6K7RAwD1CY7uQ4se4mynx0z4AmoNhxmWJtQg +j+MYuftCyA7RDlzUciTxFyd/Esqzxpcm+ccKu4NNrmU +-> ssh-ed25519 3Chb7w oCX+CYB+fobvBy/5EcUJMxzwkwA+gQOY2tq17Ui68nw +B1feop9p1RDBXCyBCxIMZyd++QM2dnDrU12m6rwz5/4 +-> ssh-ed25519 J6tVTA PXVULNtK26OEKApHzOM2o6odRQNa9KbzjmAh2xgkHk4 +GLSEROgoiNVIVUhSpZWlg6q62GJHXRNsi1t7OwRw5MM +--- ddMx67t9wQFDJUlwFCDPvsUAR/JRUNweS28Erojuw8A +5/d}+cZM{-jo(UY{oa|˨~4xPހ \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index a90cd74..6feadc4 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -1,35 +1,28 @@ let - io-user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO3Y0PVpGfJHonqDS7qoCFhqzUvqGq9I9sax+F9e/5cs user@io"; - io = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCIrKJk5zWzWEHvLMPMK8T3PyeBjsCsqzxPN+OrXfhA root@io"; + io-user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKcwF1yuWEfYGScNocEbs0AmGxyTIzGc4/IhpU587SJE"; + io-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKCIrKJk5zWzWEHvLMPMK8T3PyeBjsCsqzxPN+OrXfhA"; + io = [ + io-user + io-host + ]; - rotterdam-user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL user@rotterdam"; - rotterdam = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjXcqQqlu03x2VVTdWOyxtKRszXAKX0AxTkGvF1oeJL root@rotterdam"; + rotterdam-user = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL"; + rotterdam-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK7zAxgU8LNi5/O5XgoOcLKjbNMmO2S7jAuCI9Nr/V4v"; + rotterdam = [ + rotterdam-user + rotterdam-host + ]; - alexandria = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK95QueW+jp1ZmF299Xr3XkgHJ6dL7aZVsfWxqbOKVKA root@alexandria"; + alexandria-host = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK95QueW+jp1ZmF299Xr3XkgHJ6dL7aZVsfWxqbOKVKA"; + alexandria = [ alexandria-host ]; - trantor = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIh/2u5pr/iPVeavlsor5hbTtsgUfP1JpzZVco2YQAo3 root@trantor"; + desktops = io ++ rotterdam; + servers = alexandria; + all-hosts = desktops ++ servers; in - { - "cloudflare.age".publicKeys = [ - io-user - rotterdam-user - alexandria - trantor - ]; - "nextcloud-adminpass.age".publicKeys = [ - io-user - rotterdam-user - alexandria - ]; - "nextcloud-secrets.json.age".publicKeys = [ - io-user - rotterdam-user - alexandria - ]; - "forgejo-root-password.age".publicKeys = [ - io-user - rotterdam-user - trantor - ]; + "nextcloud-secrets.json.age".publicKeys = all-hosts; + "nextcloud-adminpass.age".publicKeys = all-hosts; + "cloudflare.age".publicKeys = all-hosts; + "paperless.age".publicKeys = all-hosts; } diff --git a/shells/default.nix b/shells/default.nix deleted file mode 100644 index d9eb50b..0000000 --- a/shells/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ inputs, ... }: - -{ - perSystem = - { pkgs, system, ... }: - { - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - inputs.agenix.packages.${stdenv.hostPlatform.system}.default - nil - nixfmt - ]; - }; - }; -} diff --git a/terranix/baduhai.dev.nix b/terranix/baduhai.dev.nix deleted file mode 100644 index cea9f22..0000000 --- a/terranix/baduhai.dev.nix +++ /dev/null @@ -1,113 +0,0 @@ -# Required environment variables: -# CLOUDFLARE_API_TOKEN - API token with "Edit zone DNS" permissions -# AWS_ACCESS_KEY_ID - Cloudflare R2 access key for state storage -# AWS_SECRET_ACCESS_KEY - Cloudflare R2 secret key for state storage - -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - terranix.terranixConfigurations.cloudflare-baduhaidev = { - terraformWrapper.package = pkgs.opentofu; - modules = [ - ( - { config, lib, ... }: - - let - sharedData = import ../data/services.nix; - # Enrich services with host IPs - services = map ( - svc: - let - hostInfo = sharedData.hosts.${svc.host} or { }; - in - svc - // { - lanIP = hostInfo.lanIP or null; - tailscaleIP = hostInfo.tailscaleIP or null; - } - ) sharedData.services; - - # Helper to extract subdomain from full domain (e.g., "git.baduhai.dev" -> "git") - getSubdomain = domain: lib.head (lib.splitString "." domain); - - # Generate DNS records for services - # Public services point to trantor's public IP - # Private services point to their tailscale IP - mkServiceRecords = lib.listToAttrs ( - lib.imap0 ( - i: svc: - let - subdomain = getSubdomain svc.domain; - targetIP = - if svc.public or false then - config.data.terraform_remote_state.trantor "outputs.instance_public_ip" - else - svc.tailscaleIP; - in - { - name = "service_${toString i}"; - value = { - zone_id = config.variable.zone_id.default; - name = subdomain; - type = "A"; - content = targetIP; - proxied = false; - ttl = 3600; - }; - } - ) services - ); - in - - { - terraform.required_providers.cloudflare = { - source = "cloudflare/cloudflare"; - version = "~> 5.0"; - }; - - terraform.backend.s3 = { - bucket = "terraform-state"; - key = "cloudflare/baduhai.dev.tfstate"; - region = "auto"; - endpoint = "https://fcdf920bde00c3d013ee541f984da70e.r2.cloudflarestorage.com"; - skip_credentials_validation = true; - skip_metadata_api_check = true; - skip_region_validation = true; - skip_requesting_account_id = true; - use_path_style = true; - }; - - variable = { - zone_id = { - default = "c63a8332fdddc4a8e5612ddc54557044"; - type = "string"; - }; - }; - - data = { - terraform_remote_state.trantor = { - backend = "s3"; - config = { - bucket = "terraform-state"; - key = "oci/trantor.tfstate"; - region = "auto"; - endpoint = "https://fcdf920bde00c3d013ee541f984da70e.r2.cloudflarestorage.com"; - skip_credentials_validation = true; - skip_metadata_api_check = true; - skip_region_validation = true; - skip_requesting_account_id = true; - use_path_style = true; - }; - }; - }; - - resource.cloudflare_dns_record = mkServiceRecords; - } - ) - ]; - }; - }; -} diff --git a/terranix/kernelpanic.space.nix b/terranix/kernelpanic.space.nix deleted file mode 100644 index 91b615e..0000000 --- a/terranix/kernelpanic.space.nix +++ /dev/null @@ -1,20 +0,0 @@ -# Cloudflare kernelpanic.space configuration placeholder -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - terranix.terranixConfigurations.cloudflare-kernelpanicspace = { - terraformWrapper.package = pkgs.opentofu; - modules = [ - ( - { config, ... }: - { - # Terraform config goes here - } - ) - ]; - }; - }; -} diff --git a/terranix/tailnet.nix b/terranix/tailnet.nix deleted file mode 100644 index 4e01ab9..0000000 --- a/terranix/tailnet.nix +++ /dev/null @@ -1,57 +0,0 @@ -# Required environment variables: -# TAILSCALE_API_KEY - Tailscale API key with appropriate permissions -# TAILSCALE_TAILNET - Your tailnet name (e.g., "user@example.com" or "example.org.github") -# AWS_ACCESS_KEY_ID - Cloudflare R2 access key for state storage -# AWS_SECRET_ACCESS_KEY - Cloudflare R2 secret key for state storage - -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - terranix.terranixConfigurations.tailscale-tailnet = { - terraformWrapper.package = pkgs.opentofu; - modules = [ - ( - { config, ... }: - { - terraform.required_providers.tailscale = { - source = "tailscale/tailscale"; - version = "~> 0.17"; - }; - - terraform.backend.s3 = { - bucket = "terraform-state"; - key = "tailscale/tailnet.tfstate"; - region = "auto"; - endpoint = "https://fcdf920bde00c3d013ee541f984da70e.r2.cloudflarestorage.com"; - skip_credentials_validation = true; - skip_metadata_api_check = true; - skip_region_validation = true; - skip_requesting_account_id = true; - use_path_style = true; - }; - - variable = { - trantor_tailscale_ip = { - default = "100.108.5.90"; - type = "string"; - }; - }; - - resource = { - tailscale_dns_nameservers.global = { - nameservers = [ - config.variable.trantor_tailscale_ip.default - "1.1.1.1" - "1.0.0.1" - ]; - }; - }; - } - ) - ]; - }; - }; -} diff --git a/terranix/terminus.nix b/terranix/terminus.nix deleted file mode 100644 index d7689f9..0000000 --- a/terranix/terminus.nix +++ /dev/null @@ -1,20 +0,0 @@ -# OCI Terminus configuration placeholder -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - terranix.terranixConfigurations.oci-terminus = { - terraformWrapper.package = pkgs.opentofu; - modules = [ - ( - { config, ... }: - { - # Terraform config goes here - } - ) - ]; - }; - }; -} diff --git a/terranix/trantor.nix b/terranix/trantor.nix deleted file mode 100644 index 5f19e22..0000000 --- a/terranix/trantor.nix +++ /dev/null @@ -1,272 +0,0 @@ -# Required environment variables: -# instead of OCI variables, ~/.oci/config may also be used -# OCI_TENANCY_OCID - Oracle tenancy OCID (or use TF_VAR_* to override variables) -# OCI_USER_OCID - Oracle user OCID -# OCI_FINGERPRINT - API key fingerprint -# OCI_PRIVATE_KEY_PATH - Path to OCI API private key -# AWS variables are required -# AWS_ACCESS_KEY_ID - Cloudflare R2 access key for state storage -# AWS_SECRET_ACCESS_KEY - Cloudflare R2 secret key for state storage - -{ ... }: - -{ - perSystem = - { pkgs, ... }: - { - terranix.terranixConfigurations.oci-trantor = { - terraformWrapper.package = pkgs.opentofu; - modules = [ - ( - { config, ... }: - { - terraform.required_providers.oci = { - source = "oracle/oci"; - version = "~> 7.0"; - }; - - provider.oci.region = "sa-saopaulo-1"; - - terraform.backend.s3 = { - bucket = "terraform-state"; - key = "oci/trantor.tfstate"; - region = "auto"; - endpoint = "https://fcdf920bde00c3d013ee541f984da70e.r2.cloudflarestorage.com"; - skip_credentials_validation = true; - skip_metadata_api_check = true; - skip_region_validation = true; - skip_requesting_account_id = true; - use_path_style = true; - }; - - variable = { - tenancy_ocid = { - default = "ocid1.tenancy.oc1..aaaaaaaap3vfdz4piygqza6e6zqunbcuso43ddqfo3ydmpmnomidyghh7rvq"; - type = "string"; - }; - - compartment_name = { - default = "trantor"; - type = "string"; - }; - - vcn_cidr = { - default = "10.0.0.0/24"; - type = "string"; - }; - - instance_name = { - default = "trantor"; - type = "string"; - }; - - ssh_public_keys = { - default = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICQPkAyy+Du9Omc2WtnUF2TV8jFAF4H6mJi2D4IZ1nzg user@himalia" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO3Y0PVpGfJHonqDS7qoCFhqzUvqGq9I9sax+F9e/5cs user@io" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1v3+q3EaruiiStWjubEJWvtejam/r41uoOpCdwJtLL user@rotterdam" - ]; - type = "list(string)"; - }; - }; - - data = { - oci_identity_availability_domains.ads = { - compartment_id = config.variable.tenancy_ocid.default; - }; - - oci_core_images.ubuntu_arm = { - compartment_id = config.variable.tenancy_ocid.default; - operating_system = "Canonical Ubuntu"; - operating_system_version = "24.04"; - shape = "VM.Standard.A1.Flex"; - sort_by = "TIMECREATED"; - sort_order = "DESC"; - }; - }; - - resource = { - oci_identity_compartment.trantor = { - compartment_id = config.variable.tenancy_ocid.default; - description = "trantor infrastructure compartment"; - name = config.variable.compartment_name.default; - }; - - oci_core_vcn.vcn = { - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - cidr_blocks = [ config.variable.vcn_cidr.default ]; - display_name = "trantor-vcn"; - dns_label = "trantor"; - }; - - oci_core_internet_gateway.ig = { - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - vcn_id = config.resource.oci_core_vcn.vcn "id"; - display_name = "trantor-ig"; - enabled = true; - }; - - oci_core_route_table.rt = { - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - vcn_id = config.resource.oci_core_vcn.vcn "id"; - display_name = "trantor-rt"; - - route_rules = [ - { - network_entity_id = config.resource.oci_core_internet_gateway.ig "id"; - destination = "0.0.0.0/0"; - destination_type = "CIDR_BLOCK"; - } - ]; - }; - - oci_core_security_list.sl = { - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - vcn_id = config.resource.oci_core_vcn.vcn "id"; - display_name = "trantor-sl"; - - egress_security_rules = [ - { - destination = "0.0.0.0/0"; - protocol = "all"; - stateless = false; - } - ]; - - ingress_security_rules = [ - { - protocol = "6"; # TCP - source = "0.0.0.0/0"; - stateless = false; - tcp_options = { - min = 22; - max = 22; - }; - } - { - protocol = "6"; # TCP - source = "0.0.0.0/0"; - stateless = false; - tcp_options = { - min = 80; - max = 80; - }; - } - { - protocol = "6"; # TCP - source = "0.0.0.0/0"; - stateless = false; - tcp_options = { - min = 443; - max = 443; - }; - } - { - protocol = "6"; # TCP - source = "0.0.0.0/0"; - stateless = false; - tcp_options = { - min = 25565; - max = 25565; - }; - } - { - protocol = "6"; # TCP - source = "0.0.0.0/0"; - stateless = false; - tcp_options = { - min = 19132; - max = 19133; - }; - } - { - protocol = "17"; # UDP - source = "0.0.0.0/0"; - stateless = false; - udp_options = { - min = 19132; - max = 19133; - }; - } - ]; - }; - - oci_core_subnet.subnet = { - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - vcn_id = config.resource.oci_core_vcn.vcn "id"; - cidr_block = config.variable.vcn_cidr.default; - display_name = "trantor-subnet"; - dns_label = "subnet"; - route_table_id = config.resource.oci_core_route_table.rt "id"; - security_list_ids = [ (config.resource.oci_core_security_list.sl "id") ]; - prohibit_public_ip_on_vnic = false; - }; - - oci_core_instance.trantor = { - availability_domain = config.data.oci_identity_availability_domains.ads "availability_domains[0].name"; - compartment_id = config.resource.oci_identity_compartment.trantor "id"; - display_name = config.variable.instance_name.default; - shape = "VM.Standard.A1.Flex"; - - shape_config = { - ocpus = 2; - memory_in_gbs = 12; - }; - - source_details = { - source_type = "image"; - source_id = config.data.oci_core_images.ubuntu_arm "images[0].id"; - boot_volume_size_in_gbs = 100; - }; - - create_vnic_details = { - subnet_id = config.resource.oci_core_subnet.subnet "id"; - display_name = "trantor-vnic"; - assign_public_ip = true; - hostname_label = config.variable.instance_name.default; - }; - - metadata = { - ssh_authorized_keys = builtins.concatStringsSep "\n" config.variable.ssh_public_keys.default; - }; - - preserve_boot_volume = false; - }; - - oci_budget_budget.trantor_budget = { - compartment_id = config.variable.tenancy_ocid.default; - targets = [ (config.resource.oci_identity_compartment.trantor "id") ]; - amount = 1; - reset_period = "MONTHLY"; - display_name = "trantor-budget"; - description = "Monthly budget for trantor compartment"; - target_type = "COMPARTMENT"; - }; - - oci_budget_alert_rule.daily_spend_alert = { - budget_id = config.resource.oci_budget_budget.trantor_budget "id"; - type = "ACTUAL"; - threshold = 5; - threshold_type = "PERCENTAGE"; - display_name = "daily-spend-alert"; - recipients = "baduhai@proton.me"; - description = "Alert when daily spending exceeds $0.05"; - message = "Daily spending has exceeded $0.05 in the trantor compartment"; - }; - }; - - output = { - compartment_id = { - value = config.resource.oci_identity_compartment.trantor "id"; - }; - - instance_public_ip = { - value = config.resource.oci_core_instance.trantor "public_ip"; - }; - }; - } - ) - ]; - }; - }; -} diff --git a/users/common/default.nix b/users/common/default.nix new file mode 100644 index 0000000..a6eeaf4 --- /dev/null +++ b/users/common/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./home.nix + ./programs.nix + ]; +} diff --git a/users/common/home.nix b/users/common/home.nix new file mode 100644 index 0000000..5bafc2f --- /dev/null +++ b/users/common/home.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: + +{ + home = { + username = "user"; + homeDirectory = "/home/user"; + stateVersion = "22.05"; + sessionVariables = { + EDITOR = "hx"; + }; + packages = with pkgs; [ nix-your-shell ]; + }; +} diff --git a/users/common/programs.nix b/users/common/programs.nix new file mode 100644 index 0000000..1dc9390 --- /dev/null +++ b/users/common/programs.nix @@ -0,0 +1,156 @@ +{ pkgs, ... }: + +{ + programs = { + password-store.enable = true; + + bash = { + enable = true; + historyFile = "~/.cache/bash_history"; + }; + + helix = { + enable = true; + settings = { + editor = { + file-picker.hidden = false; + idle-timeout = 0; + line-number = "relative"; + cursor-shape = { + normal = "block"; + insert = "bar"; + select = "underline"; + }; + soft-wrap.enable = true; + auto-format = true; + indent-guides.render = true; + }; + keys.normal.space = { + space = "file_picker"; + w = ":w"; + q = ":q"; + esc = [ + "collapse_selection" + "keep_primary_selection" + ]; + }; + }; + languages = { + language = [ + { + name = "nix"; + auto-format = true; + formatter.command = "nixfmt"; + } + { + name = "typst"; + auto-format = true; + formatter.command = "typstyle -c 1000 -i"; + } + ]; + }; + }; + + direnv = { + enable = true; + nix-direnv.enable = true; + }; + + tmux = { + enable = true; + clock24 = true; + terminal = "xterm-256color"; + mouse = true; + keyMode = "vi"; + }; + + starship = { + enable = true; + enableBashIntegration = true; + enableFishIntegration = true; + settings = { + add_newline = false; + format = '' + $directory$git_branch$git_status$nix_shell + [ ❯ ](bold green) + ''; + right_format = "$cmd_duration$character"; + character = { + error_symbol = "[](red)"; + success_symbol = "[󱐋](green)"; + }; + cmd_duration = { + format = "[󰄉 $duration ]($style)"; + style = "yellow"; + min_time = 500; + }; + git_branch = { + symbol = " "; + style = "purple"; + }; + git_status.style = "red"; + nix_shell = { + format = "via [$symbol$state]($style)"; + heuristic = true; + style = "blue"; + symbol = "󱄅 "; + }; + }; + }; + + git = { + enable = true; + diff-so-fancy.enable = true; + userName = "William"; + userEmail = "baduhai@proton.me"; + }; + + btop = { + enable = true; + settings = { + theme_background = false; + proc_sorting = "cpu direct"; + update_ms = 500; + }; + }; + + fish = { + enable = true; + interactiveShellInit = "nix-your-shell fish | source"; + loginShellInit = "nix-your-shell fish | source"; + functions = { + fish_greeting = ""; + tsh = "ssh -o RequestTTY=yes $argv tmux -u -CC new -A -s tmux-main"; + }; + plugins = [ + { + name = "bang-bang"; + src = pkgs.fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-bang-bang"; + rev = "f969c618301163273d0a03d002614d9a81952c1e"; + sha256 = "sha256-A8ydBX4LORk+nutjHurqNNWFmW6LIiBPQcxS3x4nbeQ="; + }; + } + { + name = "z"; + src = pkgs.fetchFromGitHub { + owner = "jethrokuan"; + repo = "z"; + rev = "85f863f20f24faf675827fb00f3a4e15c7838d76"; + sha256 = "sha256-+FUBM7CodtZrYKqU542fQD+ZDGrd2438trKM0tIESs0="; + }; + } + { + name = "sponge"; + src = pkgs.fetchFromGitHub { + owner = "meaningful-ooo"; + repo = "sponge"; + rev = "384299545104d5256648cee9d8b117aaa9a6d7be"; + sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w="; + }; + } + ]; + }; + }; +} diff --git a/users/desktops/common/default.nix b/users/desktops/common/default.nix new file mode 100644 index 0000000..eb72910 --- /dev/null +++ b/users/desktops/common/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./programs.nix + ./hyprland.nix + ]; +} diff --git a/users/desktops/common/hyprland.nix b/users/desktops/common/hyprland.nix new file mode 100644 index 0000000..49bcd56 --- /dev/null +++ b/users/desktops/common/hyprland.nix @@ -0,0 +1,294 @@ +{ lib, pkgs, ... }: + +let + heightfittr = pkgs.writeShellApplication { + name = "heightfittr"; + runtimeInputs = with pkgs; [ + socat + hyprland + ]; + text = '' + function handle { + case "$1" in + *openwindow*) + hyprctl dispatch scroller:fitheight all > /dev/null + ;; + *closewindow*) + hyprctl dispatch scroller:fitheight all > /dev/null + ;; + esac + } + socat - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do + handle "$line" + done + ''; + }; + + scrollermodetoggle = pkgs.writeShellApplication { + name = "scrollermodetoggle"; + runtimeInputs = with pkgs; [ hyprland ]; + text = '' + if [ -f "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" ]; then + rm "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" + hyprctl --batch 'dispatch scroller:setmode row; notify 2 1000 0 "Row Mode"' + else + touch "$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/colmode" + hyprctl --batch 'dispatch scroller:setmode col; notify 2 1000 0 "Column Mode"' + fi + ''; + }; +in + +{ + wayland.windowManager.hyprland = { + enable = true; + plugins = with pkgs.hyprlandPlugins; [ hyprscroller ]; + extraConfig = '' + ################ + ### MONITORS ### + ################ + monitor=,preferred,auto,auto + + ################# + ### AUTOSTART ### + ################# + exec-once = ulauncher --hide-window + exec-once = ${lib.getExe heightfittr} + env = XCURSOR_SIZE,24 + env = HYPRCURSOR_SIZE,24 + + ##################### + ### LOOK AND FEEL ### + ##################### + general { + gaps_in = 5 + gaps_out = 20 + border_size = 2 + resize_on_border = true + allow_tearing = false + layout = scroller + } + misc { + font_family = Inter + } + plugin { + scroller { + column_default_width = onethird + focuswrap = false + column_widths = onethird onehalf twothirds + center_row_if_space_available = true + } + } + decoration { + rounding = 10 + rounding_power = 2 + dim_inactive = true + dim_strength = 0.3 + shadow { + enabled = true + range = 4 + render_power = 3 + } + blur { + enabled = true + size = 8 + passes = 1 + vibrancy = 0.1696 + } + } + animations { + enabled = yes, please :) + bezier = easeOutQuint,0.23,1,0.32,1 + bezier = easeInOutCubic,0.65,0.05,0.36,1 + bezier = linear,0,0,1,1 + bezier = almostLinear,0.5,0.5,0.75,1.0 + bezier = quick,0.15,0,0.1,1 + animation = global, 1, 1, default + animation = border, 1, 1, easeOutQuint + animation = windows, 1, 1, easeOutQuint + animation = windowsIn, 1, 1, easeOutQuint, popin 87% + animation = windowsOut, 1, 1, linear, popin 87% + animation = fadeIn, 1, 1, almostLinear + animation = fadeOut, 1, 1, almostLinear + animation = fade, 1, 1, quick + animation = layers, 1, 1, easeOutQuint + animation = layersIn, 1, 1, easeOutQuint, fade + animation = layersOut, 1, 1, linear, fade + animation = fadeLayersIn, 1, 1, almostLinear + animation = fadeLayersOut, 1, 1, almostLinear + animation = workspaces, 1, 1, almostLinear, slidevert + } + misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true + } + + ############# + ### INPUT ### + ############# + input { + kb_layout = us + kb_variant = altgr-intl + follow_mouse = 1 + sensitivity = 0 + accel_profile = flat + natural_scroll = true + touchpad { + natural_scroll = true + clickfinger_behavior = true + } + } + + ################### + ### KEYBINDINGS ### + ################### + $mainMod = SUPER + $terminal = ghostty + $menu = ulauncher-toggle + # APP SHORTCUTS + bind = ALT, SPACE, exec, $menu + bind = $mainMod, RETURN, exec, $terminal + # SESSION MANAGEMENT + bind = CTRL ALT, DELETE, exit, + bind = $mainMod, mouse_up, exec, hyprnome + bind = $mainMod, mouse_down, exec, hyprnome --previous + bind = CTRL ALT, j, exec, hyprnome + bind = CTRL ALT, k, exec, hyprnome --previous + bind = $mainMod CTRL ALT, j, exec, hyprnome --move + bind = $mainMod CTRL ALT, k, exec, hyprnome --move --previous + bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ + bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- + bindl = , XF86AudioNext, exec, playerctl next + bindl = , XF86AudioPause, exec, playerctl play-pause + bindl = , XF86AudioPlay, exec, playerctl play-pause + bindl = , XF86AudioPrev, exec, playerctl previous + bind = CTRL ALT SHIFT, a, exec, bash /home/user/.local/bin/toggle-audio-output.sh + # WINDOW MANAGEMENT + bind = ALT, F4, killactive, + bind = $mainMod, space, togglefloating, + bind = $mainMod, f, fullscreen + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + bind = SUPER, h, movefocus, l + bind = SUPER, l, movefocus, r + bind = SUPER, k, movefocus, u + bind = SUPER, j, movefocus, d + bind = $mainMod CTRL, h, movewindow, l + bind = $mainMod CTRL, l, movewindow, r + bind = $mainMod CTRL, k, movewindow, u + bind = $mainMod CTRL, j, movewindow, d + bind = $mainMod, v, exec, ${lib.getExe scrollermodetoggle} + bind = $mainMod, r, scroller:cyclewidth, next + bind = $mainMod CTRL, r, scroller:cyclewidth, prev + bind = $mainMod, p, scroller:pin, + bind = $mainMod, c, scroller:alignwindow, center + bind = $mainMod CTRL, f, scroller:fitsize, all + + #################### + ### WINDOW RULES ### + #################### + windowrulev2 = suppressevent maximize, class:.* + windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 + # ulauncher + windowrule = float, ulauncher + windowrule = pin, ulauncher + windowrule = noborder, ulauncher + windowrule = noshadow, ulauncher + windowrule = nomaxsize, ulauncher + windowrule = noblur, ulauncher + windowrulev2 = animation slide top, class:^(ulauncher)$ + # firefox + windowrulev2 = plugin:scroller:columnwidth onehalf, class:(firefox) + ''; + }; + + services = { + tritanium-shell = { + enable = true; + integrations.hyprland.enable = true; + settings = { + vertical = true; + animations.activeWorkspace = "smooth"; + minWorkspaces = 1; + lockCommand = "hyprlock"; + bar.modules.workspacesIndicator.reverseScrollDirection = true; + }; + }; + swaync = { + enable = true; + settings = { + positionX = "left"; + positionY = "top"; + layer = "overlay"; + control-center-layer = "top"; + layer-shell = true; + cssPriority = "application"; + control-center-margin-top = 20; + control-center-margin-bottom = 20; + control-center-margin-right = 20; + control-center-margin-left = 20; + notification-2fa-action = true; + notification-inline-replies = false; + notification-icon-size = 64; + notification-body-image-height = 100; + notification-body-image-width = 200; + timeout = 10; + timeout-low = 5; + timeout-critical = 0; + fit-to-screen = true; + relative-timestamps = true; + control-center-width = 500; + control-center-height = 600; + notification-window-width = 500; + keyboard-shortcuts = true; + image-visibility = "when-available"; + transition-time = 200; + hide-on-clear = false; + hide-on-action = true; + script-fail-notify = true; + widgets = [ + "inhibitors" + "title" + "dnd" + "notifications" + "mpris" + ]; + widget-config = { + inhibitors = { + text = "Inhibitors"; + button-text = "Clear All"; + clear-all-button = true; + }; + title = { + text = "Notifications"; + clear-all-button = true; + button-text = "Clear All"; + }; + dnd = { + text = "Do Not Disturb"; + }; + mpris = { + image-size = 96; + image-radius = 12; + }; + }; + }; + }; + }; + + programs = { + hyprlock.enable = true; + }; + + home.packages = with pkgs; [ + brightnessctl + hyprnome + playerctl + swaynotificationcenter + ulauncher + ]; +} diff --git a/users/desktops/common/programs.nix b/users/desktops/common/programs.nix new file mode 100644 index 0000000..f1e4665 --- /dev/null +++ b/users/desktops/common/programs.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + fonts.fontconfig.enable = true; + + programs = { + password-store.package = pkgs.pass-wayland; + + mangohud.enable = true; + + obs-studio = { + enable = true; + plugins = [ + pkgs.obs-studio-plugins.obs-vkcapture + pkgs.obs-studio-plugins.obs-backgroundremoval + pkgs.obs-studio-plugins.obs-pipewire-audio-capture + ]; + }; + + fish = { + functions = { + sysrebuild = "nh os switch --ask"; + sysrebuild-boot = "nh os boot --ask"; + sysupdate = "nix flake update --commit-lock-file --flake /home/user/Projects/personal/nix-config"; + }; + }; + }; +} diff --git a/users/desktops/user.nix b/users/desktops/user.nix new file mode 100644 index 0000000..80e1f3a --- /dev/null +++ b/users/desktops/user.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + # Host-common imports + ../common + # Desktop-common imports + ./common + ]; +} diff --git a/users/servers/user.nix b/users/servers/user.nix new file mode 100644 index 0000000..990167f --- /dev/null +++ b/users/servers/user.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + # Host-common imports + ../common + ]; +}