From 10a159f6bd93e2578d6a46d33a218942992b4544 Mon Sep 17 00:00:00 2001 From: isabel Date: Tue, 14 May 2024 11:08:41 +0100 Subject: [PATCH] style: formating --- docs/default.nix | 124 +++--- flake.lock | 59 +-- flake.nix | 2 +- home/default.nix | 16 +- home/isabel/configs/cli/atuin.nix | 8 +- home/isabel/configs/cli/bat.nix | 5 +- home/isabel/configs/cli/bellado.nix | 8 +- home/isabel/configs/cli/direnv.nix | 3 +- home/isabel/configs/cli/eza.nix | 6 +- home/isabel/configs/cli/fd.nix | 5 +- home/isabel/configs/cli/freeze.nix | 29 +- home/isabel/configs/cli/fzf.nix | 9 +- home/isabel/configs/cli/hyfetch.nix | 20 +- home/isabel/configs/cli/ripgrep.nix | 10 +- home/isabel/configs/cli/starship.nix | 6 +- home/isabel/configs/cli/tealdear.nix | 5 +- home/isabel/configs/cli/zoxide.nix | 6 +- home/isabel/configs/editors/extra.nix | 9 +- home/isabel/configs/editors/micro.nix | 5 +- home/isabel/configs/editors/neovim.nix | 8 +- .../isabel/configs/editors/vscode/default.nix | 12 +- home/isabel/configs/git/addons.nix | 3 +- home/isabel/configs/git/darwin.nix | 7 +- home/isabel/configs/git/gh-dash.nix | 4 +- home/isabel/configs/git/gh.nix | 5 +- home/isabel/configs/git/git.nix | 15 +- home/isabel/configs/git/lazygit.nix | 5 +- home/isabel/configs/gui/bars/ags/default.nix | 29 +- home/isabel/configs/gui/bars/eww/default.nix | 11 +- .../configs/gui/bars/waybar/default.nix | 64 ++- home/isabel/configs/gui/browsers/chromium.nix | 11 +- .../isabel/configs/gui/browsers/schizofox.nix | 19 +- home/isabel/configs/gui/discord.nix | 22 +- .../configs/gui/fileMangers/dolphin.nix | 7 +- home/isabel/configs/gui/fileMangers/nemo.nix | 3 +- .../isabel/configs/gui/fileMangers/thunar.nix | 5 +- home/isabel/configs/gui/launchers/rofi.nix | 213 +++++----- home/isabel/configs/gui/launchers/wofi.nix | 8 +- home/isabel/configs/gui/swaync.nix | 6 +- .../configs/gui/terminals/alacritty.nix | 7 +- home/isabel/configs/gui/terminals/ghostty.nix | 10 +- home/isabel/configs/gui/terminals/kitty.nix | 3 +- .../configs/gui/terminals/wezterm/default.nix | 33 +- home/isabel/configs/gui/viewnior.nix | 68 +-- home/isabel/configs/gui/zathura.nix | 3 +- home/isabel/configs/shell/bash.nix | 5 +- home/isabel/configs/shell/fish.nix | 14 +- home/isabel/configs/shell/nushell.nix | 386 +++++++++--------- home/isabel/configs/shell/zsh.nix | 3 +- home/isabel/configs/tui/btop.nix | 34 +- home/isabel/configs/tui/izrss.nix | 8 +- home/isabel/configs/tui/newsboat.nix | 45 +- home/isabel/configs/tui/ranger.nix | 32 +- home/isabel/configs/tui/yazi.nix | 3 +- home/isabel/configs/tui/zzz.nix | 10 +- home/isabel/configs/wm/hyprland/config.nix | 171 ++++---- home/isabel/configs/wm/hyprland/default.nix | 10 +- home/isabel/configs/wm/sway/config.nix | 37 +- home/isabel/configs/wm/sway/default.nix | 12 +- home/isabel/default.nix | 15 +- home/isabel/packages/cli/desktop.nix | 21 +- home/isabel/packages/cli/shared.nix | 13 +- home/isabel/packages/cli/wayland.nix | 3 +- home/isabel/packages/darwin/default.nix | 8 +- home/isabel/packages/gui/gaming/default.nix | 8 +- home/isabel/packages/gui/gaming/minecraft.nix | 39 +- home/isabel/packages/gui/shared.nix | 37 +- home/isabel/packages/gui/wayland.nix | 39 +- home/isabel/packages/pentesting.nix | 3 +- home/isabel/packages/scripts/default.nix | 42 +- home/isabel/packages/tui/default.nix | 3 +- home/isabel/services/shared/kdeconnect.nix | 10 +- home/isabel/services/shared/nextcloud.nix | 14 +- home/isabel/services/shared/nix-index.nix | 5 +- home/isabel/services/shared/rnnoise.nix | 18 +- home/isabel/services/shared/tray.nix | 19 +- home/isabel/services/wayland/clipboard.nix | 21 +- .../services/wayland/screenlock/gtklock.nix | 14 +- .../services/wayland/screenlock/swaylock.nix | 8 +- home/isabel/system/env.nix | 5 +- home/isabel/system/gpg.nix | 13 +- home/isabel/system/ssh.nix | 83 ++-- home/isabel/system/xdg.nix | 28 +- home/isabel/themes/global.nix | 8 +- home/isabel/themes/gtk.nix | 21 +- home/isabel/themes/qt.nix | 18 +- hosts/amaterasu/default.nix | 52 ++- hosts/amaterasu/hardware.nix | 2 +- hosts/default.nix | 110 ++--- hosts/hydra/default.nix | 12 +- hosts/hydra/hardware.nix | 2 +- hosts/luz/default.nix | 6 +- hosts/luz/overrides.nix | 7 +- hosts/valkyrie/default.nix | 7 +- modules/base/activation/default.nix | 35 +- modules/base/environment/fonts.nix | 38 +- modules/base/environment/vars.nix | 5 +- modules/base/nix/environment.nix | 12 +- modules/base/nix/nix.nix | 31 +- modules/base/nix/nixpkgs.nix | 7 +- modules/base/nix/system.nix | 10 +- modules/base/options/device/default.nix | 16 +- modules/base/options/environment/default.nix | 41 +- modules/base/options/programs/default.nix | 46 ++- modules/base/options/programs/defaults.nix | 62 ++- modules/base/options/programs/gaming.nix | 38 +- modules/base/options/services/default.nix | 45 +- modules/base/options/system/default.nix | 14 +- modules/base/options/themes/default.nix | 15 +- modules/base/options/themes/gtk.nix | 10 +- modules/base/options/themes/qt.nix | 12 +- modules/base/secrets.nix | 73 ++-- modules/base/users/isabel.nix | 70 ++-- modules/base/users/root.nix | 5 +- modules/darwin/activation.nix | 23 +- modules/darwin/brew/default.nix | 12 +- modules/darwin/brew/environment.nix | 5 +- modules/darwin/nix.nix | 5 +- modules/darwin/security/pam.nix | 4 +- modules/darwin/services/skhd.nix | 78 ++-- modules/darwin/services/yabai.nix | 44 +- modules/extra/darwin/default.nix | 2 +- modules/extra/home-manager/gtklock.nix | 36 +- modules/extra/home-manager/hyfetch.nix | 37 +- modules/extra/nixos/default.nix | 6 +- modules/extra/nixos/wakapi.nix | 42 +- modules/iso/boot.nix | 5 +- modules/iso/console.nix | 23 +- modules/iso/image.nix | 82 ++-- modules/iso/networking.nix | 7 +- modules/iso/nix.nix | 13 +- modules/iso/programs.nix | 3 +- modules/iso/space.nix | 8 +- modules/iso/users.nix | 2 +- modules/nixos/emulation.nix | 11 +- modules/nixos/encryption.nix | 12 +- modules/nixos/gaming/gamemode.nix | 23 +- modules/nixos/gaming/steam.nix | 86 ++-- modules/nixos/hardware/bluetooth.nix | 10 +- modules/nixos/hardware/cpu/amd.nix | 10 +- modules/nixos/hardware/cpu/intel.nix | 15 +- modules/nixos/hardware/default.nix | 3 +- modules/nixos/hardware/gpu/amd.nix | 12 +- modules/nixos/hardware/gpu/intel.nix | 12 +- modules/nixos/hardware/gpu/nvidia.nix | 33 +- modules/nixos/hardware/media/sound.nix | 10 +- modules/nixos/hardware/media/video.nix | 6 +- modules/nixos/hardware/tmp.nix | 10 +- modules/nixos/hardware/yubikey.nix | 5 +- modules/nixos/nix.nix | 7 +- modules/nixos/options/device/capabilities.nix | 6 +- modules/nixos/options/device/hardware.nix | 34 +- modules/nixos/options/system/boot.nix | 27 +- modules/nixos/options/system/default.nix | 29 +- modules/nixos/options/system/emulation.nix | 19 +- modules/nixos/options/system/encryption.nix | 30 +- modules/nixos/options/system/networking.nix | 21 +- modules/nixos/options/system/printing.nix | 8 +- modules/nixos/options/system/security.nix | 46 ++- .../nixos/options/system/virtualization.nix | 26 +- modules/nixos/os/boot/generic.nix | 31 +- modules/nixos/os/boot/loader/grub.nix | 10 +- modules/nixos/os/boot/loader/none.nix | 10 +- modules/nixos/os/boot/loader/systemd-boot.nix | 10 +- modules/nixos/os/boot/plymouth.nix | 8 +- modules/nixos/os/boot/secure-boot.nix | 10 +- modules/nixos/os/display/portals.nix | 16 +- .../nixos/os/display/wayland/environment.nix | 10 +- modules/nixos/os/display/wayland/hyprland.nix | 8 +- modules/nixos/os/display/wayland/services.nix | 8 +- modules/nixos/os/environment/console.nix | 5 +- modules/nixos/os/environment/locale.nix | 3 +- modules/nixos/os/environment/packages.nix | 7 +- modules/nixos/os/fs/default.nix | 26 +- modules/nixos/os/misc/documentation.nix | 6 +- modules/nixos/os/misc/realtime.nix | 7 +- modules/nixos/os/networking/blocker.nix | 6 +- modules/nixos/os/networking/default.nix | 10 +- .../nixos/os/networking/firewall/default.nix | 10 +- .../nixos/os/networking/firewall/fail2ban.nix | 17 +- .../nixos/os/networking/networkmanager.nix | 10 +- modules/nixos/os/networking/optimise.nix | 15 +- modules/nixos/os/networking/ssh.nix | 25 +- modules/nixos/os/networking/systemd.nix | 18 +- modules/nixos/os/networking/tailscale.nix | 16 +- modules/nixos/os/networking/tcpcrypt.nix | 12 +- modules/nixos/os/networking/wireless.nix | 6 +- modules/nixos/os/programs/default.nix | 6 +- modules/nixos/os/services/default.nix | 10 +- modules/nixos/os/services/systemd.nix | 5 +- modules/nixos/os/services/zram.nix | 10 +- modules/nixos/security/apparmor.nix | 7 +- modules/nixos/security/auditd.nix | 16 +- modules/nixos/security/clamav.nix | 54 ++- modules/nixos/security/kernel.nix | 16 +- modules/nixos/security/polkit.nix | 10 +- modules/nixos/security/selinux.nix | 15 +- modules/nixos/security/sudo.nix | 93 +++-- modules/nixos/services/blahaj.nix | 7 +- modules/nixos/services/databases/influxdb.nix | 10 +- modules/nixos/services/databases/mongodb.nix | 6 +- modules/nixos/services/databases/mysql.nix | 8 +- .../nixos/services/databases/postgresql.nix | 6 +- modules/nixos/services/databases/redis.nix | 10 +- modules/nixos/services/dev/atuin.nix | 22 +- modules/nixos/services/dev/forgejo.nix | 39 +- modules/nixos/services/dev/plausible.nix | 20 +- modules/nixos/services/dev/vscode-server.nix | 5 +- modules/nixos/services/dev/wakapi.nix | 34 +- modules/nixos/services/kanidm.nix | 24 +- modules/nixos/services/mailserver.nix | 67 +-- .../nixos/services/media/akkoma/blocklist.nix | 4 +- .../nixos/services/media/akkoma/default.nix | 38 +- modules/nixos/services/media/jellyfin.nix | 10 +- modules/nixos/services/media/matrix.nix | 47 +-- modules/nixos/services/media/nextcloud.nix | 16 +- modules/nixos/services/media/photoprism.nix | 10 +- .../monitoring/grafana/dashboards.nix | 31 +- .../services/monitoring/grafana/default.nix | 84 ++-- modules/nixos/services/monitoring/loki.nix | 12 +- .../nixos/services/monitoring/prometheus.nix | 100 +++-- .../nixos/services/monitoring/uptime-kuma.nix | 24 +- .../nixos/services/networking/cloudflared.nix | 12 +- .../nixos/services/networking/headscale.nix | 38 +- modules/nixos/services/networking/nginx.nix | 16 +- modules/nixos/services/vaultwarden.nix | 24 +- modules/nixos/services/vikunja.nix | 44 +- modules/nixos/services/website.nix | 16 +- modules/nixos/themes.nix | 5 +- modules/nixos/virtualization.nix | 27 +- modules/profiles/hardware/desktop/default.nix | 2 +- .../hardware/laptop/power/default.nix | 72 ++-- .../hardware/laptop/power/plugged.nix | 10 +- .../profiles/hardware/laptop/power/tlp.nix | 12 +- modules/profiles/hardware/server/default.nix | 6 +- .../hardware/server/users/default.nix | 6 +- .../profiles/hardware/server/users/git.nix | 12 +- modules/profiles/hardware/wsl/default.nix | 8 +- modules/profiles/meta/graphical/display.nix | 7 +- modules/profiles/meta/graphical/flatpak.nix | 2 +- .../profiles/meta/graphical/login/greetd.nix | 6 +- modules/profiles/meta/graphical/login/pam.nix | 28 +- modules/profiles/meta/graphical/misc.nix | 3 +- .../meta/graphical/programs/ccache.nix | 73 ++-- .../profiles/meta/graphical/programs/cli.nix | 21 +- .../profiles/meta/graphical/programs/gui.nix | 3 +- .../profiles/meta/graphical/programs/xdg.nix | 6 +- .../meta/graphical/security/polkit.nix | 12 +- .../profiles/meta/graphical/security/tor.nix | 5 +- .../meta/graphical/services/earlyoom.nix | 3 +- .../meta/graphical/services/gnome.nix | 9 +- .../meta/graphical/services/location.nix | 16 +- .../profiles/meta/graphical/services/misc.nix | 11 +- .../meta/graphical/services/printing.nix | 6 +- .../meta/graphical/services/runners.nix | 24 +- .../meta/graphical/services/systemd.nix | 40 +- modules/profiles/meta/graphical/xserver.nix | 7 +- .../profiles/meta/headless/documentation.nix | 6 +- modules/profiles/meta/headless/fonts.nix | 19 +- modules/profiles/meta/headless/xdg.nix | 6 +- parts/args.nix | 27 +- parts/lib/builders.nix | 160 ++++---- parts/lib/default.nix | 5 +- parts/lib/hardware.nix | 20 +- parts/lib/helpers.nix | 74 ++-- parts/lib/import.nix | 38 +- parts/lib/services.nix | 18 +- parts/lib/template/default.nix | 6 +- parts/lib/template/xdg.nix | 24 +- parts/lib/validators.nix | 25 +- parts/modules/default.nix | 12 +- parts/overlays/btop.nix | 8 +- parts/overlays/default.nix | 20 +- parts/overlays/fish.nix | 8 +- parts/overlays/ranger.nix | 8 +- parts/pkgs/default.nix | 51 +-- parts/pkgs/emojis.nix | 4 +- parts/pkgs/fork-cleaner.nix | 59 +-- parts/pkgs/gh-eco.nix | 49 +-- parts/pkgs/headscale-ui.nix | 4 +- parts/pkgs/pace.nix | 53 +-- parts/pkgs/patched-gjs.nix | 229 +++++------ parts/programs/formatter.nix | 51 +-- parts/programs/pre-commit.nix | 97 ++--- parts/programs/shell.nix | 59 +-- parts/templates/c/default.nix | 4 +- parts/templates/c/flake.nix | 32 +- parts/templates/c/shell.nix | 23 +- parts/templates/default.nix | 13 +- parts/templates/go/default.nix | 7 +- parts/templates/go/flake.nix | 32 +- parts/templates/go/shell.nix | 21 +- parts/templates/latex/default.nix | 3 +- parts/templates/latex/flake.nix | 32 +- parts/templates/latex/shell.nix | 38 +- parts/templates/node/default.nix | 5 +- parts/templates/node/flake.nix | 32 +- parts/templates/node/shell.nix | 31 +- parts/templates/python/default.nix | 6 +- parts/templates/python/flake.nix | 32 +- parts/templates/python/shell.nix | 9 +- parts/templates/rust/default.nix | 2 +- parts/templates/rust/flake.nix | 32 +- parts/templates/rust/shell.nix | 23 +- secrets/secrets.nix | 14 +- 305 files changed, 3994 insertions(+), 3258 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 58031727c..7eb7d3ba5 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,13 +1,20 @@ -# modfied from https://github.com/nekowinston/nur/blob/49cfefd3c252f4c56725df01f817d1a8b93447d8/docs/default.nix +# modified from https://github.com/nekowinston/nur/blob/49cfefd3c252f4c56725df01f817d1a8b93447d8/docs/default.nix { lib, pkgs, self, ... -}: let - inherit (lib) mkForce filterAttrs scrubDerivations removePrefix; - - mkEval = module: +}: +let + inherit (lib) + mkForce + filterAttrs + scrubDerivations + removePrefix + ; + + mkEval = + module: lib.evalModules { modules = [ module @@ -18,7 +25,9 @@ }; } ]; - specialArgs = {inherit pkgs;}; + specialArgs = { + inherit pkgs; + }; }; gitHubDeclaration = user: repo: subpath: { @@ -26,24 +35,29 @@ name = subpath; }; - mkDoc = name: options: let - doc = pkgs.nixosOptionsDoc { - options = filterAttrs (n: _: n != "_module") options; - documentType = "none"; - transformOptions = opt: - opt - // { - declarations = - map - (decl: - if lib.hasPrefix (toString ../.) (toString decl) - then gitHubDeclaration "isabelroses" "dotfiles" (removePrefix "/" (removePrefix (toString ../.) (toString decl))) - else decl) - opt.declarations; - }; - }; - in - pkgs.runCommand "${name}-module-doc.md" {} '' + mkDoc = + name: options: + let + doc = pkgs.nixosOptionsDoc { + options = filterAttrs (n: _: n != "_module") options; + documentType = "none"; + transformOptions = + opt: + opt + // { + declarations = map ( + decl: + if lib.hasPrefix (toString ../.) (toString decl) then + gitHubDeclaration "isabelroses" "dotfiles" ( + removePrefix "/" (removePrefix (toString ../.) (toString decl)) + ) + else + decl + ) opt.declarations; + }; + }; + in + pkgs.runCommand "${name}-module-doc.md" { } '' cat >$out <> $out ''; - pkgs-list = pkgs.runCommand "package-list.md" {} '' + pkgs-list = pkgs.runCommand "package-list.md" { } '' cat >$out <> $out ''; - convert = md: - pkgs.runCommand "isabelroses-dotfiles.html" {nativeBuildInputs = with pkgs; [pandoc texinfo];} '' - mkdir $out - - pandoc \ - --from markdown \ - --to texinfo \ - -o file.texi \ - ${builtins.concatStringsSep " " md} - - sed -i "s/@top Top/@top isabelroses' modules/" file.texi - - texi2any ./file.texi \ - --html \ - --split=chapter \ - --css-include=${./pandoc.css} \ - --document-language=en \ - -o $out - - substituteInPlace $out/index.html --replace-quiet "Top (isabelroses’ modules)" "isabelroses’ modules" - ''; + convert = + md: + pkgs.runCommand "isabelroses-dotfiles.html" + { + nativeBuildInputs = with pkgs; [ + pandoc + texinfo + ]; + } + '' + mkdir $out + + pandoc \ + --from markdown \ + --to texinfo \ + -o file.texi \ + ${builtins.concatStringsSep " " md} + + sed -i "s/@top Top/@top isabelroses' modules/" file.texi + + texi2any ./file.texi \ + --html \ + --split=chapter \ + --css-include=${./pandoc.css} \ + --document-language=en \ + -o $out + + substituteInPlace $out/index.html --replace-quiet "Top (isabelroses’ modules)" "isabelroses’ modules" + ''; modulesPath = ../modules; extraModulesPath = modulesPath + /extra; @@ -102,8 +124,14 @@ nixos = mkDoc "nixos" nixosEval.options; darwin = mkDoc "darwin" darwinEval.options; hm = mkDoc "home-manager" hmEval.options; -in { - html = convert [pkgs-list nixos darwin hm]; +in +{ + html = convert [ + pkgs-list + nixos + darwin + hm + ]; md = pkgs.linkFarm "md" [ { diff --git a/flake.lock b/flake.lock index 494596b24..13c572bb0 100644 --- a/flake.lock +++ b/flake.lock @@ -123,11 +123,11 @@ }, "catppuccin": { "locked": { - "lastModified": 1715210854, - "narHash": "sha256-88jxvd+LIP/XwlvJ3+QPbGCFMChmBfIbUNp1mEP9DJY=", + "lastModified": 1715659881, + "narHash": "sha256-emodPGTXLVqlcOkqbJiOUkf5vo8WWujgzKxms1B+iBs=", "owner": "catppuccin", "repo": "nix", - "rev": "e5322f7b4001aa8aab38ca5a0f42cafc590f42b6", + "rev": "d6344610c04af0f8e315fef45dd3b854014b119e", "type": "github" }, "original": { @@ -277,11 +277,11 @@ ] }, "locked": { - "lastModified": 1713946171, - "narHash": "sha256-lc75rgRQLdp4Dzogv5cfqOg6qYc5Rp83oedF2t0kDp8=", + "lastModified": 1715653378, + "narHash": "sha256-6kbg/PI3+SBP17f4T0js3CBsMLVtlD0JqJhDKgzk1mQ=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "230a197063de9287128e2c68a7a4b0cd7d0b50a7", + "rev": "de8b0d60d6fd34f35abffc46adc94ebaa6996ce2", "type": "github" }, "original": { @@ -834,11 +834,11 @@ ] }, "locked": { - "lastModified": 1715597781, - "narHash": "sha256-RhXiMnfkAL78kJIhjQ33YiLOaqHpLk2ugFL4Jgifim8=", + "lastModified": 1715626263, + "narHash": "sha256-cYMlJIALgVRlPqdKSKAdtN//lUXGh8ZsyH4weCTR71M=", "owner": "isabelroses", "repo": "izrss", - "rev": "c3ff416403e5f39f06f294f57e8b7417810157ed", + "rev": "78d1c3435f1af41cbdf71804ef1c69c7701b30dc", "type": "github" }, "original": { @@ -867,11 +867,11 @@ ] }, "locked": { - "lastModified": 1715440806, - "narHash": "sha256-f28X3j26+NedJjUQhDRf/J951n6a95oHeAstoNii7s8=", + "lastModified": 1715680975, + "narHash": "sha256-9deWDnPthSeY+Yr7wdNa/MA04lD0e2plaMwMho+GDw4=", "owner": "isabelroses", "repo": "nvim", - "rev": "c71c2a5e06c45391821e04b4180aec1ceab4269b", + "rev": "a2ba49efc22b276375112fa9003fc96925538b8a", "type": "github" }, "original": { @@ -950,11 +950,11 @@ ] }, "locked": { - "lastModified": 1715497678, - "narHash": "sha256-LpFzIbmxErjLiCW05eGu0Pz9l2jjLsszhvJ/yacxOMU=", + "lastModified": 1715670216, + "narHash": "sha256-o92J+onY44WTOAVXApWAphON4HCLKn7lM0YHDKHkSp8=", "owner": "nekowinston", "repo": "nur", - "rev": "6f9bfd16fdb78c648021f8ddfb48d9826aa60dff", + "rev": "7909bab3c6cd07d61bb3c8aa3c9fd6d8f177c0d8", "type": "github" }, "original": { @@ -974,11 +974,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1715116984, - "narHash": "sha256-NN8sR2ZS8ER/6kBUtBpejlEtL1UXdfwebpuXpI/WTlg=", + "lastModified": 1715601639, + "narHash": "sha256-ppixh//67UGy7/a1SmWixrOs9b95fzXq8nek2s3UYiI=", "owner": "neovim", "repo": "neovim", - "rev": "17c89eac1a384aaf9956ed75e60295aba8c78d01", + "rev": "e3ec974324bd73b63f54503480a4e48d1887f8d9", "type": "github" }, "original": { @@ -1006,11 +1006,11 @@ ] }, "locked": { - "lastModified": 1715127110, - "narHash": "sha256-/KaSqRJwzwNVQg9qP6nTjpUWL0OXbSwq/PXnZpuzOOY=", + "lastModified": 1715645016, + "narHash": "sha256-BFn9dwbzoQ+F/vyU5LbV3Ypfvujjry3oFuH8/DenDD8=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "e21cf2417abf1d766d1141bc0289f9995615b5c5", + "rev": "751a2db94031f9a383707d5cd7eb2c8d6b36028d", "type": "github" }, "original": { @@ -1036,15 +1036,16 @@ ] }, "locked": { - "lastModified": 1710401770, - "narHash": "sha256-VSQOXBNhtStokN2SPuZYml7qfqUUem1GD4WysRF+ITI=", - "owner": "willruggiano", + "lastModified": 1713535889, + "narHash": "sha256-Hr6/nhqJZLbmkDWa57F0NXmAK1azDOyppIvBB8SSPIQ=", + "owner": "nekowinston", "repo": "neovim.nix", - "rev": "724908713f909821e4eb4229b14175662a294c7e", + "rev": "e4717ef5ac7548edca7b483c0ffb96f1566f603a", "type": "github" }, "original": { - "owner": "willruggiano", + "owner": "nekowinston", + "ref": "feat/add-pluginspec-main-field", "repo": "neovim.nix", "type": "github" } @@ -1346,11 +1347,11 @@ ] }, "locked": { - "lastModified": 1715566659, - "narHash": "sha256-OpI0TnN+uE0vvxjPStlTzf5RTohIXVSMwrP9NEgMtaY=", + "lastModified": 1715652909, + "narHash": "sha256-aCLEDvzL1j51Rf2mCFOqK1mieMO3pAn5ItCIdr5h2LA=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "6c465248316cd31502c82f81f1a3acf2d621b01c", + "rev": "1d8fcbbfcfd3476c2665384a46ee9d07ef2b4dd9", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a94838ded..ecdefa51a 100755 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Isabel's dotfiles"; - outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} {imports = [./parts];}; + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = [ ./parts ]; }; inputs = { # choose our nixpkgs version diff --git a/home/default.nix b/home/default.nix index 93e168190..50e90f837 100644 --- a/home/default.nix +++ b/home/default.nix @@ -6,15 +6,25 @@ inputs, inputs', ... -}: let +}: +let inherit (config.modules.programs) defaults; -in { +in +{ home-manager = { verbose = true; useUserPackages = true; useGlobalPkgs = true; backupFileExtension = "bak"; - extraSpecialArgs = {inherit inputs self inputs' self' defaults;}; + extraSpecialArgs = { + inherit + inputs + self + inputs' + self' + defaults + ; + }; users = lib.genAttrs config.modules.system.users (name: ./${name}); }; } diff --git a/home/isabel/configs/cli/atuin.nix b/home/isabel/configs/cli/atuin.nix index f75b621e3..e341ccab8 100644 --- a/home/isabel/configs/cli/atuin.nix +++ b/home/isabel/configs/cli/atuin.nix @@ -3,9 +3,11 @@ config, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { +in +{ programs.atuin = mkIf (isModernShell osConfig) { enable = true; @@ -14,7 +16,7 @@ in { enableZshIntegration = config.programs.zsh.enable; enableNushellIntegration = config.programs.nushell.enable; - flags = ["--disable-up-arrow"]; + flags = [ "--disable-up-arrow" ]; settings = { dialect = "uk"; show_preview = true; diff --git a/home/isabel/configs/cli/bat.nix b/home/isabel/configs/cli/bat.nix index 30fae0f77..d812c9c27 100644 --- a/home/isabel/configs/cli/bat.nix +++ b/home/isabel/configs/cli/bat.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { programs.bat = lib.mkIf (lib.isModernShell osConfig) { # We activate it like this so that catppuccin is applied enable = true; diff --git a/home/isabel/configs/cli/bellado.nix b/home/isabel/configs/cli/bellado.nix index c91d74333..8908753c9 100644 --- a/home/isabel/configs/cli/bellado.nix +++ b/home/isabel/configs/cli/bellado.nix @@ -3,10 +3,12 @@ inputs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { - imports = [inputs.bellado.homeManagerModules.default]; +in +{ + imports = [ inputs.bellado.homeManagerModules.default ]; config = mkIf (isModernShell osConfig) { programs.bellado = { diff --git a/home/isabel/configs/cli/direnv.nix b/home/isabel/configs/cli/direnv.nix index 29ca15322..a17a23ffe 100644 --- a/home/isabel/configs/cli/direnv.nix +++ b/home/isabel/configs/cli/direnv.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ programs.direnv = lib.mkIf pkgs.stdenv.isDarwin { enable = true; nix-direnv.enable = true; diff --git a/home/isabel/configs/cli/eza.nix b/home/isabel/configs/cli/eza.nix index 8887915bc..1b7987bb2 100644 --- a/home/isabel/configs/cli/eza.nix +++ b/home/isabel/configs/cli/eza.nix @@ -3,9 +3,11 @@ config, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { +in +{ programs.eza = mkIf (isModernShell osConfig) { enable = true; icons = true; diff --git a/home/isabel/configs/cli/fd.nix b/home/isabel/configs/cli/fd.nix index 9b103c324..3609d2c8b 100644 --- a/home/isabel/configs/cli/fd.nix +++ b/home/isabel/configs/cli/fd.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { programs.fd = lib.mkIf (lib.isModernShell osConfig) { enable = true; diff --git a/home/isabel/configs/cli/freeze.nix b/home/isabel/configs/cli/freeze.nix index 278ae95ff..83e5a0bbe 100644 --- a/home/isabel/configs/cli/freeze.nix +++ b/home/isabel/configs/cli/freeze.nix @@ -3,20 +3,20 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { +in +{ config = mkIf (isModernShell osConfig) { home.packages = [ - ( - pkgs.symlinkJoin { - name = "freeze"; - paths = with pkgs; [ - charm-freeze - librsvg - ]; - } - ) + (pkgs.symlinkJoin { + name = "freeze"; + paths = with pkgs; [ + charm-freeze + librsvg + ]; + }) ]; xdg.configFile."freeze/user.json".text = builtins.toJSON { @@ -25,7 +25,12 @@ in { window = true; shadow = false; - padding = [20 40 20 20]; + padding = [ + 20 + 40 + 20 + 20 + ]; margin = 0; line_height = 1.2; diff --git a/home/isabel/configs/cli/fzf.nix b/home/isabel/configs/cli/fzf.nix index f5aba6311..349eda43f 100644 --- a/home/isabel/configs/cli/fzf.nix +++ b/home/isabel/configs/cli/fzf.nix @@ -4,7 +4,8 @@ config, osConfig, ... -}: { +}: +{ programs.fzf = lib.mkIf (lib.isModernShell osConfig) { enable = true; enableBashIntegration = config.programs.bash.enable; @@ -12,6 +13,10 @@ enableFishIntegration = config.programs.fish.enable; defaultCommand = "${lib.getBin pkgs.fd}/bin/fd --type=f --hidden --exclude=.git"; - defaultOptions = ["--height=30%" "--layout=reverse" "--info=inline"]; + defaultOptions = [ + "--height=30%" + "--layout=reverse" + "--info=inline" + ]; }; } diff --git a/home/isabel/configs/cli/hyfetch.nix b/home/isabel/configs/cli/hyfetch.nix index ecccd2f92..7866be60f 100644 --- a/home/isabel/configs/cli/hyfetch.nix +++ b/home/isabel/configs/cli/hyfetch.nix @@ -3,11 +3,13 @@ pkgs, self, ... -}: let +}: +let inherit (lib) ldTernary; -in { - imports = [self.homeManagerModules.hyfetch]; - disabledModules = ["programs/hyfetch.nix"]; +in +{ + imports = [ self.homeManagerModules.hyfetch ]; + disabledModules = [ "programs/hyfetch.nix" ]; programs.hyfetch = { enable = true; @@ -19,12 +21,12 @@ in { lightness = 0.56; color_align = { mode = "horizontal"; - custom_colors = []; + custom_colors = [ ]; fore_back = null; }; backend = "neofetch"; distro = null; - pride_month_shown = []; + pride_month_shown = [ ]; pride_month_disable = false; }; @@ -60,8 +62,10 @@ in { bold="off" separator="" - image_backend="ascii" # ascii kitty iterm2 - image_source=${ldTernary pkgs "/home/isabel/media/pictures" "/Users/isabel/Pictures"}/pfps/avatar # auto /path/to/img /path/to/ascii + image_backend="ascii" + image_source=${ + ldTernary pkgs "/home/isabel/media/pictures" "/Users/isabel/Pictures" + }/pfps/avatar # auto /path/to/img /path/to/ascii image_size="200px" # auto 00px 00% none ascii_distro=${ldTernary pkgs "NixOS" "Mac"}_small diff --git a/home/isabel/configs/cli/ripgrep.nix b/home/isabel/configs/cli/ripgrep.nix index a26fb5fe6..251bb8f26 100644 --- a/home/isabel/configs/cli/ripgrep.nix +++ b/home/isabel/configs/cli/ripgrep.nix @@ -1,10 +1,8 @@ -{ - lib, - osConfig, - ... -}: let +{ lib, osConfig, ... }: +let inherit (lib) mkIf isModernShell; -in { +in +{ programs.ripgrep = mkIf (isModernShell osConfig) { enable = true; diff --git a/home/isabel/configs/cli/starship.nix b/home/isabel/configs/cli/starship.nix index 2953a1de2..91f8ae58a 100644 --- a/home/isabel/configs/cli/starship.nix +++ b/home/isabel/configs/cli/starship.nix @@ -3,7 +3,8 @@ config, osConfig, ... -}: let +}: +let ss = symbol: style: { inherit symbol; format = "[$symbol ](${style})"; @@ -12,7 +13,8 @@ inherit symbol; format = "via [$symbol](${style})"; }; -in { +in +{ programs.starship = { inherit (osConfig.modules.programs.cli) enable; enableBashIntegration = config.programs.bash.enable; diff --git a/home/isabel/configs/cli/tealdear.nix b/home/isabel/configs/cli/tealdear.nix index afbad0f07..df7aaf9a7 100644 --- a/home/isabel/configs/cli/tealdear.nix +++ b/home/isabel/configs/cli/tealdear.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { programs.tealdeer = lib.mkIf (lib.isModernShell osConfig) { enable = true; settings = { diff --git a/home/isabel/configs/cli/zoxide.nix b/home/isabel/configs/cli/zoxide.nix index 5f5e4bec1..c39e9d1ea 100644 --- a/home/isabel/configs/cli/zoxide.nix +++ b/home/isabel/configs/cli/zoxide.nix @@ -3,9 +3,11 @@ config, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { +in +{ programs.zoxide = mkIf (isModernShell osConfig) { enable = true; enableBashIntegration = config.programs.bash.enable; diff --git a/home/isabel/configs/editors/extra.nix b/home/isabel/configs/editors/extra.nix index 46ad10fdf..603f7a2a8 100644 --- a/home/isabel/configs/editors/extra.nix +++ b/home/isabel/configs/editors/extra.nix @@ -3,10 +3,13 @@ pkgs, osConfig, ... -}: let +}: +let cfg = osConfig.modules.programs; -in { - home.packages = with pkgs; +in +{ + home.packages = + with pkgs; lib.optionals cfg.gui.enable [ jetbrains.idea-ultimate # eww java # arduino # thank god I don't have to use this anymore diff --git a/home/isabel/configs/editors/micro.nix b/home/isabel/configs/editors/micro.nix index 58729c9f5..18c786ebd 100644 --- a/home/isabel/configs/editors/micro.nix +++ b/home/isabel/configs/editors/micro.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { config = lib.mkIf osConfig.modules.programs.agnostic.editors.micro.enable { programs.micro = { enable = true; diff --git a/home/isabel/configs/editors/neovim.nix b/home/isabel/configs/editors/neovim.nix index 7aae9ba28..1f79be17e 100644 --- a/home/isabel/configs/editors/neovim.nix +++ b/home/isabel/configs/editors/neovim.nix @@ -3,9 +3,11 @@ inputs', osConfig, ... -}: let +}: +let cfg = osConfig.modules.programs; -in { +in +{ # need this one for uni - home.packages = lib.optionals cfg.agnostic.editors.neovim.enable [inputs'.izvim.packages.default]; + home.packages = lib.optionals cfg.agnostic.editors.neovim.enable [ inputs'.izvim.packages.default ]; } diff --git a/home/isabel/configs/editors/vscode/default.nix b/home/isabel/configs/editors/vscode/default.nix index 867d6926f..7258ad6df 100644 --- a/home/isabel/configs/editors/vscode/default.nix +++ b/home/isabel/configs/editors/vscode/default.nix @@ -4,7 +4,8 @@ config, osConfig, ... -}: let +}: +let inherit (pkgs.stdenv) isLinux isDarwin; inherit (lib) mkIf; @@ -13,7 +14,8 @@ vscodeStore = "${osConfig.modules.environment.flakePath}/home/${osConfig.modules.system.mainUser}/configs/editors/vscode"; keybindingsFile = mkLink "${vscodeStore}/keybindings.json"; settingsFile = mkLink "${vscodeStore}/settings.json"; -in { +in +{ config = mkIf osConfig.modules.programs.agnostic.editors.vscode.enable { programs.vscode = { enable = true; @@ -29,8 +31,8 @@ in { extraBordersEnabled = false; workbenchMode = "flat"; bracketMode = "rainbow"; - colorOverrides = {}; - customUIColors = {}; + colorOverrides = { }; + customUIColors = { }; }) # GIT @@ -43,7 +45,7 @@ in { # UTILITIES ms-vscode-remote.remote-ssh ms-vscode.live-server - vscodevim.vim #yes i hate myself + vscodevim.vim # yes i hate myself wakatime.vscode-wakatime # LANGUAGES BASED EXTENSIONS diff --git a/home/isabel/configs/git/addons.nix b/home/isabel/configs/git/addons.nix index a702fc2cf..7f41e858f 100644 --- a/home/isabel/configs/git/addons.nix +++ b/home/isabel/configs/git/addons.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ home.packages = with pkgs; [ gist # manage github gists # act # local github actions - littrally does not work diff --git a/home/isabel/configs/git/darwin.nix b/home/isabel/configs/git/darwin.nix index e15ed3d3e..02578cc8a 100644 --- a/home/isabel/configs/git/darwin.nix +++ b/home/isabel/configs/git/darwin.nix @@ -1,12 +1,9 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { # `programs.git` will generate the config file: ~/.config/git/config # to make git use this config file, `~/.gitconfig` should not exist! config.home.activation = lib.mkIf pkgs.stdenv.isDarwin { - removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + removeExistingGitconfig = lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' rm -f ~/.gitconfig ''; }; diff --git a/home/isabel/configs/git/gh-dash.nix b/home/isabel/configs/git/gh-dash.nix index 6f2728a96..e590d20e5 100644 --- a/home/isabel/configs/git/gh-dash.nix +++ b/home/isabel/configs/git/gh-dash.nix @@ -1,4 +1,2 @@ # required for catppuccin nix -{ - programs.gh-dash.enable = true; -} +{ programs.gh-dash.enable = true; } diff --git a/home/isabel/configs/git/gh.nix b/home/isabel/configs/git/gh.nix index 21dfe9d3f..a4518ea79 100644 --- a/home/isabel/configs/git/gh.nix +++ b/home/isabel/configs/git/gh.nix @@ -1,8 +1,5 @@ +{ pkgs, self', ... }: { - pkgs, - self', - ... -}: { programs.gh = { enable = true; gitCredentialHelper.enable = true; diff --git a/home/isabel/configs/git/git.nix b/home/isabel/configs/git/git.nix index 4b9493f0f..2fbde9338 100644 --- a/home/isabel/configs/git/git.nix +++ b/home/isabel/configs/git/git.nix @@ -1,10 +1,8 @@ -{ - pkgs, - osConfig, - ... -}: let +{ pkgs, osConfig, ... }: +let cfg = osConfig.modules.programs.agnostic.git; -in { +in +{ programs.git = { enable = true; package = pkgs.gitAndTools.gitFull; @@ -28,10 +26,7 @@ in { diff.algorithm = "histogram"; # a much better diff help.autocorrect = 10; # 1 second warning to a typo'd command - credential.helper = - if pkgs.stdenv.isDarwin - then "osxkeychain" - else "cache"; + credential.helper = if pkgs.stdenv.isDarwin then "osxkeychain" else "cache"; core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol"; diff --git a/home/isabel/configs/git/lazygit.nix b/home/isabel/configs/git/lazygit.nix index ca228cd7b..c5e2c6409 100644 --- a/home/isabel/configs/git/lazygit.nix +++ b/home/isabel/configs/git/lazygit.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { config.programs.lazygit = lib.mkIf osConfig.modules.programs.tui.enable { enable = true; diff --git a/home/isabel/configs/gui/bars/ags/default.nix b/home/isabel/configs/gui/bars/ags/default.nix index 8c05e85e0..cf5a8f4a0 100644 --- a/home/isabel/configs/gui/bars/ags/default.nix +++ b/home/isabel/configs/gui/bars/ags/default.nix @@ -5,9 +5,11 @@ osConfig, inputs', ... -}: let +}: +let inherit (osConfig.modules) environment system; -in { +in +{ config = lib.mkIf ((lib.isWayland osConfig) && osConfig.modules.programs.gui.bars.ags.enable) { home = { packages = with pkgs; [ @@ -22,15 +24,20 @@ in { ]; }; - xdg.configFile = let - symlink = fileName: {recursive ? false}: { - source = config.lib.file.mkOutOfStoreSymlink "${environment.flakePath}/${fileName}"; - inherit recursive; - }; - in { - "ags" = symlink "home/${system.mainUser}/configs/gui/bars/ags" { - recursive = true; + xdg.configFile = + let + symlink = + fileName: + { + recursive ? false, + }: + { + source = config.lib.file.mkOutOfStoreSymlink "${environment.flakePath}/${fileName}"; + inherit recursive; + }; + in + { + "ags" = symlink "home/${system.mainUser}/configs/gui/bars/ags" { recursive = true; }; }; - }; }; } diff --git a/home/isabel/configs/gui/bars/eww/default.nix b/home/isabel/configs/gui/bars/eww/default.nix index e31a883d0..5f4e624ca 100644 --- a/home/isabel/configs/gui/bars/eww/default.nix +++ b/home/isabel/configs/gui/bars/eww/default.nix @@ -4,14 +4,13 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) isWayland; - ewwPackage = - if isWayland osConfig - then pkgs.eww-wayland - else pkgs.eww; -in { + ewwPackage = if isWayland osConfig then pkgs.eww-wayland else pkgs.eww; +in +{ config = lib.mkIf ((isWayland osConfig) && osConfig.modules.programs.gui.bars.eww.enable) { home.packages = with pkgs; [ socat diff --git a/home/isabel/configs/gui/bars/waybar/default.nix b/home/isabel/configs/gui/bars/waybar/default.nix index f6a7c30c9..2958dcea0 100644 --- a/home/isabel/configs/gui/bars/waybar/default.nix +++ b/home/isabel/configs/gui/bars/waybar/default.nix @@ -3,19 +3,21 @@ lib, osConfig, ... -}: let +}: +let inherit (lib) optionalString; sys = osConfig.modules.system; cfg = osConfig.modules.programs; -in { +in +{ config = lib.mkIf (lib.isWayland osConfig && osConfig.modules.programs.gui.bars.waybar.enable) { - home.packages = with pkgs; [wlogout]; + home.packages = with pkgs; [ wlogout ]; programs.waybar = { enable = true; package = pkgs.waybar; systemd.enable = true; - style = import ./style.nix {}; + style = import ./style.nix { }; settings = { mainBar = { layer = "top"; @@ -29,12 +31,8 @@ in { spacing = 5; margin-bottom = -11; - modules-left = [ - "hyprland/workspaces" - ]; - modules-center = [ - "custom/dynamic_pill" - ]; + modules-left = [ "hyprland/workspaces" ]; + modules-center = [ "custom/dynamic_pill" ]; modules-right = [ "tray" "backlight" @@ -96,7 +94,11 @@ in { phone = ""; portable = ""; car = ""; - default = ["" "" ""]; + default = [ + "" + "" + "" + ]; }; }; "pulseaudio#microphone" = { @@ -145,7 +147,18 @@ in { format-charging = " {capacity}%"; format-plugged = " {capacity}%"; format-alt = "{time} {icon}"; - format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + format-icons = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; }; bluetooth = { format = ""; @@ -160,7 +173,19 @@ in { format-charging = " {capacity}%"; format-plugged = " {capacity}%"; format-alt = "{time} {icon}"; - format-icons = ["" "" "" "" "" "" "" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; }; tooltip-format = "{controller_alias}\t{controller_address}\n{status}"; tooltip-format-off = "{controller_alias}\t{controller_address}\n{status}"; @@ -168,7 +193,18 @@ in { tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; format-icons = { - default = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + default = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; }; on-click = "$term -e bluetoothctl"; on-click-right = "killall bluetoothctl"; diff --git a/home/isabel/configs/gui/browsers/chromium.nix b/home/isabel/configs/gui/browsers/chromium.nix index 7c10f7d88..90daf330b 100644 --- a/home/isabel/configs/gui/browsers/chromium.nix +++ b/home/isabel/configs/gui/browsers/chromium.nix @@ -3,15 +3,14 @@ pkgs, osConfig, ... -}: let +}: +let progs = osConfig.modules.programs; cfg = progs.gui.browsers.chromium; - chrome_pkg = - if cfg.ungoogled - then pkgs.ungoogled-chromium - else pkgs.chromium; -in { + chrome_pkg = if cfg.ungoogled then pkgs.ungoogled-chromium else pkgs.chromium; +in +{ config = lib.mkIf cfg.enable { programs.chromium = { enable = true; diff --git a/home/isabel/configs/gui/browsers/schizofox.nix b/home/isabel/configs/gui/browsers/schizofox.nix index d9f253c17..1a62023ec 100644 --- a/home/isabel/configs/gui/browsers/schizofox.nix +++ b/home/isabel/configs/gui/browsers/schizofox.nix @@ -4,10 +4,12 @@ pkgs, osConfig, ... -}: let +}: +let cfg = osConfig.modules.programs.gui.browsers.firefox; -in { - imports = [inputs.schizofox.homeManagerModule]; +in +{ + imports = [ inputs.schizofox.homeManagerModule ]; config = lib.mkIf (cfg.enable && cfg.schizofox) { programs.schizofox = { enable = true; @@ -26,10 +28,17 @@ in { search = { defaultSearchEngine = "Searx"; - removeEngines = ["Google" "Bing" "Amazon.com" "eBay" "Twitter" "Wikipedia"]; + removeEngines = [ + "Google" + "Bing" + "Amazon.com" + "eBay" + "Twitter" + "Wikipedia" + ]; searxUrl = "https://search.isabelroses.com"; searxQuery = "https://search.isabelroses.com/search?q={searchTerms}&categories=general"; - addEngines = []; + addEngines = [ ]; }; security = { diff --git a/home/isabel/configs/gui/discord.nix b/home/isabel/configs/gui/discord.nix index fcd3e02c4..7122df7b7 100644 --- a/home/isabel/configs/gui/discord.nix +++ b/home/isabel/configs/gui/discord.nix @@ -3,29 +3,31 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isWayland; -in { +in +{ config = mkIf osConfig.modules.programs.gui.discord.enable { home.packages = mkIf pkgs.stdenv.isLinux [ - ((pkgs.discord.override { + ( + (pkgs.discord.override { nss = pkgs.nss_latest; withOpenASAR = true; withVencord = true; withTTS = false; - }) - .overrideAttrs (old: { + }).overrideAttrs + (old: { libPath = old.libPath + ":${pkgs.libglvnd}/lib"; - nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.makeWrapper]; + nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.makeWrapper ]; postFixup = mkIf (isWayland osConfig) '' wrapProgram $out/opt/Discord/Discord --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}" ''; - })) + }) + ) ]; - xdg.configFile."discord/settings.json".text = builtins.toJSON { - SKIP_HOST_UPDATE = true; - }; + xdg.configFile."discord/settings.json".text = builtins.toJSON { SKIP_HOST_UPDATE = true; }; }; } diff --git a/home/isabel/configs/gui/fileMangers/dolphin.nix b/home/isabel/configs/gui/fileMangers/dolphin.nix index 4d53cf1b1..2e20556a8 100644 --- a/home/isabel/configs/gui/fileMangers/dolphin.nix +++ b/home/isabel/configs/gui/fileMangers/dolphin.nix @@ -3,10 +3,9 @@ pkgs, osConfig, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.gui.fileManagers.dolphin.enable { - home.packages = with pkgs; [ - libsForQt5.dolphin - ]; + home.packages = with pkgs; [ libsForQt5.dolphin ]; }; } diff --git a/home/isabel/configs/gui/fileMangers/nemo.nix b/home/isabel/configs/gui/fileMangers/nemo.nix index 210e1a6b9..d3580c593 100644 --- a/home/isabel/configs/gui/fileMangers/nemo.nix +++ b/home/isabel/configs/gui/fileMangers/nemo.nix @@ -3,7 +3,8 @@ pkgs, osConfig, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.gui.fileManagers.nemo.enable { home.packages = with pkgs; [ cinnamon.nemo-with-extensions diff --git a/home/isabel/configs/gui/fileMangers/thunar.nix b/home/isabel/configs/gui/fileMangers/thunar.nix index f890722a8..dd60fb8de 100644 --- a/home/isabel/configs/gui/fileMangers/thunar.nix +++ b/home/isabel/configs/gui/fileMangers/thunar.nix @@ -1,8 +1,5 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { xfconf.settings = lib.mkIf osConfig.modules.programs.gui.fileManagers.thunar.enable { thunar = { "default-view" = "ThunarDetailsView"; diff --git a/home/isabel/configs/gui/launchers/rofi.nix b/home/isabel/configs/gui/launchers/rofi.nix index 74c37b820..9c81a67d2 100644 --- a/home/isabel/configs/gui/launchers/rofi.nix +++ b/home/isabel/configs/gui/launchers/rofi.nix @@ -5,19 +5,14 @@ defaults, osConfig, ... -}: let - rofiPackage = - if lib.isWayland osConfig - then pkgs.rofi-wayland - else pkgs.rofi; -in { +}: +let + rofiPackage = if lib.isWayland osConfig then pkgs.rofi-wayland else pkgs.rofi; +in +{ programs.rofi = lib.mkIf osConfig.modules.programs.gui.launchers.rofi.enable { enable = true; - package = rofiPackage.override { - plugins = [ - pkgs.rofi-rbw - ]; - }; + package = rofiPackage.override { plugins = [ pkgs.rofi-rbw ]; }; extraConfig = { modi = "drun"; @@ -33,100 +28,108 @@ in { drun-display-format = "{name}"; }; - theme = let - inherit (config.lib.formats.rasi) mkLiteral; - in { - "*" = { - bg-col = mkLiteral "#1e1e2e"; - bg-col-light = mkLiteral "#1e1e2e"; - border-col = mkLiteral "#313244"; - selected-col = mkLiteral "#1e1e2e"; - sapphire = mkLiteral "#74c7ec"; - fg-col = mkLiteral "#cdd6f4"; - fg-col2 = mkLiteral "@sapphire"; - grey = mkLiteral "#a6adc8"; - - width = mkLiteral "450px"; - }; - - "element-text, element-icon , mode-switcher" = { - background-color = mkLiteral "inherit"; - text-color = mkLiteral "inherit"; - }; - - "window" = { - height = mkLiteral "500px"; - border = mkLiteral "3px"; - border-radius = mkLiteral "15px"; - border-color = mkLiteral "@border-col"; - background-color = mkLiteral "@bg-col"; - }; - - "mainbox" = {background-color = mkLiteral "@bg-col";}; - - inputbar = { - children = mkLiteral "[prompt,entry]"; - background-color = mkLiteral "@bg-col"; - border-radius = mkLiteral "15px"; - padding = mkLiteral "2px"; - }; - - prompt = { - background-color = mkLiteral "@sapphire"; - padding = mkLiteral "6px"; - text-color = mkLiteral "@bg-col"; - border-radius = mkLiteral "15px"; - margin = mkLiteral "20px 0px 0px 20px"; - }; - - textbox-prompt-colon = { - expand = false; - str = ":"; - }; - - entry = { - padding = mkLiteral "6px"; - margin = mkLiteral "20px 0px 0px 10px"; - text-color = mkLiteral "@fg-col"; - background-color = mkLiteral "@bg-col"; - }; - - listview = { - border = mkLiteral "0px 0px 0px"; - padding = mkLiteral "6px 0px 0px"; - margin = mkLiteral "10px 0px 0px 20px"; - columns = 1; - lines = 10; - background-color = mkLiteral "@bg-col"; - }; - - element = { - padding = mkLiteral "5px"; - background-color = mkLiteral "@bg-col"; - text-color = mkLiteral "@fg-col"; - }; - - element-icon = {size = mkLiteral "25px";}; - - "element selected" = { - background-color = mkLiteral "@selected-col"; - text-color = mkLiteral "@fg-col2"; - }; - - mode-switcher = {spacing = 0;}; - - button = { - padding = mkLiteral "10px"; - background-color = mkLiteral "@bg-col-light"; - text-color = mkLiteral "@grey"; - vertical-align = mkLiteral "0.5"; - horizontal-align = mkLiteral "0.5"; + theme = + let + inherit (config.lib.formats.rasi) mkLiteral; + in + { + "*" = { + bg-col = mkLiteral "#1e1e2e"; + bg-col-light = mkLiteral "#1e1e2e"; + border-col = mkLiteral "#313244"; + selected-col = mkLiteral "#1e1e2e"; + sapphire = mkLiteral "#74c7ec"; + fg-col = mkLiteral "#cdd6f4"; + fg-col2 = mkLiteral "@sapphire"; + grey = mkLiteral "#a6adc8"; + + width = mkLiteral "450px"; + }; + + "element-text, element-icon , mode-switcher" = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + }; + + "window" = { + height = mkLiteral "500px"; + border = mkLiteral "3px"; + border-radius = mkLiteral "15px"; + border-color = mkLiteral "@border-col"; + background-color = mkLiteral "@bg-col"; + }; + + "mainbox" = { + background-color = mkLiteral "@bg-col"; + }; + + inputbar = { + children = mkLiteral "[prompt,entry]"; + background-color = mkLiteral "@bg-col"; + border-radius = mkLiteral "15px"; + padding = mkLiteral "2px"; + }; + + prompt = { + background-color = mkLiteral "@sapphire"; + padding = mkLiteral "6px"; + text-color = mkLiteral "@bg-col"; + border-radius = mkLiteral "15px"; + margin = mkLiteral "20px 0px 0px 20px"; + }; + + textbox-prompt-colon = { + expand = false; + str = ":"; + }; + + entry = { + padding = mkLiteral "6px"; + margin = mkLiteral "20px 0px 0px 10px"; + text-color = mkLiteral "@fg-col"; + background-color = mkLiteral "@bg-col"; + }; + + listview = { + border = mkLiteral "0px 0px 0px"; + padding = mkLiteral "6px 0px 0px"; + margin = mkLiteral "10px 0px 0px 20px"; + columns = 1; + lines = 10; + background-color = mkLiteral "@bg-col"; + }; + + element = { + padding = mkLiteral "5px"; + background-color = mkLiteral "@bg-col"; + text-color = mkLiteral "@fg-col"; + }; + + element-icon = { + size = mkLiteral "25px"; + }; + + "element selected" = { + background-color = mkLiteral "@selected-col"; + text-color = mkLiteral "@fg-col2"; + }; + + mode-switcher = { + spacing = 0; + }; + + button = { + padding = mkLiteral "10px"; + background-color = mkLiteral "@bg-col-light"; + text-color = mkLiteral "@grey"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.5"; + }; + + "button selected" = { + background-color = mkLiteral "@bg-col"; + text-color = mkLiteral "@sapphire"; + }; }; - - "button selected" = { - background-color = mkLiteral "@bg-col"; - text-color = mkLiteral "@sapphire"; - }; - }; }; } diff --git a/home/isabel/configs/gui/launchers/wofi.nix b/home/isabel/configs/gui/launchers/wofi.nix index 3e6911ef2..78cd0c2e3 100644 --- a/home/isabel/configs/gui/launchers/wofi.nix +++ b/home/isabel/configs/gui/launchers/wofi.nix @@ -3,11 +3,15 @@ defaults, osConfig, ... -}: { +}: +{ programs.wofi = lib.mkIf osConfig.modules.programs.gui.launchers.wofi.enable { enable = true; settings = { - show = ["drun" "run"]; + show = [ + "drun" + "run" + ]; layer = "top"; location = 0; allow_images = true; diff --git a/home/isabel/configs/gui/swaync.nix b/home/isabel/configs/gui/swaync.nix index bffb444a2..6c4c51011 100644 --- a/home/isabel/configs/gui/swaync.nix +++ b/home/isabel/configs/gui/swaync.nix @@ -3,9 +3,11 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ services.swaync = mkIf osConfig.modules.programs.gui.bars.waybar.enable { enable = true; diff --git a/home/isabel/configs/gui/terminals/alacritty.nix b/home/isabel/configs/gui/terminals/alacritty.nix index a5ce94993..6d091caee 100644 --- a/home/isabel/configs/gui/terminals/alacritty.nix +++ b/home/isabel/configs/gui/terminals/alacritty.nix @@ -1,13 +1,10 @@ +{ lib, osConfig, ... }: { - lib, - osConfig, - ... -}: { config = lib.mkIf osConfig.modules.programs.gui.terminals.alacritty.enable { programs.alacritty = { enable = true; settings = { - window.opacity = 0.90; + window.opacity = 0.9; font = { normal = { diff --git a/home/isabel/configs/gui/terminals/ghostty.nix b/home/isabel/configs/gui/terminals/ghostty.nix index 8800544ec..db4b9f297 100644 --- a/home/isabel/configs/gui/terminals/ghostty.nix +++ b/home/isabel/configs/gui/terminals/ghostty.nix @@ -4,13 +4,13 @@ inputs', osConfig, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ config = mkIf osConfig.modules.programs.gui.terminals.ghostty.enable { - home.packages = mkIf pkgs.stdenv.isLinux [ - inputs'.ghostty.packages.default - ]; + home.packages = mkIf pkgs.stdenv.isLinux [ inputs'.ghostty.packages.default ]; xdg.configFile."ghostty/config".text = '' title = Ghostty diff --git a/home/isabel/configs/gui/terminals/kitty.nix b/home/isabel/configs/gui/terminals/kitty.nix index 8df0f3727..c92db02bc 100644 --- a/home/isabel/configs/gui/terminals/kitty.nix +++ b/home/isabel/configs/gui/terminals/kitty.nix @@ -3,7 +3,8 @@ config, osConfig, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.gui.terminals.kitty.enable { programs.kitty = { enable = true; diff --git a/home/isabel/configs/gui/terminals/wezterm/default.nix b/home/isabel/configs/gui/terminals/wezterm/default.nix index 0b5e293f8..7deb74242 100644 --- a/home/isabel/configs/gui/terminals/wezterm/default.nix +++ b/home/isabel/configs/gui/terminals/wezterm/default.nix @@ -4,26 +4,33 @@ inputs', osConfig, ... -}: let +}: +let inherit (osConfig.modules) environment system; -in { +in +{ config = lib.mkIf osConfig.modules.programs.gui.terminals.wezterm.enable { programs.wezterm = { enable = true; package = inputs'.nekowinston-nur.packages.wezterm-nightly; }; - xdg.configFile = let - symlink = fileName: {recursive ? false}: { - source = config.lib.file.mkOutOfStoreSymlink "${environment.flakePath}/${fileName}"; - inherit recursive; - }; - in { - # https://github.com/nix-community/home-manager/issues/1807#issuecomment-1740960646 - "wezterm/wezterm.lua".enable = false; - "wezterm" = symlink "home/${system.mainUser}/configs/gui/terminals/wezterm" { - recursive = true; + xdg.configFile = + let + symlink = + fileName: + { + recursive ? false, + }: + { + source = config.lib.file.mkOutOfStoreSymlink "${environment.flakePath}/${fileName}"; + inherit recursive; + }; + in + { + # https://github.com/nix-community/home-manager/issues/1807#issuecomment-1740960646 + "wezterm/wezterm.lua".enable = false; + "wezterm" = symlink "home/${system.mainUser}/configs/gui/terminals/wezterm" { recursive = true; }; }; - }; }; } diff --git a/home/isabel/configs/gui/viewnior.nix b/home/isabel/configs/gui/viewnior.nix index 4d2955797..64f89a349 100644 --- a/home/isabel/configs/gui/viewnior.nix +++ b/home/isabel/configs/gui/viewnior.nix @@ -3,36 +3,42 @@ pkgs, osConfig, ... -}: let - acceptedTypes = ["laptop" "desktop" "hybrid"]; -in { - config = lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.gui.enable) { - home.packages = with pkgs; [ - viewnior - ]; +}: +let + acceptedTypes = [ + "laptop" + "desktop" + "hybrid" + ]; +in +{ + config = + lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.gui.enable) + { + home.packages = with pkgs; [ viewnior ]; - xdg.configFile."viewnior/viewnior.conf".text = '' - [prefs] - zoom-mode=0 - fit-on-fullscreen=true - show-hidden=true - dark-background=false - smooth-images=true - confirm-delete=true - reload-on-save=false - show-menu-bar=false - show-toolbar=false - show-scrollbar=false - show-statusbar=false - start-maximized=false - slideshow-timeout=5 - auto-resize=false - behavior-wheel=1 - behavior-click=0 - behavior-modify=0 - jpeg-quality=100 - png-compression=9 - desktop=6 - ''; - }; + xdg.configFile."viewnior/viewnior.conf".text = '' + [prefs] + zoom-mode=0 + fit-on-fullscreen=true + show-hidden=true + dark-background=false + smooth-images=true + confirm-delete=true + reload-on-save=false + show-menu-bar=false + show-toolbar=false + show-scrollbar=false + show-statusbar=false + start-maximized=false + slideshow-timeout=5 + auto-resize=false + behavior-wheel=1 + behavior-click=0 + behavior-modify=0 + jpeg-quality=100 + png-compression=9 + desktop=6 + ''; + }; } diff --git a/home/isabel/configs/gui/zathura.nix b/home/isabel/configs/gui/zathura.nix index 1a3884c32..4f516de53 100644 --- a/home/isabel/configs/gui/zathura.nix +++ b/home/isabel/configs/gui/zathura.nix @@ -3,7 +3,8 @@ pkgs, osConfig, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.gui.zathura.enable { xdg.configFile."zathura/catppuccin-mocha".source = pkgs.fetchurl { url = "https://raw.githubusercontent.com/catppuccin/zathura/main/src/catppuccin-mocha"; diff --git a/home/isabel/configs/shell/bash.nix b/home/isabel/configs/shell/bash.nix index ff1b4fa0c..d0dff72b9 100644 --- a/home/isabel/configs/shell/bash.nix +++ b/home/isabel/configs/shell/bash.nix @@ -1,8 +1,5 @@ +{ pkgs, config, ... }: { - pkgs, - config, - ... -}: { programs.bash = { enable = true; diff --git a/home/isabel/configs/shell/fish.nix b/home/isabel/configs/shell/fish.nix index 445b5613d..e60d672d5 100644 --- a/home/isabel/configs/shell/fish.nix +++ b/home/isabel/configs/shell/fish.nix @@ -1,13 +1,11 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) getExe; -in { +in +{ programs.fish = { enable = true; - plugins = []; + plugins = [ ]; functions = { bj = "nohup $argv /dev/null &"; @@ -23,7 +21,7 @@ in { end ''; }; - shellAbbrs = {}; + shellAbbrs = { }; shellInit = '' ${getExe pkgs.nix-your-shell} fish | source diff --git a/home/isabel/configs/shell/nushell.nix b/home/isabel/configs/shell/nushell.nix index 287bc926d..32c213088 100644 --- a/home/isabel/configs/shell/nushell.nix +++ b/home/isabel/configs/shell/nushell.nix @@ -3,203 +3,219 @@ pkgs, config, ... -}: let - inherit (lib) getExe mapAttrs escapeShellArg concatMapStrings; -in { +}: +let + inherit (lib) + getExe + mapAttrs + escapeShellArg + concatMapStrings + ; +in +{ programs.nushell = { enable = true; - shellAliases = builtins.removeAttrs config.home.shellAliases ["mkdir"]; + shellAliases = builtins.removeAttrs config.home.shellAliases [ "mkdir" ]; - environmentVariables = - { - DIRENV_LOG_FORMAT = "''"; - SHELL = "'${getExe pkgs.nushell}'"; - # PATH = "($env.PATH | split row (char esep) | append [${escapeShellArgs config.home.sessionPath}])"; - } - // mapAttrs (_: v: (escapeShellArg v)) config.home.sessionVariables; + environmentVariables = { + DIRENV_LOG_FORMAT = "''"; + SHELL = "'${getExe pkgs.nushell}'"; + # PATH = "($env.PATH | split row (char esep) | append [${escapeShellArgs config.home.sessionPath}])"; + } // mapAttrs (_: v: (escapeShellArg v)) config.home.sessionVariables; - extraConfig = let - completions = cmds: '' - ${concatMapStrings (cmd: '' + extraConfig = + let + completions = cmds: '' + ${concatMapStrings (cmd: '' source "${pkgs.nu_scripts}/share/nu_scripts/custom-completions/${cmd}/${cmd}-completions.nu" - '') - cmds} - ''; - in '' - ${completions ["nix" "git" "curl" "bat" "cargo" "gh" "glow" "just" "rg"]} + '') cmds} + ''; + in + '' + ${completions [ + "nix" + "git" + "curl" + "bat" + "cargo" + "gh" + "glow" + "just" + "rg" + ]} - # CTP theme - let catppuccin = { - latte: { - rosewater: "#dc8a78" - flamingo: "#dd7878" - pink: "#ea76cb" - mauve: "#8839ef" - red: "#d20f39" - maroon: "#e64553" - peach: "#fe640b" - yellow: "#df8e1d" - green: "#40a02 - teal: "#179299" - sky: "#04a5e5" - sapphire: "#209fb5" - blue: "#1e66f5" - lavender: "#7287fd" - text: "#4c4f69" - subtext1: "#5c5f77" - subtext0: "#6c6f85" - overlay2: "#7c7f93" - overlay1: "#8c8fa1" - overlay0: "#9ca0b0" - surface2: "#acb0be" - surface1: "#bcc0cc" - surface0: "#ccd0da" - crust: "#dce0e8" - mantle: "#e6e9ef" - base: "#eff1f5" - } - frappe: { - rosewater: "#f2d5cf" - flamingo: "#eebebe" - pink: "#f4b8e4" - mauve: "#ca9ee6" - red: "#e78284" - maroon: "#ea999c" - peach: "#ef9f76" - yellow: "#e5c890" - green: "#a6d189" - teal: "#81c8be" - sky: "#99d1db" - sapphire: "#85c1dc" - blue: "#8caaee" - lavender: "#babbf1" - text: "#c6d0f5" - subtext1: "#b5bfe2" - subtext0: "#a5adce" - overlay2: "#949cbb" - overlay1: "#838ba7" - overlay0: "#737994" - surface2: "#626880" - surface1: "#51576d" - surface0: "#414559" - base: "#303446" - mantle: "#292c3c" - crust: "#232634" - } - macchiato: { - rosewater: "#f4dbd6" - flamingo: "#f0c6c6" - pink: "#f5bde6" - mauve: "#c6a0f6" - red: "#ed8796" - maroon: "#ee99a0" - peach: "#f5a97f" - yellow: "#eed49f" - green: "#a6da95" - teal: "#8bd5ca" - sky: "#91d7e3" - sapphire: "#7dc4e4" - blue: "#8aadf4" - lavender: "#b7bdf8" - text: "#cad3f5" - subtext1: "#b8c0e0" - subtext0: "#a5adcb" - overlay2: "#939ab7" - overlay1: "#8087a2" - overlay0: "#6e738d" - surface2: "#5b6078" - surface1: "#494d64" - surface0: "#363a4f" - base: "#24273a" - mantle: "#1e2030" - crust: "#181926" - } - mocha: { - rosewater: "#f5e0dc" - flamingo: "#f2cdcd" - pink: "#f5c2e7" - mauve: "#cba6f7" - red: "#f38ba8" - maroon: "#eba0ac" - peach: "#fab387" - yellow: "#f9e2af" - green: "#a6e3a1" - teal: "#94e2d5" - sky: "#89dceb" - sapphire: "#74c7ec" - blue: "#89b4fa" - lavender: "#b4befe" - text: "#cdd6f4" - subtext1: "#bac2de" - subtext0: "#a6adc8" - overlay2: "#9399b2" - overlay1: "#7f849c" - overlay0: "#6c7086" - surface2: "#585b70" - surface1: "#45475a" - surface0: "#313244" - base: "#1e1e2e" - mantle: "#181825" - crust: "#11111b" + # CTP theme + let catppuccin = { + latte: { + rosewater: "#dc8a78" + flamingo: "#dd7878" + pink: "#ea76cb" + mauve: "#8839ef" + red: "#d20f39" + maroon: "#e64553" + peach: "#fe640b" + yellow: "#df8e1d" + green: "#40a02 + teal: "#179299" + sky: "#04a5e5" + sapphire: "#209fb5" + blue: "#1e66f5" + lavender: "#7287fd" + text: "#4c4f69" + subtext1: "#5c5f77" + subtext0: "#6c6f85" + overlay2: "#7c7f93" + overlay1: "#8c8fa1" + overlay0: "#9ca0b0" + surface2: "#acb0be" + surface1: "#bcc0cc" + surface0: "#ccd0da" + crust: "#dce0e8" + mantle: "#e6e9ef" + base: "#eff1f5" + } + frappe: { + rosewater: "#f2d5cf" + flamingo: "#eebebe" + pink: "#f4b8e4" + mauve: "#ca9ee6" + red: "#e78284" + maroon: "#ea999c" + peach: "#ef9f76" + yellow: "#e5c890" + green: "#a6d189" + teal: "#81c8be" + sky: "#99d1db" + sapphire: "#85c1dc" + blue: "#8caaee" + lavender: "#babbf1" + text: "#c6d0f5" + subtext1: "#b5bfe2" + subtext0: "#a5adce" + overlay2: "#949cbb" + overlay1: "#838ba7" + overlay0: "#737994" + surface2: "#626880" + surface1: "#51576d" + surface0: "#414559" + base: "#303446" + mantle: "#292c3c" + crust: "#232634" + } + macchiato: { + rosewater: "#f4dbd6" + flamingo: "#f0c6c6" + pink: "#f5bde6" + mauve: "#c6a0f6" + red: "#ed8796" + maroon: "#ee99a0" + peach: "#f5a97f" + yellow: "#eed49f" + green: "#a6da95" + teal: "#8bd5ca" + sky: "#91d7e3" + sapphire: "#7dc4e4" + blue: "#8aadf4" + lavender: "#b7bdf8" + text: "#cad3f5" + subtext1: "#b8c0e0" + subtext0: "#a5adcb" + overlay2: "#939ab7" + overlay1: "#8087a2" + overlay0: "#6e738d" + surface2: "#5b6078" + surface1: "#494d64" + surface0: "#363a4f" + base: "#24273a" + mantle: "#1e2030" + crust: "#181926" + } + mocha: { + rosewater: "#f5e0dc" + flamingo: "#f2cdcd" + pink: "#f5c2e7" + mauve: "#cba6f7" + red: "#f38ba8" + maroon: "#eba0ac" + peach: "#fab387" + yellow: "#f9e2af" + green: "#a6e3a1" + teal: "#94e2d5" + sky: "#89dceb" + sapphire: "#74c7ec" + blue: "#89b4fa" + lavender: "#b4befe" + text: "#cdd6f4" + subtext1: "#bac2de" + subtext0: "#a6adc8" + overlay2: "#9399b2" + overlay1: "#7f849c" + overlay0: "#6c7086" + surface2: "#585b70" + surface1: "#45475a" + surface0: "#313244" + base: "#1e1e2e" + mantle: "#181825" + crust: "#11111b" + } } - } - let stheme = $catppuccin.mocha + let stheme = $catppuccin.mocha - let theme = { - separator: $stheme.overlay0 - leading_trailing_space_bg: $stheme.overlay0 - header: $stheme.green - date: $stheme.mauve - filesize: $stheme.blue - row_index: $stheme.pink - bool: $stheme.peach - int: $stheme.peach - duration: $stheme.peach - range: $stheme.peach - float: $stheme.peach - string: $stheme.green - nothing: $stheme.peach - binary: $stheme.peach - cellpath: $stheme.peach - hints: dark_gray + let theme = { + separator: $stheme.overlay0 + leading_trailing_space_bg: $stheme.overlay0 + header: $stheme.green + date: $stheme.mauve + filesize: $stheme.blue + row_index: $stheme.pink + bool: $stheme.peach + int: $stheme.peach + duration: $stheme.peach + range: $stheme.peach + float: $stheme.peach + string: $stheme.green + nothing: $stheme.peach + binary: $stheme.peach + cellpath: $stheme.peach + hints: dark_gray - shape_garbage: { fg: $stheme.crust bg: $stheme.red attr: b } - shape_bool: $stheme.blue - shape_int: { fg: $stheme.mauve attr: b} - shape_float: { fg: $stheme.mauve attr: b} - shape_range: { fg: $stheme.yellow attr: b} - shape_internalcall: { fg: $stheme.blue attr: b} - shape_external: { fg: $stheme.blue attr: b} - shape_externalarg: $stheme.text - shape_literal: $stheme.blue - shape_operator: $stheme.yellow - shape_signature: { fg: $stheme.green attr: b} - shape_string: $stheme.green - shape_filepath: $stheme.yellow - shape_globpattern: { fg: $stheme.blue attr: b} - shape_variable: $stheme.text - shape_flag: { fg: $stheme.blue attr: b} - shape_custom: {attr: b} - } - - $env.config = { - show_banner: false, - rm: { - always_trash: true - } - ls: { - clickable_links: true + shape_garbage: { fg: $stheme.crust bg: $stheme.red attr: b } + shape_bool: $stheme.blue + shape_int: { fg: $stheme.mauve attr: b} + shape_float: { fg: $stheme.mauve attr: b} + shape_range: { fg: $stheme.yellow attr: b} + shape_internalcall: { fg: $stheme.blue attr: b} + shape_external: { fg: $stheme.blue attr: b} + shape_externalarg: $stheme.text + shape_literal: $stheme.blue + shape_operator: $stheme.yellow + shape_signature: { fg: $stheme.green attr: b} + shape_string: $stheme.green + shape_filepath: $stheme.yellow + shape_globpattern: { fg: $stheme.blue attr: b} + shape_variable: $stheme.text + shape_flag: { fg: $stheme.blue attr: b} + shape_custom: {attr: b} } - color_config: $theme - completions: { - case_sensitive: false - quick: true - partial: true - algorithm: "fuzzy" + + $env.config = { + show_banner: false, + rm: { + always_trash: true + } + ls: { + clickable_links: true + } + color_config: $theme + completions: { + case_sensitive: false + quick: true + partial: true + algorithm: "fuzzy" + } } - } - ''; + ''; }; } diff --git a/home/isabel/configs/shell/zsh.nix b/home/isabel/configs/shell/zsh.nix index 0819cd2b1..6bbe2bb6f 100644 --- a/home/isabel/configs/shell/zsh.nix +++ b/home/isabel/configs/shell/zsh.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.zsh = { enable = pkgs.stdenv.isDarwin; diff --git a/home/isabel/configs/tui/btop.nix b/home/isabel/configs/tui/btop.nix index 6daadf586..59ef3d50b 100644 --- a/home/isabel/configs/tui/btop.nix +++ b/home/isabel/configs/tui/btop.nix @@ -1,17 +1,23 @@ +{ lib, osConfig, ... }: +let + acceptedTypes = [ + "desktop" + "laptop" + "wsl" + "lite" + "hybrid" + ]; +in { - lib, - osConfig, - ... -}: let - acceptedTypes = ["desktop" "laptop" "wsl" "lite" "hybrid"]; -in { - config = lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.tui.enable) { - programs.btop = { - enable = true; - settings = { - vim_keys = true; - rounded_corners = true; + config = + lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.tui.enable) + { + programs.btop = { + enable = true; + settings = { + vim_keys = true; + rounded_corners = true; + }; + }; }; - }; - }; } diff --git a/home/isabel/configs/tui/izrss.nix b/home/isabel/configs/tui/izrss.nix index 121d34d58..7f68c24d1 100644 --- a/home/isabel/configs/tui/izrss.nix +++ b/home/isabel/configs/tui/izrss.nix @@ -3,10 +3,12 @@ inputs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { - imports = [inputs.izrss.homeManagerModules.default]; +in +{ + imports = [ inputs.izrss.homeManagerModules.default ]; config = mkIf (isModernShell osConfig) { programs.izrss = { diff --git a/home/isabel/configs/tui/newsboat.nix b/home/isabel/configs/tui/newsboat.nix index 0049896a6..09caa9e15 100644 --- a/home/isabel/configs/tui/newsboat.nix +++ b/home/isabel/configs/tui/newsboat.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.newsboat = { enable = true; autoReload = true; @@ -7,61 +8,75 @@ urls = [ { title = "Uncenter"; - tags = ["webdev" "friends"]; + tags = [ + "webdev" + "friends" + ]; url = "https://uncenter.dev/feed.xml"; } { title = "Me"; - tags = ["me"]; + tags = [ "me" ]; url = "https://isabelroses.com/rss.xml"; } { title = "antfu"; - tags = ["webdev"]; + tags = [ "webdev" ]; url = "https://antfu.me/feed.xml"; } { title = "fasterthenli"; - tags = ["webdev" "rust" "nix"]; + tags = [ + "webdev" + "rust" + "nix" + ]; url = "https://fasterthanli.me/index.xml"; } { title = "orhun"; - tags = ["rust" "linux"]; + tags = [ + "rust" + "linux" + ]; url = "https://blog.orhun.dev/rss.xml"; } { title = "mitchellh"; - tags = ["terminal"]; + tags = [ "terminal" ]; url = "https://mitchellh.com/feed.xml"; } { title = "solene"; - tags = ["linux" "bsd" "nix"]; + tags = [ + "linux" + "bsd" + "nix" + ]; url = "https://dataswamp.org/~solene/rss.xml"; } { title = "viperml"; - tags = ["nix"]; + tags = [ "nix" ]; url = "https://ayats.org/index.xml"; } { title = "Nixpkgs News"; - tags = ["nix"]; + tags = [ "nix" ]; url = "https://nixpkgs.news/rss.xml"; } { title = "maia crimew"; - tags = ["hacking"]; + tags = [ "hacking" ]; url = "https://maia.crimew.gay/feed.xml"; } ]; - extraConfig = - builtins.readFile - (pkgs.fetchurl { + extraConfig = builtins.readFile ( + pkgs.fetchurl { url = "https://raw.githubusercontent.com/catppuccin/newsboat/main/themes/dark"; sha256 = "09x50g74mld8zv8r6a873j52zx3w86qv3mc7g4fhzr85911cz799"; - }); + } + ); }; } diff --git a/home/isabel/configs/tui/ranger.nix b/home/isabel/configs/tui/ranger.nix index 438de108a..f42ba1115 100644 --- a/home/isabel/configs/tui/ranger.nix +++ b/home/isabel/configs/tui/ranger.nix @@ -4,17 +4,25 @@ osConfig, lib, ... -}: let - acceptedTypes = ["desktop" "laptop" "wsl" "lite" "hybrid"]; -in { - config = lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.tui.enable) { - home.packages = with pkgs; [ - ranger - ]; +}: +let + acceptedTypes = [ + "desktop" + "laptop" + "wsl" + "lite" + "hybrid" + ]; +in +{ + config = + lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.tui.enable) + { + home.packages = with pkgs; [ ranger ]; - xdg.configFile."ranger/rc.conf".text = '' - set preview_images true - ${(lib.optionalString config.programs.kitty.enable "set preview_images_method kitty")} - ''; - }; + xdg.configFile."ranger/rc.conf".text = '' + set preview_images true + ${(lib.optionalString config.programs.kitty.enable "set preview_images_method kitty")} + ''; + }; } diff --git a/home/isabel/configs/tui/yazi.nix b/home/isabel/configs/tui/yazi.nix index d403332a0..3717c61c0 100644 --- a/home/isabel/configs/tui/yazi.nix +++ b/home/isabel/configs/tui/yazi.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ programs.yazi = { enable = true; enableBashIntegration = config.programs.bash.enable; diff --git a/home/isabel/configs/tui/zzz.nix b/home/isabel/configs/tui/zzz.nix index 194dcab2a..d3876148d 100644 --- a/home/isabel/configs/tui/zzz.nix +++ b/home/isabel/configs/tui/zzz.nix @@ -3,14 +3,14 @@ inputs', osConfig, ... -}: let +}: +let inherit (lib) mkIf; cfg = osConfig.modules.programs.cli; -in { +in +{ config = mkIf (cfg.enable && cfg.modernShell.enable) { - home.packages = [ - inputs'.zzz.packages.default - ]; + home.packages = [ inputs'.zzz.packages.default ]; xdg.configFile."zzz/config.yaml".text = '' default_language: go diff --git a/home/isabel/configs/wm/hyprland/config.nix b/home/isabel/configs/wm/hyprland/config.nix index f1e221678..45805b323 100644 --- a/home/isabel/configs/wm/hyprland/config.nix +++ b/home/isabel/configs/wm/hyprland/config.nix @@ -4,7 +4,8 @@ osConfig, defaults, ... -}: let +}: +let inherit (lib) imap0 optionalString optionals; pointer = config.home.pointerCursor; @@ -15,27 +16,22 @@ eags = "exec, ${ags}"; eww = "~/.config/eww/scripts"; eeww = "exec, ${eww}"; -in { +in +{ wayland.windowManager.hyprland = { settings = { "$mod" = "SUPER"; exec-once = [ - "wl-paste --type text --watch cliphist store" #Stores only text data - "wl-paste --type image --watch cliphist store" #Stores only image data + "wl-paste --type text --watch cliphist store" # Stores only text data + "wl-paste --type image --watch cliphist store" # Stores only image data "wlsunset -S 8:00 -s 20:00" "hyprctl setcursor ${pointer.name} ${toString pointer.size}" ] - ++ optionals (defaults.bar == "eww") [ - "${eww}/init" - ] - ++ optionals (defaults.bar == "waybar") [ - "waybar" - ] - ++ optionals (defaults.bar == "ags") [ - ags - ]; + ++ optionals (defaults.bar == "eww") [ "${eww}/init" ] + ++ optionals (defaults.bar == "waybar") [ "waybar" ] + ++ optionals (defaults.bar == "ags") [ ags ]; input = { kb_layout = "${dev.keyboard}"; @@ -43,7 +39,7 @@ in { sensitivity = 0; # -1.0 - 1.0, 0 means no modification. touchpad = { tap-to-click = true; - natural_scroll = false; # this is not natrual + natural_scroll = false; # this is not natural disable_while_typing = false; # this is annoying }; numlock_by_default = true; # numlock enable @@ -124,9 +120,7 @@ in { enabled = dev.type != "laptop"; first_launch_animation = false; - bezier = [ - "overshot,0.13,0.99,0.29,1.1" - ]; + bezier = [ "overshot,0.13,0.99,0.29,1.1" ]; animation = [ "windows,1,4,overshot,slide" @@ -185,7 +179,7 @@ in { "$mod, L, exec, ${defaults.screenLocker}" "$mod, O, exec, obsidian" - # window managment + # window management "$mod, Q, killactive," # "$mod SHIFT, Q, exit," "$mod SHIFT, c, exec, hyprctl reload" @@ -279,81 +273,82 @@ in { ]; }; - extraConfig = let - mapMonitors = builtins.concatStringsSep "\n" (imap0 (i: monitor: ''monitor=${monitor},${ - if monitor == "eDP-1" - then "1920x1080@60" - else "preferred" - },${toString (i * 1920)}x0,1'') monitors); - - mapMonitorsToWs = builtins.concatStringsSep "\n" ( - builtins.genList ( - x: '' + extraConfig = + let + mapMonitors = builtins.concatStringsSep "\n" ( + imap0 ( + i: monitor: + ''monitor=${monitor},${ + if monitor == "eDP-1" then "1920x1080@60" else "preferred" + },${toString (i * 1920)}x0,1'' + ) monitors + ); + + mapMonitorsToWs = builtins.concatStringsSep "\n" ( + builtins.genList (x: '' workspace = ${toString (x + 1)}, monitor:${ - if (x + 1) <= 5 - then "${builtins.elemAt monitors 0} ${ - if (x + 1) == 1 - then ", default:true" - else "" - }" - else "${builtins.elemAt monitors 1}" + if (x + 1) <= 5 then + "${builtins.elemAt monitors 0} ${if (x + 1) == 1 then ", default:true" else ""}" + else + "${builtins.elemAt monitors 1}" } - '' - ) - 10 - ); - in '' - ${mapMonitors} - ${optionalString (builtins.length monitors != 1) "${mapMonitorsToWs}"} - - # █▀▄▀█ █▀█ █░█ █▀▀ - # █░▀░█ █▄█ ▀▄▀ ██▄ - bind=$mod, M, submap, move - submap=move - - binde = , left, movewindow, l - binde = , right, movewindow, r - binde = , up, movewindow, u - binde = , down, movewindow, d - binde = , j, movewindow, l - binde = , l, movewindow, r - binde = , i, movewindow, u - binde = , k, movewindow, d - - bind=,escape,submap,reset - submap=reset - - # █▀█ █▀▀ █▀ █ ▀█ █▀▀ - # █▀▄ ██▄ ▄█ █ █▄ ██▄ - bind=SUPER, R, submap, resize - submap=resize - - binde = , left, resizeactive, -20 0 - binde = , right, resizeactive, 20 0 - binde = , up, resizeactive, 0 -20 - binde = , down, resizeactive, 0 20 - binde = , h, resizeactive, -20 0 - binde = , j, resizeactive, 20 0 - binde = , i, resizeactive, 0 -20 - binde = , k, resizeactive, 0 20 - - bind=,escape,submap,reset - submap=reset - - ${ - builtins.concatStringsSep "\n" (builtins.genList ( - x: let - ws = let - c = (x + 1) / 10; - in + '') 10 + ); + in + '' + ${mapMonitors} + ${optionalString (builtins.length monitors != 1) "${mapMonitorsToWs}"} + + # █▀▄▀█ █▀█ █░█ █▀▀ + # █░▀░█ █▄█ ▀▄▀ ██▄ + bind=$mod, M, submap, move + submap=move + + binde = , left, movewindow, l + binde = , right, movewindow, r + binde = , up, movewindow, u + binde = , down, movewindow, d + binde = , j, movewindow, l + binde = , l, movewindow, r + binde = , i, movewindow, u + binde = , k, movewindow, d + + bind=,escape,submap,reset + submap=reset + + # █▀█ █▀▀ █▀ █ ▀█ █▀▀ + # █▀▄ ██▄ ▄█ █ █▄ ██▄ + bind=SUPER, R, submap, resize + submap=resize + + binde = , left, resizeactive, -20 0 + binde = , right, resizeactive, 20 0 + binde = , up, resizeactive, 0 -20 + binde = , down, resizeactive, 0 20 + binde = , h, resizeactive, -20 0 + binde = , j, resizeactive, 20 0 + binde = , i, resizeactive, 0 -20 + binde = , k, resizeactive, 0 20 + + bind=,escape,submap,reset + submap=reset + + ${builtins.concatStringsSep "\n" ( + builtins.genList ( + x: + let + ws = + let + c = (x + 1) / 10; + in builtins.toString (x + 1 - (c * 10)); - in '' + in + '' bind = $mod, ${ws}, workspace, ${toString (x + 1)} bind = $mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)} '' - ) - 10) - } - ''; + ) 10 + )} + ''; }; } diff --git a/home/isabel/configs/wm/hyprland/default.nix b/home/isabel/configs/wm/hyprland/default.nix index 9cb2834f8..5cccfd6fb 100644 --- a/home/isabel/configs/wm/hyprland/default.nix +++ b/home/isabel/configs/wm/hyprland/default.nix @@ -3,10 +3,12 @@ pkgs, osConfig, ... -}: let +}: +let inherit (osConfig.modules) environment; -in { - imports = [./config.nix]; +in +{ + imports = [ ./config.nix ]; config = lib.mkIf (environment.desktop == "Hyprland") { home.packages = with pkgs; [ @@ -20,7 +22,7 @@ in { systemd = { enable = true; - variables = ["--all"]; + variables = [ "--all" ]; extraCommands = [ "systemctl --user stop graphical-session.target" "systemctl --user start hyprland-session.target" diff --git a/home/isabel/configs/wm/sway/config.nix b/home/isabel/configs/wm/sway/config.nix index f5dd3cc13..850582170 100644 --- a/home/isabel/configs/wm/sway/config.nix +++ b/home/isabel/configs/wm/sway/config.nix @@ -1,8 +1,5 @@ +{ config, defaults, ... }: { - config, - defaults, - ... -}: { wayland.windowManager.sway = { config = { modifier = "Mod4"; @@ -11,21 +8,23 @@ menu = defaults.launcher; defaultWorkspace = "workspace number 1"; - keybindings = let - mod = config.wayland.windowManager.sway.config.modifier; - in { - # launchers - "${mod}+Return" = "exec ${defaults.terminal}"; - "${mod}+d" = "exec ${defaults.launcher}"; - "${mod}+b" = "exec ${defaults.browser}"; - "${mod}+e" = "exec ${defaults.fileManager}"; - "${mod}+o" = "exec obsidian"; + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + in + { + # launchers + "${mod}+Return" = "exec ${defaults.terminal}"; + "${mod}+d" = "exec ${defaults.launcher}"; + "${mod}+b" = "exec ${defaults.browser}"; + "${mod}+e" = "exec ${defaults.fileManager}"; + "${mod}+o" = "exec obsidian"; - "${mod}+l" = "exec swaylock"; - "${mod}+t" = "floating toggle"; - "Print" = "grim -g \"$(slurp)\""; - "${mod}+q" = "kill"; - }; + "${mod}+l" = "exec swaylock"; + "${mod}+t" = "floating toggle"; + "Print" = "grim -g \"$(slurp)\""; + "${mod}+q" = "kill"; + }; window = { titlebar = false; @@ -39,7 +38,7 @@ inner = 5; }; - startup = [{command = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY";}]; + startup = [ { command = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY"; } ]; input = { "type:pointer" = { diff --git a/home/isabel/configs/wm/sway/default.nix b/home/isabel/configs/wm/sway/default.nix index 92c5e0197..1de4c071b 100644 --- a/home/isabel/configs/wm/sway/default.nix +++ b/home/isabel/configs/wm/sway/default.nix @@ -1,11 +1,9 @@ -{ - lib, - osConfig, - ... -}: let +{ lib, osConfig, ... }: +let inherit (osConfig.modules) environment; -in { - imports = [./config.nix]; +in +{ + imports = [ ./config.nix ]; config = lib.mkIf (environment.desktop == "Sway") { wayland.windowManager.sway = { diff --git a/home/isabel/default.nix b/home/isabel/default.nix index 55eef1439..6f083c5df 100644 --- a/home/isabel/default.nix +++ b/home/isabel/default.nix @@ -1,10 +1,8 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) mkDefault ldTernary; -in { +in +{ imports = [ ./configs # per application configuration ./system # important system environment config @@ -20,7 +18,10 @@ in { home = { username = "isabel"; homeDirectory = "/${ldTernary pkgs "home" "Users"}/isabel"; - extraOutputsToInstall = ["doc" "devdoc"]; + extraOutputsToInstall = [ + "doc" + "devdoc" + ]; stateVersion = mkDefault "23.05"; }; diff --git a/home/isabel/packages/cli/desktop.nix b/home/isabel/packages/cli/desktop.nix index c203b55a7..361cf1ce6 100644 --- a/home/isabel/packages/cli/desktop.nix +++ b/home/isabel/packages/cli/desktop.nix @@ -4,14 +4,23 @@ self', osConfig, ... -}: let +}: +let inherit (lib) mkIf isAcceptedDevice optionals; - acceptedTypes = ["desktop" "laptop" "wsl" "lite" "hybrid"]; + acceptedTypes = [ + "desktop" + "laptop" + "wsl" + "lite" + "hybrid" + ]; cfg = osConfig.modules.programs; -in { +in +{ config = mkIf ((isAcceptedDevice osConfig acceptedTypes) && cfg.cli.enable && cfg.gui.enable) { - home.packages = with pkgs; + home.packages = + with pkgs; [ libnotify # needed for some notifications bitwarden-cli # bitwarden, my chosen password manager @@ -19,8 +28,6 @@ in { brightnessctl # brightness managed via cli dconf # interface with dconf settings ] - ++ optionals cfg.cli.modernShell.enable [ - self'.packages.catppuccinifier-cli - ]; + ++ optionals cfg.cli.modernShell.enable [ self'.packages.catppuccinifier-cli ]; }; } diff --git a/home/isabel/packages/cli/shared.nix b/home/isabel/packages/cli/shared.nix index b9f6fcb6b..534608f62 100644 --- a/home/isabel/packages/cli/shared.nix +++ b/home/isabel/packages/cli/shared.nix @@ -3,12 +3,15 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf optionals; cfg = osConfig.modules.programs; -in { +in +{ config = mkIf cfg.cli.enable { - home.packages = with pkgs; + home.packages = + with pkgs; [ unzip rsync @@ -23,8 +26,6 @@ in { vhs # programmatically make gifs glow # markdown preview ] - ++ optionals stdenv.isLinux [ - cached-nix-shell - ]; + ++ optionals stdenv.isLinux [ cached-nix-shell ]; }; } diff --git a/home/isabel/packages/cli/wayland.nix b/home/isabel/packages/cli/wayland.nix index 9aac7c83c..ee5e964d4 100644 --- a/home/isabel/packages/cli/wayland.nix +++ b/home/isabel/packages/cli/wayland.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: { +}: +{ config = lib.mkIf (lib.isWayland osConfig && osConfig.modules.programs.cli.enable) { home.packages = with pkgs; [ grim diff --git a/home/isabel/packages/darwin/default.nix b/home/isabel/packages/darwin/default.nix index 12443964a..2e4a03425 100644 --- a/home/isabel/packages/darwin/default.nix +++ b/home/isabel/packages/darwin/default.nix @@ -1,9 +1,7 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { - home.packages = with pkgs; + home.packages = + with pkgs; lib.mkIf stdenv.isDarwin [ libwebp # WebP image format library m-cli # A macOS cli tool to manage macOS - a true swis army knife diff --git a/home/isabel/packages/gui/gaming/default.nix b/home/isabel/packages/gui/gaming/default.nix index b0dc21114..1ba0ab2f2 100644 --- a/home/isabel/packages/gui/gaming/default.nix +++ b/home/isabel/packages/gui/gaming/default.nix @@ -3,10 +3,12 @@ pkgs, osConfig, ... -}: let +}: +let inherit (osConfig.modules) programs; -in { - imports = [./minecraft.nix]; +in +{ + imports = [ ./minecraft.nix ]; config = lib.mkIf programs.gaming.enable { home = { diff --git a/home/isabel/packages/gui/gaming/minecraft.nix b/home/isabel/packages/gui/gaming/minecraft.nix index 9b4cf5885..b87d6ca26 100644 --- a/home/isabel/packages/gui/gaming/minecraft.nix +++ b/home/isabel/packages/gui/gaming/minecraft.nix @@ -3,7 +3,8 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) isWayland mkIf; catppuccin-mocha = pkgs.fetchzip { @@ -24,7 +25,8 @@ zulu graalvm-ce ]; -in { +in +{ config = mkIf osConfig.modules.programs.gaming.minecraft.enable { home = { # PrismLauncher now with a cool theme @@ -33,22 +35,25 @@ in { recursive = true; }; - packages = let - glfw = - if (isWayland osConfig) - then pkgs.glfw-wayland-minecraft - else pkgs.glfw; - in [ - (pkgs.prismlauncher.override { - # get java versions required by various minecraft versions - # "write once run everywhere" my ass - jdks = javaPackages; - additionalPrograms = with pkgs; [gamemode mangohud jprofiler]; + packages = + let + glfw = if (isWayland osConfig) then pkgs.glfw-wayland-minecraft else pkgs.glfw; + in + [ + (pkgs.prismlauncher.override { + # get java versions required by various minecraft versions + # "write once run everywhere" my ass + jdks = javaPackages; + additionalPrograms = with pkgs; [ + gamemode + mangohud + jprofiler + ]; - # prismlauncher's glfw version to properly support wayland - inherit glfw; - }) - ]; + # prismlauncher's glfw version to properly support wayland + inherit glfw; + }) + ]; }; }; } diff --git a/home/isabel/packages/gui/shared.nix b/home/isabel/packages/gui/shared.nix index a5bb62a00..ddbd5ba03 100644 --- a/home/isabel/packages/gui/shared.nix +++ b/home/isabel/packages/gui/shared.nix @@ -3,18 +3,27 @@ lib, osConfig, ... -}: let - acceptedTypes = ["laptop" "desktop" "hybrid" "lite"]; -in { - config = lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.gui.enable) { - home.packages = with pkgs; [ - bitwarden # password manager - obsidian # note taking with markdown - pamixer # move evntually - # jellyfin-media-player - # mangal # tui manga finder + reader - # insomnia # rest client - nextcloud-client # cloud storage - ]; - }; +}: +let + acceptedTypes = [ + "laptop" + "desktop" + "hybrid" + "lite" + ]; +in +{ + config = + lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && osConfig.modules.programs.gui.enable) + { + home.packages = with pkgs; [ + bitwarden # password manager + obsidian # note taking with markdown + pamixer # move evntually + # jellyfin-media-player + # mangal # tui manga finder + reader + # insomnia # rest client + nextcloud-client # cloud storage + ]; + }; } diff --git a/home/isabel/packages/gui/wayland.nix b/home/isabel/packages/gui/wayland.nix index 97c357f65..6e7948fa9 100644 --- a/home/isabel/packages/gui/wayland.nix +++ b/home/isabel/packages/gui/wayland.nix @@ -3,16 +3,31 @@ pkgs, osConfig, ... -}: let - acceptedTypes = ["desktop" "laptop" "lite" "hybrid"]; -in { - config = lib.mkIf ((lib.isAcceptedDevice osConfig acceptedTypes) && (lib.isWayland osConfig) && osConfig.modules.programs.gui.enable) { - home.packages = with pkgs; - [ - swappy # used for screenshot area selection - wlsunset # reduce blue light at night - wl-gammactl - ] - ++ lib.optionals osConfig.modules.system.sound.enable [pavucontrol]; - }; +}: +let + acceptedTypes = [ + "desktop" + "laptop" + "lite" + "hybrid" + ]; +in +{ + config = + lib.mkIf + ( + (lib.isAcceptedDevice osConfig acceptedTypes) + && (lib.isWayland osConfig) + && osConfig.modules.programs.gui.enable + ) + { + home.packages = + with pkgs; + [ + swappy # used for screenshot area selection + wlsunset # reduce blue light at night + wl-gammactl + ] + ++ lib.optionals osConfig.modules.system.sound.enable [ pavucontrol ]; + }; } diff --git a/home/isabel/packages/pentesting.nix b/home/isabel/packages/pentesting.nix index 86d255789..1b45581f0 100644 --- a/home/isabel/packages/pentesting.nix +++ b/home/isabel/packages/pentesting.nix @@ -7,7 +7,8 @@ pkgs, osConfig, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.agnostic.pentesting.enable { home.packages = with pkgs; [ aircrack-ng # wifi tool diff --git a/home/isabel/packages/scripts/default.nix b/home/isabel/packages/scripts/default.nix index 58cddc66a..a6c380e1c 100644 --- a/home/isabel/packages/scripts/default.nix +++ b/home/isabel/packages/scripts/default.nix @@ -4,10 +4,12 @@ config, inputs', ... -}: let +}: +let inherit (lib) getExe; inherit (builtins) readFile; -in { +in +{ home = { sessionPath = [ "${config.home.homeDirectory}/.local/bin" @@ -17,20 +19,36 @@ in { file = { # Preview files script for fzf tab ".local/bin/preview" = { - source = getExe (pkgs.writeShellApplication { - name = "preview"; - runtimeInputs = with pkgs; [bat eza catimg] ++ [inputs'.nekowinston-nur.packages.icat]; - text = readFile ./preview.sh; - }); + source = getExe ( + pkgs.writeShellApplication { + name = "preview"; + runtimeInputs = + with pkgs; + [ + bat + eza + catimg + ] + ++ [ inputs'.nekowinston-nur.packages.icat ]; + text = readFile ./preview.sh; + } + ); }; # Extract the compressed file with the correct tool based on the extension ".local/bin/extract" = { - source = getExe (pkgs.writeShellApplication { - name = "extract"; - runtimeInputs = with pkgs; [zip unzip gnutar p7zip]; - text = readFile ./extract.sh; - }); + source = getExe ( + pkgs.writeShellApplication { + name = "extract"; + runtimeInputs = with pkgs; [ + zip + unzip + gnutar + p7zip + ]; + text = readFile ./extract.sh; + } + ); }; # ".local/bin/calcgrades.py" = { diff --git a/home/isabel/packages/tui/default.nix b/home/isabel/packages/tui/default.nix index b4b2d8aa3..60bc4c7fb 100644 --- a/home/isabel/packages/tui/default.nix +++ b/home/isabel/packages/tui/default.nix @@ -3,7 +3,8 @@ osConfig, lib, ... -}: { +}: +{ config = lib.mkIf osConfig.modules.programs.tui.enable { home.packages = with pkgs; [ # wishlist # fancy ssh diff --git a/home/isabel/services/shared/kdeconnect.nix b/home/isabel/services/shared/kdeconnect.nix index 72ca97e1b..5751dc5cd 100644 --- a/home/isabel/services/shared/kdeconnect.nix +++ b/home/isabel/services/shared/kdeconnect.nix @@ -1,10 +1,8 @@ -{ - lib, - osConfig, - ... -}: let +{ lib, osConfig, ... }: +let cfg = osConfig.modules.programs.gui.kdeconnect; -in { +in +{ services.kdeconnect = lib.mkIf cfg.enable { enable = true; indicator = cfg.indicator.enable; diff --git a/home/isabel/services/shared/nextcloud.nix b/home/isabel/services/shared/nextcloud.nix index ee3dffc19..f45f986cc 100644 --- a/home/isabel/services/shared/nextcloud.nix +++ b/home/isabel/services/shared/nextcloud.nix @@ -3,12 +3,18 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isAcceptedDevice mkGraphicalService; - acceptedTypes = ["desktop" "laptop" "hybrid"]; -in { + acceptedTypes = [ + "desktop" + "laptop" + "hybrid" + ]; +in +{ config = mkIf (isAcceptedDevice osConfig acceptedTypes && pkgs.stdenv.isLinux) { - home.packages = [pkgs.nextcloud-client]; + home.packages = [ pkgs.nextcloud-client ]; systemd.user.services.nextcloud = mkGraphicalService { Unit = { diff --git a/home/isabel/services/shared/nix-index.nix b/home/isabel/services/shared/nix-index.nix index f966f8df1..c2ba5b1df 100644 --- a/home/isabel/services/shared/nix-index.nix +++ b/home/isabel/services/shared/nix-index.nix @@ -1,5 +1,6 @@ -{inputs, ...}: { - imports = [inputs.nix-index-db.hmModules.nix-index]; +{ inputs, ... }: +{ + imports = [ inputs.nix-index-db.hmModules.nix-index ]; config = { # auto-run programs using nix-index-database diff --git a/home/isabel/services/shared/rnnoise.nix b/home/isabel/services/shared/rnnoise.nix index aff7a4fee..970ac68aa 100644 --- a/home/isabel/services/shared/rnnoise.nix +++ b/home/isabel/services/shared/rnnoise.nix @@ -3,11 +3,18 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf isAcceptedDevice; - acceptedTypes = ["desktop" "laptop" "lite" "hybrid"]; -in { + acceptedTypes = [ + "desktop" + "laptop" + "lite" + "hybrid" + ]; +in +{ config = mkIf (isAcceptedDevice osConfig acceptedTypes && pkgs.stdenv.isLinux) { xdg.configFile."pipewire/pipewire.conf.d/99-input-denoising.conf".text = builtins.toJSON { "context.modules" = [ @@ -29,7 +36,10 @@ in { } ]; }; - "audio.position" = ["FL" "FR"]; + "audio.position" = [ + "FL" + "FR" + ]; "capture.props" = { "node.name" = "effect_input.rnnoise"; "node.passive" = true; diff --git a/home/isabel/services/shared/tray.nix b/home/isabel/services/shared/tray.nix index 8dd3eebb7..d1561fb45 100644 --- a/home/isabel/services/shared/tray.nix +++ b/home/isabel/services/shared/tray.nix @@ -1,17 +1,20 @@ -{ - osConfig, - lib, - ... -}: let +{ osConfig, lib, ... }: +let inherit (lib) mkIf isAcceptedDevice; - acceptedTypes = ["lite" "hybrid" "laptop" "desktop"]; -in { + acceptedTypes = [ + "lite" + "hybrid" + "laptop" + "desktop" + ]; +in +{ config = mkIf (isAcceptedDevice osConfig acceptedTypes) { # https://github.com/nix-community/home-manager/issues/2064 systemd.user.targets.tray = { Unit = { Description = "Home Manager System Tray"; - Requires = ["graphical-session-pre.target"]; + Requires = [ "graphical-session-pre.target" ]; }; }; }; diff --git a/home/isabel/services/wayland/clipboard.nix b/home/isabel/services/wayland/clipboard.nix index ea1cdd3fd..b675ecdb5 100644 --- a/home/isabel/services/wayland/clipboard.nix +++ b/home/isabel/services/wayland/clipboard.nix @@ -3,10 +3,23 @@ pkgs, osConfig, ... -}: let - inherit (lib) mkIf isAcceptedDevice isWayland mkGraphicalService getExe; - acceptedTypes = ["desktop" "laptop" "lite" "hybrid"]; -in { +}: +let + inherit (lib) + mkIf + isAcceptedDevice + isWayland + mkGraphicalService + getExe + ; + acceptedTypes = [ + "desktop" + "laptop" + "lite" + "hybrid" + ]; +in +{ config = mkIf ((isAcceptedDevice osConfig acceptedTypes) && (isWayland osConfig)) { systemd.user.services = { cliphist = mkGraphicalService { diff --git a/home/isabel/services/wayland/screenlock/gtklock.nix b/home/isabel/services/wayland/screenlock/gtklock.nix index 174fe48f3..9fd70f8a7 100644 --- a/home/isabel/services/wayland/screenlock/gtklock.nix +++ b/home/isabel/services/wayland/screenlock/gtklock.nix @@ -5,10 +5,12 @@ osConfig, defaults, ... -}: let +}: +let inherit (lib) mkIf isWayland; -in { - imports = [self.homeManagerModules.gtklock]; +in +{ + imports = [ self.homeManagerModules.gtklock ]; config = mkIf ((isWayland osConfig) && defaults.screenLocker == "gtklock") { programs.gtklock = { @@ -16,9 +18,7 @@ in { package = pkgs.gtklock; config = { - modules = [ - "${pkgs.gtklock-powerbar-module.outPath}/lib/gtklock/powerbar-module.so" - ]; + modules = [ "${pkgs.gtklock-powerbar-module.outPath}/lib/gtklock/powerbar-module.so" ]; style = pkgs.writeText "gtklock-style.css" '' window { @@ -63,7 +63,7 @@ in { ''; }; - extraConfig = {}; + extraConfig = { }; }; }; } diff --git a/home/isabel/services/wayland/screenlock/swaylock.nix b/home/isabel/services/wayland/screenlock/swaylock.nix index ebc639f48..49aa99026 100644 --- a/home/isabel/services/wayland/screenlock/swaylock.nix +++ b/home/isabel/services/wayland/screenlock/swaylock.nix @@ -4,11 +4,13 @@ osConfig, defaults, ... -}: let +}: +let inherit (lib) mkIf isWayland; -in { +in +{ config = mkIf (isWayland osConfig && defaults.screenLocker == "swaylock") { - home.packages = with pkgs; [swaylock-effects]; + home.packages = with pkgs; [ swaylock-effects ]; programs.swaylock = { enable = true; diff --git a/home/isabel/system/env.nix b/home/isabel/system/env.nix index 75276b05a..e53f85df0 100644 --- a/home/isabel/system/env.nix +++ b/home/isabel/system/env.nix @@ -1,8 +1,5 @@ +{ osConfig, defaults, ... }: { - osConfig, - defaults, - ... -}: { home.sessionVariables = { EDITOR = defaults.editor; GIT_EDITOR = defaults.editor; diff --git a/home/isabel/system/gpg.nix b/home/isabel/system/gpg.nix index 5ba1ebb29..74e0e5dc9 100644 --- a/home/isabel/system/gpg.nix +++ b/home/isabel/system/gpg.nix @@ -4,9 +4,11 @@ config, osConfig, ... -}: let +}: +let inherit (osConfig.modules.system) video; -in { +in +{ services.gpg-agent = lib.mkIf pkgs.stdenv.isLinux { enable = true; enableBashIntegration = config.programs.bash.enable; @@ -15,9 +17,10 @@ in { enableNushellIntegration = config.programs.nushell.enable; pinentryPackage = - if video.enable - then pkgs.pinentry-gnome3 # requires services.dbus.packages = [ pkgs.gcr ] - else pkgs.pinentry-curses; + if video.enable then + pkgs.pinentry-gnome3 # requires services.dbus.packages = [ pkgs.gcr ] + else + pkgs.pinentry-curses; enableScDaemon = true; enableSshSupport = true; defaultCacheTtl = 1209600; diff --git a/home/isabel/system/ssh.nix b/home/isabel/system/ssh.nix index 491d31ec9..65d5b83db 100644 --- a/home/isabel/system/ssh.nix +++ b/home/isabel/system/ssh.nix @@ -1,49 +1,52 @@ -{osConfig, ...}: { - programs.ssh = let - inherit (osConfig.age) secrets; - in { - enable = true; - hashKnownHosts = true; - compression = true; +{ osConfig, ... }: +{ + programs.ssh = + let + inherit (osConfig.age) secrets; + in + { + enable = true; + hashKnownHosts = true; + compression = true; - matchBlocks = { - # git clients - "aur.archlinux.org" = { - user = "aur"; - hostname = "aur.archlinux.org"; - identityFile = secrets.keys-aur.path; - }; + matchBlocks = { + # git clients + "aur.archlinux.org" = { + user = "aur"; + hostname = "aur.archlinux.org"; + identityFile = secrets.keys-aur.path; + }; - "github.com" = { - user = "git"; - hostname = "github.com"; - identityFile = secrets.keys-gh.path; - }; + "github.com" = { + user = "git"; + hostname = "github.com"; + identityFile = secrets.keys-gh.path; + }; - "git.isabelroses.com" = { - user = "git"; - hostname = "git.isabelroses.com"; - port = 2222; - }; + "git.isabelroses.com" = { + user = "git"; + hostname = "git.isabelroses.com"; + port = 2222; + }; - # ORACLE vps' - "openvpn" = { - hostname = "132.145.55.42"; - user = "openvpnas"; - identityFile = secrets.keys-openvpn.path; - }; + # ORACLE vps' + "openvpn" = { + hostname = "132.145.55.42"; + user = "openvpnas"; + identityFile = secrets.keys-openvpn.path; + }; - "amity" = { - hostname = "143.47.240.116"; - identityFile = secrets.keys-amity.path; - }; + "amity" = { + hostname = "143.47.240.116"; + identityFile = secrets.keys-amity.path; + }; - # hetzner cloud vps - "luz".hostname = "91.107.198.173"; + # hetzner cloud vps + "luz".hostname = "91.107.198.173"; - # my local servers / clients - "hydra".hostname = "10.82.7.9"; - "tatsumaki".hostname = "10.82.9.147"; + # my local servers / clients + "hydra".hostname = "10.82.7.9"; + "tatsumaki".hostname = "10.82.9.147"; + }; }; - }; } diff --git a/home/isabel/system/xdg.nix b/home/isabel/system/xdg.nix index 8df60e7c0..a5be4254b 100644 --- a/home/isabel/system/xdg.nix +++ b/home/isabel/system/xdg.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: let +}: +let inherit (pkgs.stdenv) isLinux; browser = [ @@ -39,25 +40,24 @@ "audio/*" ]; - images = [ - "image/*" - ]; + images = [ "image/*" ]; associations = - (lib.genAttrs code (_: ["nvim.desktop"])) - // (lib.genAttrs media (_: ["mpv.desktop"])) - // (lib.genAttrs images (_: ["viewnoir.desktop"])) - // (lib.genAttrs browser (_: ["chromium.desktop"])) + (lib.genAttrs code (_: [ "nvim.desktop" ])) + // (lib.genAttrs media (_: [ "mpv.desktop" ])) + // (lib.genAttrs images (_: [ "viewnoir.desktop" ])) + // (lib.genAttrs browser (_: [ "chromium.desktop" ])) // { - "application/pdf" = ["org.pwmt.zathura.desktop"]; - "x-scheme-handler/spotify" = ["spotify.desktop"]; - "x-scheme-handler/discord" = ["Discord.desktop"]; - "inode/directory" = ["thunar.desktop"]; + "application/pdf" = [ "org.pwmt.zathura.desktop" ]; + "x-scheme-handler/spotify" = [ "spotify.desktop" ]; + "x-scheme-handler/discord" = [ "Discord.desktop" ]; + "inode/directory" = [ "thunar.desktop" ]; }; template = import lib.template.xdg "home-manager"; -in { - home.packages = with pkgs; lib.mkIf isLinux [xdg-utils]; +in +{ + home.packages = with pkgs; lib.mkIf isLinux [ xdg-utils ]; xdg = { enable = true; diff --git a/home/isabel/themes/global.nix b/home/isabel/themes/global.nix index 587fb77de..3bb466c39 100644 --- a/home/isabel/themes/global.nix +++ b/home/isabel/themes/global.nix @@ -4,10 +4,12 @@ inputs, osConfig, ... -}: let +}: +let cfg = osConfig.modules.style; -in { - imports = [inputs.catppuccin.homeManagerModules.catppuccin]; +in +{ + imports = [ inputs.catppuccin.homeManagerModules.catppuccin ]; config = { catppuccin = { diff --git a/home/isabel/themes/gtk.nix b/home/isabel/themes/gtk.nix index 87ebd4b5a..4fcca8512 100644 --- a/home/isabel/themes/gtk.nix +++ b/home/isabel/themes/gtk.nix @@ -4,17 +4,26 @@ config, osConfig, ... -}: let +}: +let inherit (lib) mkIf boolToNum; inherit (osConfig.modules) device; cfg = osConfig.modules.style; - acceptedTypes = ["laptop" "desktop" "hybrid" "lite"]; -in { + acceptedTypes = [ + "laptop" + "desktop" + "hybrid" + "lite" + ]; +in +{ config = mkIf (builtins.elem device.type acceptedTypes && pkgs.stdenv.isLinux) { - xdg.systemDirs.data = let - schema = pkgs.gsettings-desktop-schemas; - in ["${schema}/share/gsettings-schemas/${schema.name}"]; + xdg.systemDirs.data = + let + schema = pkgs.gsettings-desktop-schemas; + in + [ "${schema}/share/gsettings-schemas/${schema.name}" ]; home = { packages = with pkgs; [ diff --git a/home/isabel/themes/qt.nix b/home/isabel/themes/qt.nix index 5c11fac76..7fb849a9c 100644 --- a/home/isabel/themes/qt.nix +++ b/home/isabel/themes/qt.nix @@ -3,18 +3,25 @@ pkgs, osConfig, ... -}: let +}: +let inherit (lib) mkIf optionals; inherit (osConfig.modules) device; cfg = osConfig.modules.style; - acceptedTypes = ["laptop" "desktop" "hybrid" "lite"]; -in { + acceptedTypes = [ + "laptop" + "desktop" + "hybrid" + "lite" + ]; +in +{ config = mkIf (builtins.elem device.type acceptedTypes && pkgs.stdenv.isLinux) { xdg.configFile = { "kdeglobals".source = cfg.qt.kdeglobals.source; - "Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" { + "Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini { }).generate "kvantum.kvconfig" { General.theme = "catppuccin"; Applications.catppuccin = '' qt5ct, org.kde.dolphin, org.kde.kalendar, org.qbittorrent.qBittorrent, hyprland-share-picker, dolphin-emu, Nextcloud, nextcloud, cantata, org.kde.kid3-qt @@ -41,7 +48,8 @@ in { }; }; - home.packages = with pkgs; + home.packages = + with pkgs; [ libsForQt5.qt5ct breeze-icons diff --git a/hosts/amaterasu/default.nix b/hosts/amaterasu/default.nix index 4048a305c..d06b81e4a 100644 --- a/hosts/amaterasu/default.nix +++ b/hosts/amaterasu/default.nix @@ -1,12 +1,10 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf mkForce; inherit (config.modules) device; -in { - imports = [./hardware.nix]; +in +{ + imports = [ ./hardware.nix ]; config = { modules = { @@ -15,7 +13,10 @@ in { cpu = "intel"; gpu = "nvidia"; hasTPM = true; - monitors = ["HDMI-1" "DP-1"]; + monitors = [ + "HDMI-1" + "DP-1" + ]; hasBluetooth = true; hasSound = true; keyboard = "us"; @@ -42,7 +43,10 @@ in { }; }; - fs = ["ext4" "vfat"]; + fs = [ + "ext4" + "vfat" + ]; video.enable = true; sound.enable = true; bluetooth.enable = false; @@ -85,17 +89,23 @@ in { }; }; - hardware.nvidia = mkIf (builtins.elem device.gpu ["nvidia" "hybrid-nv"]) { - open = mkForce false; - - prime = { - offload.enable = true; - # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA - intelBusId = "PCI:0:2:0"; - - # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA - nvidiaBusId = "PCI:1:0:0"; - }; - }; + hardware.nvidia = + mkIf + (builtins.elem device.gpu [ + "nvidia" + "hybrid-nv" + ]) + { + open = mkForce false; + + prime = { + offload.enable = true; + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + }; + }; }; } diff --git a/hosts/amaterasu/hardware.nix b/hosts/amaterasu/hardware.nix index 62fd63649..373ff62b1 100644 --- a/hosts/amaterasu/hardware.nix +++ b/hosts/amaterasu/hardware.nix @@ -11,5 +11,5 @@ }; }; - swapDevices = [{device = "/dev/disk/by-uuid/da541a24-b4cc-426f-bbb6-4cced93fa4cf";}]; + swapDevices = [ { device = "/dev/disk/by-uuid/da541a24-b4cc-426f-bbb6-4cced93fa4cf"; } ]; } diff --git a/hosts/default.nix b/hosts/default.nix index d7444dd2e..0b1d05475 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,55 +1,67 @@ +{ inputs, withSystem, ... }: { - inputs, - withSystem, - ... -}: { - flake = let - lib = import ../parts/lib/import.nix {inherit inputs;}; - inherit (lib) mkMerge concatLists mkSystems mkNixosIsos; + flake = + let + lib = import ../parts/lib/import.nix { inherit inputs; }; + inherit (lib) + mkMerge + concatLists + mkSystems + mkNixosIsos + ; - # modules - modulePath = ../modules; # the base module path + # modules + modulePath = ../modules; # the base module path - # base modules, is the base of this system configuration and are shared across all systems (so the basics) - base = modulePath + /base; + # base modules, is the base of this system configuration and are shared across all systems (so the basics) + base = modulePath + /base; - # profiles module, these are sensible defaults for given hardware sets - # or meta profiles that are used to configure the system based on the requirements of the given machine - profilesPath = modulePath + /profiles; # the base directory for the types module - hardwareProfilesPath = profilesPath + /hardware; # the base directory for the hardware profiles - metaProfilesPath = profilesPath + /meta; # the base directory for the meta profiles + # profiles module, these are sensible defaults for given hardware sets + # or meta profiles that are used to configure the system based on the requirements of the given machine + profilesPath = modulePath + /profiles; # the base directory for the types module + hardwareProfilesPath = profilesPath + /hardware; # the base directory for the hardware profiles + metaProfilesPath = profilesPath + /meta; # the base directory for the meta profiles - # hardware profiles - laptop = hardwareProfilesPath + /laptop; # for laptop type configurations - desktop = hardwareProfilesPath + /desktop; # for desktop type configurations - server = [(hardwareProfilesPath + /server) headless]; # for server type configurations - wsl = [(hardwareProfilesPath + /wsl) headless]; # for wsl systems + # hardware profiles + laptop = hardwareProfilesPath + /laptop; # for laptop type configurations + desktop = hardwareProfilesPath + /desktop; # for desktop type configurations + server = [ + (hardwareProfilesPath + /server) + headless + ]; # for server type configurations + wsl = [ + (hardwareProfilesPath + /wsl) + headless + ]; # for wsl systems - # meta profiles - graphical = metaProfilesPath + /graphical; # for systems that have a graphical interface - headless = metaProfilesPath + /headless; # for headless systems + # meta profiles + graphical = metaProfilesPath + /graphical; # for systems that have a graphical interface + headless = metaProfilesPath + /headless; # for headless systems - # home-manager - homes = ../home; # home-manager configurations + # home-manager + homes = ../home; # home-manager configurations - # a list of shared modules, that means they need to be in almost all configs - shared = [base homes]; + # a list of shared modules, that means they need to be in almost all configs + shared = [ + base + homes + ]; - # extra specialArgs that are on all machines - sharedArgs = {inherit lib;}; - in + # extra specialArgs that are on all machines + sharedArgs = { + inherit lib; + }; + in mkMerge [ (mkSystems [ { host = "hydra"; inherit withSystem; system = "x86_64-linux"; - modules = - [ - laptop - graphical - ] - ++ concatLists [shared]; + modules = [ + laptop + graphical + ] ++ concatLists [ shared ]; specialArgs = sharedArgs; } @@ -57,12 +69,10 @@ host = "amaterasu"; inherit withSystem; system = "x86_64-linux"; - modules = - [ - desktop - graphical - ] - ++ concatLists [shared]; + modules = [ + desktop + graphical + ] ++ concatLists [ shared ]; specialArgs = sharedArgs; } @@ -70,7 +80,10 @@ host = "valkyrie"; inherit withSystem; system = "x86_64-linux"; - modules = concatLists [wsl shared]; + modules = concatLists [ + wsl + shared + ]; specialArgs = sharedArgs; } @@ -79,7 +92,10 @@ inherit withSystem; system = "x86_64-linux"; deployable = true; - modules = concatLists [server shared]; + modules = concatLists [ + server + shared + ]; specialArgs = sharedArgs; } @@ -87,7 +103,7 @@ host = "tatsumaki"; inherit withSystem; system = "aarch64-darwin"; - modules = concatLists [shared]; + modules = concatLists [ shared ]; specialArgs = sharedArgs; } ]) @@ -96,7 +112,7 @@ { host = "lilith"; system = "x86_64-linux"; - modules = [headless]; + modules = [ headless ]; specialArgs = sharedArgs; } ]) diff --git a/hosts/hydra/default.nix b/hosts/hydra/default.nix index 772c88ae7..3f19b2a92 100644 --- a/hosts/hydra/default.nix +++ b/hosts/hydra/default.nix @@ -1,12 +1,13 @@ -{pkgs, ...}: { - imports = [./hardware.nix]; +{ pkgs, ... }: +{ + imports = [ ./hardware.nix ]; config.modules = { device = { type = "hybrid"; cpu = "intel"; gpu = null; - monitors = ["eDP-1"]; + monitors = [ "eDP-1" ]; hasTPM = true; hasBluetooth = true; hasSound = true; @@ -25,7 +26,10 @@ plymouth.enable = false; }; - fs = ["btrfs" "vfat"]; + fs = [ + "btrfs" + "vfat" + ]; video.enable = true; sound.enable = true; bluetooth.enable = false; diff --git a/hosts/hydra/hardware.nix b/hosts/hydra/hardware.nix index 90a56e0da..d0675eb1f 100755 --- a/hosts/hydra/hardware.nix +++ b/hosts/hydra/hardware.nix @@ -11,5 +11,5 @@ }; }; - swapDevices = [{device = "/dev/disk/by-uuid/e45cd5a5-ec02-4933-9adb-5d968f270f54";}]; + swapDevices = [ { device = "/dev/disk/by-uuid/e45cd5a5-ec02-4933-9adb-5d968f270f54"; } ]; } diff --git a/hosts/luz/default.nix b/hosts/luz/default.nix index 1f33f8e1c..f855b7bc2 100644 --- a/hosts/luz/default.nix +++ b/hosts/luz/default.nix @@ -25,7 +25,11 @@ loadRecommendedModules = true; }; - fs = ["vfat" "exfat" "ext4"]; + fs = [ + "vfat" + "exfat" + "ext4" + ]; video.enable = false; sound.enable = false; bluetooth.enable = false; diff --git a/hosts/luz/overrides.nix b/hosts/luz/overrides.nix index 46683acdb..2bbfee0a8 100644 --- a/hosts/luz/overrides.nix +++ b/hosts/luz/overrides.nix @@ -1,14 +1,11 @@ +{ lib, config, ... }: { - lib, - config, - ... -}: { config = { services.smartd.enable = lib.mkForce false; # Unavailable - device lacks SMART capability. boot = { growPartition = !config.boot.initrd.systemd.enable; - kernelParams = ["net.ifnames=0"]; + kernelParams = [ "net.ifnames=0" ]; kernel = { sysctl = { "net.ipv4.ip_forward" = true; diff --git a/hosts/valkyrie/default.nix b/hosts/valkyrie/default.nix index 65f2746cd..e35102a22 100644 --- a/hosts/valkyrie/default.nix +++ b/hosts/valkyrie/default.nix @@ -5,7 +5,7 @@ cpu = "intel"; gpu = null; hasTPM = true; - monitors = []; + monitors = [ ]; hasBluetooth = true; hasSound = false; keyboard = "us"; @@ -32,7 +32,10 @@ }; }; - fs = ["ext4" "vfat"]; + fs = [ + "ext4" + "vfat" + ]; video.enable = false; sound.enable = false; bluetooth.enable = false; diff --git a/modules/base/activation/default.nix b/modules/base/activation/default.nix index a1f8ef4a4..7f65a4712 100644 --- a/modules/base/activation/default.nix +++ b/modules/base/activation/default.nix @@ -1,23 +1,26 @@ -{config, ...}: { +{ config, ... }: +{ system.activationScripts = { # https://github.com/colemickens/nixcfg/blob/main/mixins/ssh.nix # symlink root's ssh config to ours # to fix nix-daemon's ability to remote build since it sshs from the root account - root_ssh_config = let - inherit (config.modules.system) mainUser; + root_ssh_config = + let + inherit (config.modules.system) mainUser; - sshDir = "${config.users.users.${mainUser}.home}/.ssh"; - in { - text = '' - ( - # symlink root ssh config to ours so daemon can use our agent/keys/etc... - mkdir -p /root/.ssh - ln -sf ${sshDir}/config /root/.ssh/config - ln -sf ${sshDir}/known_hosts /root/.ssh/known_hosts - ln -sf ${sshDir}/known_hosts /root/.ssh/known_hosts - ) - ''; - deps = []; - }; + sshDir = "${config.users.users.${mainUser}.home}/.ssh"; + in + { + text = '' + ( + # symlink root ssh config to ours so daemon can use our agent/keys/etc... + mkdir -p /root/.ssh + ln -sf ${sshDir}/config /root/.ssh/config + ln -sf ${sshDir}/known_hosts /root/.ssh/known_hosts + ln -sf ${sshDir}/known_hosts /root/.ssh/known_hosts + ) + ''; + deps = [ ]; + }; }; } diff --git a/modules/base/environment/fonts.nix b/modules/base/environment/fonts.nix index c525060fc..aa3514186 100644 --- a/modules/base/environment/fonts.nix +++ b/modules/base/environment/fonts.nix @@ -1,8 +1,5 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) ldTernary; fnts = with pkgs; [ @@ -34,31 +31,40 @@ ]; }) ]; -in { +in +{ config.fonts = { # will be removed after this PR is merged: # https://github.com/LnL7/nix-darwin/pull/754 fontDir.enable = true; } - // ldTernary pkgs - { + // ldTernary pkgs { fontconfig = { enable = true; defaultFonts = { - monospace = ["CommitMono" "Symbols Nerd Font"]; - sansSerif = ["CommitMono" "Symbols Nerd Font"]; - serif = ["Noto Serif" "Symbols Nerd Font"]; - emoji = ["Noto Color Emoji" "Symbols Nerd Font"]; + monospace = [ + "CommitMono" + "Symbols Nerd Font" + ]; + sansSerif = [ + "CommitMono" + "Symbols Nerd Font" + ]; + serif = [ + "Noto Serif" + "Symbols Nerd Font" + ]; + emoji = [ + "Noto Color Emoji" + "Symbols Nerd Font" + ]; }; }; packages = fnts; fontDir.decompressFonts = true; - } - { - fonts = fnts; - }; + } { fonts = fnts; }; } diff --git a/modules/base/environment/vars.nix b/modules/base/environment/vars.nix index 16ea76e4c..e32867c0d 100644 --- a/modules/base/environment/vars.nix +++ b/modules/base/environment/vars.nix @@ -1,8 +1,9 @@ -{config, ...}: { +{ config, ... }: +{ # variables that I want to set globally on all systems environment = { - # the below can be done for faster shell reponse time but it can break things, and it did + # the below can be done for faster shell response time but it can break things, and it did # binsh = "${pkgs.dash}/bin/dash"; variables = { diff --git a/modules/base/nix/environment.nix b/modules/base/nix/environment.nix index b27075719..1b3513d0e 100644 --- a/modules/base/nix/environment.nix +++ b/modules/base/nix/environment.nix @@ -1,8 +1,5 @@ +{ pkgs, inputs, ... }: { - pkgs, - inputs, - ... -}: { environment = { etc = with inputs; { # set channels (backwards compatibility) @@ -14,7 +11,10 @@ "nixos/flake".source = self; }; - # git is reqired for flakes, and cachix for binary substituters - systemPackages = with pkgs; [git cachix]; + # git is required for flakes, and cachix for binary substituters + systemPackages = with pkgs; [ + git + cachix + ]; }; } diff --git a/modules/base/nix/nix.nix b/modules/base/nix/nix.nix index b8e9a2bde..98600f0a0 100644 --- a/modules/base/nix/nix.nix +++ b/modules/base/nix/nix.nix @@ -3,21 +3,25 @@ pkgs, inputs, ... -}: let +}: +let inherit (builtins) attrValues mapAttrs; inherit (lib) filterAttrs mkForce ldTernary; flakeInputs = filterAttrs (name: value: (value ? outputs) && (name != "self")) inputs; -in { +in +{ nix = { # https://github.com/nix-community/home-manager/issues/4692#issuecomment-1848832609 package = pkgs.lix; # pin the registry to avoid downloading and evaluating a new nixpkgs version everytime - registry = mapAttrs (_: v: {flake = v;}) flakeInputs; + registry = mapAttrs (_: v: { flake = v; }) flakeInputs; # We love legacy support (for now) - nixPath = ldTernary pkgs (attrValues (mapAttrs (k: v: "${k}=${v.outPath}") flakeInputs)) (mkForce (mapAttrs (_: v: v.outPath) flakeInputs)); + nixPath = ldTernary pkgs (attrValues (mapAttrs (k: v: "${k}=${v.outPath}") flakeInputs)) ( + mkForce (mapAttrs (_: v: v.outPath) flakeInputs) + ); # set up garbage collection to run daily, and removing packages after 3 days gc = { @@ -37,15 +41,28 @@ in { # https://github.com/NixOS/nix/issues/7273 auto-optimise-store = pkgs.stdenv.isLinux; # allow sudo users to mark the following values as trusted - allowed-users = ["@wheel" "root" "isabel"]; + allowed-users = [ + "@wheel" + "root" + "isabel" + ]; # only allow sudo users to manage the nix store - trusted-users = ["@wheel" "root" "isabel"]; + trusted-users = [ + "@wheel" + "root" + "isabel" + ]; # let the system decide the number of max jobs max-jobs = "auto"; # build inside sandboxed environments sandbox = pkgs.stdenv.isLinux; # supported system features - system-features = ["nixos-test" "kvm" "recursive-nix" "big-parallel"]; + system-features = [ + "nixos-test" + "kvm" + "recursive-nix" + "big-parallel" + ]; # continue building derivations even if one fails keep-going = true; # show more log lines for failed builds, as this happens alot and is useful diff --git a/modules/base/nix/nixpkgs.nix b/modules/base/nix/nixpkgs.nix index d610b8087..228b24161 100644 --- a/modules/base/nix/nixpkgs.nix +++ b/modules/base/nix/nixpkgs.nix @@ -1,8 +1,5 @@ +{ self, inputs, ... }: { - self, - inputs, - ... -}: { nixpkgs = { # pkgs = self.legacyPackages.${config.nixpkgs.system}; @@ -10,7 +7,7 @@ allowUnfree = true; allowBroken = false; allowUnsupportedSystem = true; - permittedInsecurePackages = ["electron-25.9.0"]; + permittedInsecurePackages = [ "electron-25.9.0" ]; }; overlays = [ diff --git a/modules/base/nix/system.nix b/modules/base/nix/system.nix index adcadf681..cacbca267 100644 --- a/modules/base/nix/system.nix +++ b/modules/base/nix/system.nix @@ -1,9 +1,7 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) mkDefault ldTernary; -in { +in +{ system.stateVersion = ldTernary pkgs (mkDefault "23.05") (mkDefault 4); } diff --git a/modules/base/options/device/default.nix b/modules/base/options/device/default.nix index 96595ae88..60a74ae91 100644 --- a/modules/base/options/device/default.nix +++ b/modules/base/options/device/default.nix @@ -1,9 +1,19 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkOption types; -in { +in +{ options.modules.device = { type = mkOption { - type = types.enum ["laptop" "desktop" "server" "hybrid" "wsl" "lite" "vm"]; + type = types.enum [ + "laptop" + "desktop" + "server" + "hybrid" + "wsl" + "lite" + "vm" + ]; default = ""; }; }; diff --git a/modules/base/options/environment/default.nix b/modules/base/options/environment/default.nix index 414b38a56..022dd5221 100644 --- a/modules/base/options/environment/default.nix +++ b/modules/base/options/environment/default.nix @@ -3,14 +3,23 @@ pkgs, config, ... -}: let - inherit (lib) ldTernary mkEnableOption mkOption types; +}: +let + inherit (lib) + ldTernary + mkEnableOption + mkOption + types + ; inherit (config.modules.system) mainUser; cfg = config.modules.environment; -in { +in +{ options.modules.environment = { - useHomeManager = mkEnableOption "Whether to use home-manager or not." // {default = true;}; + useHomeManager = mkEnableOption "Whether to use home-manager or not." // { + default = true; + }; flakePath = mkOption { type = types.str; @@ -19,22 +28,32 @@ in { }; desktop = mkOption { - type = types.nullOr (types.enum ["Hyprland" "Sway"]); + type = types.nullOr ( + types.enum [ + "Hyprland" + "Sway" + ] + ); default = "Hyprland"; description = "The desktop environment to be used."; }; loginManager = mkOption { - type = types.nullOr (types.enum ["greetd" "gdm" "lightdm" "sddm"]); + type = types.nullOr ( + types.enum [ + "greetd" + "gdm" + "lightdm" + "sddm" + ] + ); default = "greetd"; description = "The login manager to be used by the system."; }; - isWayland = - mkEnableOption "Infered data based on the desktop environment." - // { - default = cfg.desktop == "Hyprland" || cfg.desktop == "Sway"; - }; + isWayland = mkEnableOption "Inferred data based on the desktop environment." // { + default = cfg.desktop == "Hyprland" || cfg.desktop == "Sway"; + }; }; config.assertions = [ diff --git a/modules/base/options/programs/default.nix b/modules/base/options/programs/default.nix index 501c61124..30876f857 100644 --- a/modules/base/options/programs/default.nix +++ b/modules/base/options/programs/default.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkEnableOption mkOption types; cfg = config.modules.programs; -in { +in +{ imports = [ ./defaults.nix ./gaming.nix @@ -22,8 +20,12 @@ in { }; editors = { - neovim.enable = mkEnableOption "Neovim editor" // {default = true;}; - vscode.enable = mkEnableOption "VScode editor" // {default = cfg.gui.enable;}; + neovim.enable = mkEnableOption "Neovim editor" // { + default = true; + }; + vscode.enable = mkEnableOption "VScode editor" // { + default = cfg.gui.enable; + }; micro.enable = mkEnableOption "Micro editor"; }; @@ -32,11 +34,15 @@ in { }; cli = { - enable = mkEnableOption "Enable CLI programs" // {default = true;}; + enable = mkEnableOption "Enable CLI programs" // { + default = true; + }; modernShell.enable = mkEnableOption "Enable programs for a more modern shell"; }; - tui.enable = mkEnableOption "Enable TUI programs" // {default = true;}; + tui.enable = mkEnableOption "Enable TUI programs" // { + default = true; + }; gui = { enable = mkEnableOption "Enable GUI programs"; @@ -55,32 +61,42 @@ in { }; bars = { - ags.enable = mkEnableOption "Enable ags bar/launcher" // {default = cfg.gui.enable;}; + ags.enable = mkEnableOption "Enable ags bar/launcher" // { + default = cfg.gui.enable; + }; eww.enable = mkEnableOption "Enable eww bar/launcher"; waybar.enable = mkEnableOption "Enable waybar"; }; browsers = { chromium = { - enable = mkEnableOption "Chromium browser" // {default = cfg.gui.enable;}; + enable = mkEnableOption "Chromium browser" // { + default = cfg.gui.enable; + }; ungoogled = mkEnableOption "Enable ungoogled-chromium Tweaks"; }; firefox = { enable = mkEnableOption "Firefox browser"; - schizofox = mkEnableOption "Enable Schizofox Firefox Tweaks" // {default = true;}; + schizofox = mkEnableOption "Enable Schizofox Firefox Tweaks" // { + default = true; + }; }; }; terminals = { - wezterm.enable = mkEnableOption "WezTerm terminal emulator" // {default = cfg.gui.enable;}; + wezterm.enable = mkEnableOption "WezTerm terminal emulator" // { + default = cfg.gui.enable; + }; ghostty.enable = mkEnableOption "Ghostty terminal emulator"; kitty.enable = mkEnableOption "Kitty terminal emulator"; alacritty.enable = mkEnableOption "Alacritty terminal emulator"; }; fileManagers = { - thunar.enable = mkEnableOption "Enable thunar file manager" // {default = cfg.gui.enable;}; + thunar.enable = mkEnableOption "Enable thunar file manager" // { + default = cfg.gui.enable; + }; dolphin.enable = mkEnableOption "Enable dolphin file manager"; nemo.enable = mkEnableOption "Enable nemo file manager"; }; diff --git a/modules/base/options/programs/defaults.nix b/modules/base/options/programs/defaults.nix index 789483b47..b6221dd11 100644 --- a/modules/base/options/programs/defaults.nix +++ b/modules/base/options/programs/defaults.nix @@ -1,50 +1,88 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkOption types mdDoc; -in { +in +{ options.modules.programs.defaults = { terminal = mkOption { - type = types.enum ["alacritty" "kitty" "wezterm" "foot"]; + type = types.enum [ + "alacritty" + "kitty" + "wezterm" + "foot" + ]; default = "wezterm"; }; fileManager = mkOption { - type = types.enum ["thunar" "dolphin" "nemo"]; + type = types.enum [ + "thunar" + "dolphin" + "nemo" + ]; default = "thunar"; }; browser = mkOption { - type = types.enum ["schizofox" "chromium"]; + type = types.enum [ + "schizofox" + "chromium" + ]; default = "chromium"; }; editor = mkOption { - type = types.enum ["nvim" "codium"]; + type = types.enum [ + "nvim" + "codium" + ]; default = "nvim"; }; launcher = mkOption { - type = with types; nullOr (enum ["rofi" "wofi"]); + type = + with types; + nullOr (enum [ + "rofi" + "wofi" + ]); default = "rofi"; }; bar = mkOption { - type = with types; nullOr (enum ["eww" "waybar" "ags"]); + type = + with types; + nullOr (enum [ + "eww" + "waybar" + "ags" + ]); default = "ags"; }; screenLocker = mkOption { - type = with types; nullOr (enum ["swaylock" "gtklock"]); + type = + with types; + nullOr (enum [ + "swaylock" + "gtklock" + ]); default = "gtklock"; description = mdDoc '' The lockscreen module to be loaded by home-manager. ''; }; - noiseSupressor = mkOption { - type = with types; nullOr (enum ["rnnoise" "noisetorch"]); + noiseSuppressor = mkOption { + type = + with types; + nullOr (enum [ + "rnnoise" + "noisetorch" + ]); default = "rnnoise"; description = mdDoc '' - The noise supressor to be used for desktop systems with sound enabled. + The noise suppressor to be used for desktop systems with sound enabled. ''; }; }; diff --git a/modules/base/options/programs/gaming.nix b/modules/base/options/programs/gaming.nix index 01db66337..f885bef91 100644 --- a/modules/base/options/programs/gaming.nix +++ b/modules/base/options/programs/gaming.nix @@ -1,20 +1,26 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkEnableOption; -in { - options.modules.programs.gaming = let - cfg = config.modules.programs.gaming; - in { - enable = mkEnableOption "Enable packages required for the device to be gaming-ready"; - emulation.enable = mkEnableOption "Enable programs required to emulate other platforms"; +in +{ + options.modules.programs.gaming = + let + cfg = config.modules.programs.gaming; + in + { + enable = mkEnableOption "Enable packages required for the device to be gaming-ready"; + emulation.enable = mkEnableOption "Enable programs required to emulate other platforms"; - steam.enable = mkEnableOption "Enable Steam" // {default = cfg.enable;}; - minecraft.enable = mkEnableOption "Enable minecraft"; + steam.enable = mkEnableOption "Enable Steam" // { + default = cfg.enable; + }; + minecraft.enable = mkEnableOption "Enable minecraft"; - gamescope.enable = mkEnableOption "Gamescope compositing manager" // {default = cfg.enable;}; - mangohud.enable = mkEnableOption "Enable MangoHud" // {default = cfg.enable;}; - }; + gamescope.enable = mkEnableOption "Gamescope compositing manager" // { + default = cfg.enable; + }; + mangohud.enable = mkEnableOption "Enable MangoHud" // { + default = cfg.enable; + }; + }; } diff --git a/modules/base/options/services/default.nix b/modules/base/options/services/default.nix index 2e9eb7199..a5ed5c7fe 100644 --- a/modules/base/options/services/default.nix +++ b/modules/base/options/services/default.nix @@ -1,14 +1,22 @@ -{lib, ...}: let - inherit (lib) mkEnableOption mkOption types mapAttrs; +{ lib, ... }: +let + inherit (lib) + mkEnableOption + mkOption + types + mapAttrs + ; rdomain = "isabelroses.com"; - mkServiceOption = name: { - port ? 0, - host ? "127.0.0.1", - domain ? rdomain, - extraConfig ? {}, - }: + mkServiceOption = + name: + { + port ? 0, + host ? "127.0.0.1", + domain ? rdomain, + extraConfig ? { }, + }: { enable = mkEnableOption "Enable the ${name} service"; @@ -31,7 +39,8 @@ }; } // extraConfig; -in { +in +{ options.modules.services = mapAttrs mkServiceOption { vaultwarden = { @@ -43,7 +52,7 @@ in { port = 3000; }; - blahaj = {}; + blahaj = { }; vikunja = { domain = "todo.${rdomain}"; @@ -59,8 +68,8 @@ in { } // { dev = mapAttrs mkServiceOption { - vscode-server = {}; - cyberchef = {}; + vscode-server = { }; + cyberchef = { }; forgejo = { port = 7000; @@ -139,10 +148,10 @@ in { # databases database = mapAttrs mkServiceOption { - influxdb = {}; - mysql = {}; - postgresql = {}; - redis = {}; + influxdb = { }; + mysql = { }; + postgresql = { }; + redis = { }; mongodb = { host = "0.0.0.0"; @@ -151,8 +160,8 @@ in { # networking services networking = mapAttrs mkServiceOption { - nginx = {}; - cloudflared = {}; + nginx = { }; + cloudflared = { }; headscale = { port = 8085; diff --git a/modules/base/options/system/default.nix b/modules/base/options/system/default.nix index 082d17cda..d6c99d17c 100644 --- a/modules/base/options/system/default.nix +++ b/modules/base/options/system/default.nix @@ -1,11 +1,9 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkOption optionals types; -in { - config.warnings = optionals (config.modules.system.users == []) [ +in +{ + config.warnings = optionals (config.modules.system.users == [ ]) [ '' You have not added any users to be supported by your system. You may end up with an unbootable system! @@ -22,7 +20,7 @@ in { users = mkOption { type = with types; listOf str; - default = ["isabel"]; + default = [ "isabel" ]; description = '' A list of users that you wish to declare as your non-system users. The first username in the list will be treated as your main user unless `modules.system.mainUser` is set. diff --git a/modules/base/options/themes/default.nix b/modules/base/options/themes/default.nix index 70e6666ba..6c2086cdf 100644 --- a/modules/base/options/themes/default.nix +++ b/modules/base/options/themes/default.nix @@ -1,11 +1,12 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) mkOption mkEnableOption types; -in { - imports = [./gtk.nix ./qt.nix]; +in +{ + imports = [ + ./gtk.nix + ./qt.nix + ]; options.modules.style = { forceGtk = mkEnableOption "Force GTK applications to use the GTK theme"; useKvantum = mkEnableOption "Use Kvantum to theme QT applications"; diff --git a/modules/base/options/themes/gtk.nix b/modules/base/options/themes/gtk.nix index 93cb96b33..4ade01342 100644 --- a/modules/base/options/themes/gtk.nix +++ b/modules/base/options/themes/gtk.nix @@ -1,10 +1,8 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) mkOption mkEnableOption types; -in { +in +{ options.modules.style.gtk = { enable = mkEnableOption "GTK theming options"; usePortal = mkEnableOption "native desktop portal use for filepickers"; diff --git a/modules/base/options/themes/qt.nix b/modules/base/options/themes/qt.nix index 3ac942952..094614c9f 100644 --- a/modules/base/options/themes/qt.nix +++ b/modules/base/options/themes/qt.nix @@ -3,10 +3,12 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkEnableOption mkOption types; cfg = config.modules.style; -in { +in +{ options.modules.style.qt = { enable = mkEnableOption "QT Style Module"; @@ -14,9 +16,9 @@ in { package = mkOption { type = types.package; default = pkgs.catppuccin-kde.override { - flavour = ["mocha"]; - accents = ["pink"]; - winDecStyles = ["modern"]; + flavour = [ "mocha" ]; + accents = [ "pink" ]; + winDecStyles = [ "modern" ]; }; description = "The theme package to be used for QT programs"; }; diff --git a/modules/base/secrets.nix b/modules/base/secrets.nix index ad74dd4e6..1bca3dc5a 100644 --- a/modules/base/secrets.nix +++ b/modules/base/secrets.nix @@ -6,7 +6,8 @@ inputs, inputs', ... -}: let +}: +let inherit (lib) mkIf ldTernary; inherit (config.modules) services; inherit (pkgs.stdenv) isDarwin; @@ -17,34 +18,44 @@ userGroup = ldTernary pkgs "users" "admin"; - mkSecret = cond: { - file, - owner ? "root", - group ? ldTernary pkgs "root" "admin", - mode ? "400", - ... - }: + mkSecret = + cond: + { + file, + owner ? "root", + group ? ldTernary pkgs "root" "admin", + mode ? "400", + ... + }: mkIf cond { file = "${self}/secrets/${file}.age"; inherit owner group mode; }; - mkSecretWithPath = cond: { - file, - path, - owner ? "root", - group ? ldTernary pkgs "root" "admin", - mode ? "400", - ... - }: + mkSecretWithPath = + cond: + { + file, + path, + owner ? "root", + group ? ldTernary pkgs "root" "admin", + mode ? "400", + ... + }: mkIf cond { file = "${self}/secrets/${file}.age"; - inherit path owner group mode; + inherit + path + owner + group + mode + ; }; -in { - imports = [inputs.agenix.nixosModules.default]; +in +{ + imports = [ inputs.agenix.nixosModules.default ]; - environment.systemPackages = [inputs'.agenix.packages.default]; + environment.systemPackages = [ inputs'.agenix.packages.default ]; age = { identityPaths = [ @@ -124,13 +135,13 @@ in { }; # mailserver - mailserver-isabel = mkSecret services.mailserver.enable {file = "mailserver/isabel";}; - mailserver-vaultwarden = mkSecret services.mailserver.enable {file = "mailserver/vaultwarden";}; - mailserver-database = mkSecret services.mailserver.enable {file = "mailserver/database";}; - mailserver-grafana = mkSecret services.mailserver.enable {file = "mailserver/grafana";}; - mailserver-git = mkSecret services.mailserver.enable {file = "mailserver/git";}; - mailserver-noreply = mkSecret services.mailserver.enable {file = "mailserver/noreply";}; - mailserver-spam = mkSecret services.mailserver.enable {file = "mailserver/spam";}; + mailserver-isabel = mkSecret services.mailserver.enable { file = "mailserver/isabel"; }; + mailserver-vaultwarden = mkSecret services.mailserver.enable { file = "mailserver/vaultwarden"; }; + mailserver-database = mkSecret services.mailserver.enable { file = "mailserver/database"; }; + mailserver-grafana = mkSecret services.mailserver.enable { file = "mailserver/grafana"; }; + mailserver-git = mkSecret services.mailserver.enable { file = "mailserver/git"; }; + mailserver-noreply = mkSecret services.mailserver.enable { file = "mailserver/noreply"; }; + mailserver-spam = mkSecret services.mailserver.enable { file = "mailserver/spam"; }; mailserver-grafana-nohash = mkSecret services.monitoring.grafana.enable { file = "mailserver/grafana-nohash"; @@ -150,9 +161,7 @@ in { group = "grafana"; }; - blahaj-env = mkSecret services.blahaj.enable { - file = "blahaj-env"; - }; + blahaj-env = mkSecret services.blahaj.enable { file = "blahaj-env"; }; vikunja-env = mkSecret services.vikunja.enable { file = "vikunja-env"; @@ -210,9 +219,7 @@ in { group = "wakapi"; }; - mongodb-passwd = mkSecret services.database.mongodb.enable { - file = "mongodb-passwd"; - }; + mongodb-passwd = mkSecret services.database.mongodb.enable { file = "mongodb-passwd"; }; }; }; } diff --git a/modules/base/users/isabel.nix b/modules/base/users/isabel.nix index be881da79..928de78d6 100644 --- a/modules/base/users/isabel.nix +++ b/modules/base/users/isabel.nix @@ -3,11 +3,15 @@ pkgs, config, ... -}: let +}: +let inherit (lib) ldTernary ifTheyExist; - keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMQDiHbMSinj8twL9cTgPOfI6OMexrTZyHX27T8gnMj2 isabel@isabelroses.com"]; -in { + keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMQDiHbMSinj8twL9cTgPOfI6OMexrTZyHX27T8gnMj2 isabel@isabelroses.com" + ]; +in +{ # boot.initrd.network.ssh.authorizedKeys = mkIf isLinux keys; users.users.isabel = @@ -16,35 +20,33 @@ in { home = "/${ldTernary pkgs "home" "Users"}/isabel"; shell = ldTernary pkgs pkgs.fish pkgs.zsh; } - // ( - ldTernary pkgs { - isNormalUser = true; - uid = 1000; - initialPassword = "changeme"; - extraGroups = - [ - "wheel" - "nix" - ] - ++ ifTheyExist config [ - "network" - "networkmanager" - "systemd-journal" - "audio" - "video" - "input" - "plugdev" - "lp" - "tss" - "power" - "wireshark" - "mysql" - "docker" - "podman" - "git" - "libvirtd" - "cloudflared" - ]; - } {} - ); + // (ldTernary pkgs { + isNormalUser = true; + uid = 1000; + initialPassword = "changeme"; + extraGroups = + [ + "wheel" + "nix" + ] + ++ ifTheyExist config [ + "network" + "networkmanager" + "systemd-journal" + "audio" + "video" + "input" + "plugdev" + "lp" + "tss" + "power" + "wireshark" + "mysql" + "docker" + "podman" + "git" + "libvirtd" + "cloudflared" + ]; + } { }); } diff --git a/modules/base/users/root.nix b/modules/base/users/root.nix index 0e6d7f447..e35a4567d 100644 --- a/modules/base/users/root.nix +++ b/modules/base/users/root.nix @@ -1,8 +1,5 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { users.users.root = lib.mkIf pkgs.stdenv.isLinux { initialPassword = "changeme"; diff --git a/modules/darwin/activation.nix b/modules/darwin/activation.nix index 3e4ffaca1..a1d5f5dd2 100644 --- a/modules/darwin/activation.nix +++ b/modules/darwin/activation.nix @@ -1,22 +1,21 @@ +{ lib, config, ... }: { - lib, - config, - ... -}: { system.activationScripts = { # https://github.com/ryan4yin/nix-darwin-kickstarter/blob/main/minimal/modules/system.nix#L14-L19 - postUserActivation.text = let + postUserActivation.text = + let + in # persistentApps = # lib.concatMapStrings (x: ''"'' + x + ''" '') # config.system.defaults.CustomUserPreferences."com.apple.dock".persistent-apps; - in '' - # Choose and order dock icons - # defaults write com.apple.dock persistent-apps -array $ {persistentApps} + '' + # Choose and order dock icons + # defaults write com.apple.dock persistent-apps -array $ {persistentApps} - # activateSettings -u will reload the settings from the database and apply them to the current session, - # so we do not need to logout and login again to make the changes take effect. - /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u - ''; + # activateSettings -u will reload the settings from the database and apply them to the current session, + # so we do not need to logout and login again to make the changes take effect. + /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + ''; # Settings that don't have an option in nix-darwin postActivation.text = '' diff --git a/modules/darwin/brew/default.nix b/modules/darwin/brew/default.nix index ce5d857d7..f270d87a8 100644 --- a/modules/darwin/brew/default.nix +++ b/modules/darwin/brew/default.nix @@ -1,5 +1,5 @@ { - imports = [./environment.nix]; + imports = [ ./environment.nix ]; config = { # homebrew need to be installed manually, see https://brew.sh @@ -19,16 +19,12 @@ # You need to install all these Apps manually first so that your apple account have records for them. # otherwise Apple Store will refuse to install them. # For details, see https://github.com/mas-cli/mas - masApps = {}; + masApps = { }; - taps = [ - "homebrew/bundle" - ]; + taps = [ "homebrew/bundle" ]; # `brew install` - brews = [ - "openjdk" - ]; + brews = [ "openjdk" ]; # `brew install --cask` casks = [ diff --git a/modules/darwin/brew/environment.nix b/modules/darwin/brew/environment.nix index 6fb8eaa90..4890e2c36 100644 --- a/modules/darwin/brew/environment.nix +++ b/modules/darwin/brew/environment.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ environment = { variables = { HOMEBREW_NO_ANALYTICS = "1"; @@ -7,6 +8,6 @@ HOMEBREW_NO_ENV_HINTS = "0"; }; - systemPath = [config.homebrew.brewPrefix]; + systemPath = [ config.homebrew.brewPrefix ]; }; } diff --git a/modules/darwin/nix.nix b/modules/darwin/nix.nix index dcb3ea17f..d8db688a7 100644 --- a/modules/darwin/nix.nix +++ b/modules/darwin/nix.nix @@ -5,7 +5,10 @@ Minute = 15; }; - settings.extra-platforms = ["aarch64-darwin" "x86-64-darwin"]; + settings.extra-platforms = [ + "aarch64-darwin" + "x86-64-darwin" + ]; }; services.nix-daemon.enable = true; diff --git a/modules/darwin/security/pam.nix b/modules/darwin/security/pam.nix index 12f20cdb5..c3f8db7a6 100644 --- a/modules/darwin/security/pam.nix +++ b/modules/darwin/security/pam.nix @@ -1,3 +1 @@ -{ - security.pam.enableSudoTouchIdAuth = true; -} +{ security.pam.enableSudoTouchIdAuth = true; } diff --git a/modules/darwin/services/skhd.nix b/modules/darwin/services/skhd.nix index d37b89e27..cd4c6662e 100644 --- a/modules/darwin/services/skhd.nix +++ b/modules/darwin/services/skhd.nix @@ -1,50 +1,48 @@ -{lib, ...}: { +{ lib, ... }: +{ services.skhd = { enable = true; - skhdConfig = let - mapKeymaps = with builtins; - cmd: - concatStringsSep "\n" (map (i: - replaceStrings ["Num"] [ - (toString ( - if (i == 10) - then 0 - else i - )) - ] - cmd) (lib.range 1 10)); - in '' - #!/usr/bin/env sh + skhdConfig = + let + mapKeymaps = + with builtins; + cmd: + concatStringsSep "\n" ( + map (i: replaceStrings [ "Num" ] [ (toString (if (i == 10) then 0 else i)) ] cmd) (lib.range 1 10) + ); + in + '' + #!/usr/bin/env sh - # focus window - cmd + ctrl - h : yabai -m window --focus west - cmd + ctrl - j : yabai -m window --focus south - cmd + ctrl - k : yabai -m window --focus north - cmd + ctrl - l : yabai -m window --focus east + # focus window + cmd + ctrl - h : yabai -m window --focus west + cmd + ctrl - j : yabai -m window --focus south + cmd + ctrl - k : yabai -m window --focus north + cmd + ctrl - l : yabai -m window --focus east - # move window - cmd + shift - h : yabai -m window --warp west - cmd + shift - j : yabai -m window --warp south - cmd + shift - k : yabai -m window --warp north - cmd + shift - l : yabai -m window --warp east + # move window + cmd + shift - h : yabai -m window --warp west + cmd + shift - j : yabai -m window --warp south + cmd + shift - k : yabai -m window --warp north + cmd + shift - l : yabai -m window --warp east - # toggle sticky/floating - cmd + shift - s: yabai -m window --toggle sticky --toggle float --toggle topmost - cmd + shift - d: yabai -m window --toggle float + # toggle sticky/floating + cmd + shift - s: yabai -m window --toggle sticky --toggle float --toggle topmost + cmd + shift - d: yabai -m window --toggle float - # fullacreen - shift + alt - f : yabai -m window --toggle native-fullscreen + # fullacreen + shift + alt - f : yabai -m window --toggle native-fullscreen - # open apps - cmd - return : open -na "$HOME/Applications/Home Manager Apps/WezTerm.app" - cmd - b : open -na "Arc" - cmd - e : open -na "Finder" + # open apps + cmd - return : open -na "$HOME/Applications/Home Manager Apps/WezTerm.app" + cmd - b : open -na "Arc" + cmd - e : open -na "Finder" - # ONLY WORKS WITH SIP DISABLED: - # switch to space - ${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"} - # send window to desktop and follow focus - ${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num"} - ''; + # ONLY WORKS WITH SIP DISABLED: + # switch to space + ${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"} + # send window to desktop and follow focus + ${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num"} + ''; }; } diff --git a/modules/darwin/services/yabai.nix b/modules/darwin/services/yabai.nix index dcb86f94d..49a648b8a 100644 --- a/modules/darwin/services/yabai.nix +++ b/modules/darwin/services/yabai.nix @@ -22,24 +22,34 @@ window_shadow = "float"; }; - extraConfig = let - rule = "yabai -m rule --add"; - ignored = app: builtins.concatStringsSep "\n" (map (e: ''${rule} app="${e}" manage=off sticky=off layer=above'') app); - unmanaged = app: builtins.concatStringsSep "\n" (map (e: ''${rule} app="${e}" manage=off'') app); - in '' - # auto-inject scripting additions - yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" - sudo yabai --load-sa + extraConfig = + let + rule = "yabai -m rule --add"; + ignored = + app: + builtins.concatStringsSep "\n" ( + map (e: ''${rule} app="${e}" manage=off sticky=off layer=above'') app + ); + unmanaged = app: builtins.concatStringsSep "\n" (map (e: ''${rule} app="${e}" manage=off'') app); + in + '' + # auto-inject scripting additions + yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" + sudo yabai --load-sa - ${ignored ["JetBrains Toolbox" "Sip" "iStat Menus"]} - ${unmanaged ["Steam"]} - yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off - yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off - yabai -m rule --add label="Arc" app="^Arc$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance|[Bb]itwarden)$" manage=off + ${ignored [ + "JetBrains Toolbox" + "Sip" + "iStat Menus" + ]} + ${unmanaged [ "Steam" ]} + yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off + yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off + yabai -m rule --add label="Arc" app="^Arc$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance|[Bb]itwarden)$" manage=off - # etc. - ${rule} manage=off app="CleanShot" - ${rule} manage=off sticky=on app="OBS Studio" - ''; + # etc. + ${rule} manage=off app="CleanShot" + ${rule} manage=off sticky=on app="OBS Studio" + ''; }; } diff --git a/modules/extra/darwin/default.nix b/modules/extra/darwin/default.nix index 0967ef424..ffcd4415b 100644 --- a/modules/extra/darwin/default.nix +++ b/modules/extra/darwin/default.nix @@ -1 +1 @@ -{} +{ } diff --git a/modules/extra/home-manager/gtklock.nix b/modules/extra/home-manager/gtklock.nix index 486413378..664dede2f 100644 --- a/modules/extra/home-manager/gtklock.nix +++ b/modules/extra/home-manager/gtklock.nix @@ -5,10 +5,20 @@ pkgs, ... }: -with builtins; let +with builtins; +let cfg = config.programs.gtklock; - inherit (lib) types mkIf mkOption mkEnableOption mkPackageOptionMD literalExpression optionals optionalString; + inherit (lib) + types + mkIf + mkOption + mkEnableOption + mkPackageOptionMD + literalExpression + optionals + optionalString + ; inherit (lib.generators) toINI; # the main config includes two very niche options: style (which takes a path) and modules, which takes a list of module paths @@ -19,15 +29,16 @@ with builtins; let [main] ${optionalString (cfg.config.gtk-theme != "") "gtk-theme=${cfg.config.gtk-theme}"} ${optionalString (cfg.config.style != "") "style=${cfg.config.style}"} - ${optionalString (cfg.config.modules != []) "modules=${concatStringsSep ";" cfg.config.modules}"} + ${optionalString (cfg.config.modules != [ ]) "modules=${concatStringsSep ";" cfg.config.modules}"} ''; - finalConfig = baseConfig + optionals (cfg.extraConfig != null) (toINI {} cfg.extraConfig); -in { - meta.maintainers = [maintainers.NotAShelf]; + finalConfig = baseConfig + optionals (cfg.extraConfig != null) (toINI { } cfg.extraConfig); +in +{ + meta.maintainers = [ maintainers.NotAShelf ]; options.programs.gtklock = { enable = mkEnableOption "GTK-based lockscreen for Wayland"; - package = mkPackageOptionMD pkgs "gtklock" {}; + package = mkPackageOptionMD pkgs "gtklock" { }; config = { gtk-theme = mkOption { @@ -40,7 +51,12 @@ in { }; style = mkOption { - type = with types; oneOf [str path]; + type = + with types; + oneOf [ + str + path + ]; default = ""; description = '' The css file to be used for gtklock. @@ -58,7 +74,7 @@ in { modules = mkOption { type = with types; listOf (either package str); - default = []; + default = [ ]; description = '' A list of gtklock modulesto use. Can either be packages, absolute paths, or strings. ''; @@ -95,7 +111,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [cfg.package]; + home.packages = [ cfg.package ]; xdg.configFile."gtklock/config.ini".source = pkgs.writeText "gtklock-config.ini" finalConfig; }; diff --git a/modules/extra/home-manager/hyfetch.nix b/modules/extra/home-manager/hyfetch.nix index 20eb3ed60..1737745f5 100644 --- a/modules/extra/home-manager/hyfetch.nix +++ b/modules/extra/home-manager/hyfetch.nix @@ -3,20 +3,28 @@ pkgs, config, ... -}: let - inherit (lib) mkEnableOption mkPackageOption mkOption mkIf types; +}: +let + inherit (lib) + mkEnableOption + mkPackageOption + mkOption + mkIf + types + ; cfg = config.programs.hyfetch; - settingsFormat = pkgs.formats.json {}; -in { + settingsFormat = pkgs.formats.json { }; +in +{ options.programs.hyfetch = { enable = mkEnableOption "hyfetch"; - package = mkPackageOption pkgs "hyfetch" {}; + package = mkPackageOption pkgs "hyfetch" { }; settings = mkOption { - default = {}; + default = { }; type = settingsFormat.type; description = '' Configuration written to {file}`$XDG_CONFIG_HOME/hyfetch.json`. @@ -42,7 +50,7 @@ in { }; neofetchConfig = mkOption { - default = {}; + default = { }; type = with types; nullOr (either path lines); description = '' Configuration written to {file}`$XDG_CONFIG_HOME/neofetch/config.conf`. @@ -52,15 +60,18 @@ in { }; config = mkIf cfg.enable { - home.packages = [cfg.package]; + home.packages = [ cfg.package ]; xdg.configFile = { - "hyfetch.json" = mkIf (cfg.settings != {}) {source = settingsFormat.generate "hyfetch.json" cfg.settings;}; - "neofetch/config.conf" = mkIf (cfg.neofetchConfig != {}) { + "hyfetch.json" = mkIf (cfg.settings != { }) { + source = settingsFormat.generate "hyfetch.json" cfg.settings; + }; + "neofetch/config.conf" = mkIf (cfg.neofetchConfig != { }) { source = - if builtins.isPath cfg.neofetchConfig || lib.isStorePath cfg.neofetchConfig - then cfg.neofetchConfig - else pkgs.writeText "neofetch/config.conf" cfg.neofetchConfig; + if builtins.isPath cfg.neofetchConfig || lib.isStorePath cfg.neofetchConfig then + cfg.neofetchConfig + else + pkgs.writeText "neofetch/config.conf" cfg.neofetchConfig; }; }; }; diff --git a/modules/extra/nixos/default.nix b/modules/extra/nixos/default.nix index 62a9ab2af..dda2a100a 100644 --- a/modules/extra/nixos/default.nix +++ b/modules/extra/nixos/default.nix @@ -1,5 +1 @@ -{ - imports = [ - ./wakapi.nix - ]; -} +{ imports = [ ./wakapi.nix ]; } diff --git a/modules/extra/nixos/wakapi.nix b/modules/extra/nixos/wakapi.nix index e359dce5f..422bce0c1 100644 --- a/modules/extra/nixos/wakapi.nix +++ b/modules/extra/nixos/wakapi.nix @@ -3,14 +3,25 @@ lib, pkgs, ... -}: let +}: +let # modified from https://git.winston.sh/winston/deployment-flake/src/branch/main/modules/wakapi.nix cfg = config.services.wakapi; user = config.users.users.wakapi.name; group = config.users.groups.wakapi.name; - settingsFormat = pkgs.formats.yaml {}; - inherit (lib) mkOption mkEnableOption mkPackageOption types mkIf optional mkMerge mkDefault singleton; + settingsFormat = pkgs.formats.yaml { }; + inherit (lib) + mkOption + mkEnableOption + mkPackageOption + types + mkIf + optional + mkMerge + mkDefault + singleton + ; settingsFile = settingsFormat.generate "wakapi-settings" cfg.settings; @@ -20,15 +31,15 @@ createHome = false; isSystemUser = true; }; - users.groups.wakapi = {}; + users.groups.wakapi = { }; }; serviceConfig = { systemd.services.wakapi = { description = "Wakapi (self-hosted WakaTime-compatible backend)"; - wants = ["network-online.target"]; - after = ["network-online.target"]; - wantedBy = ["multi-user.target"]; + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; script = '' exec ${pkgs.wakapi}/bin/wakapi -config ${settingsFile} @@ -55,7 +66,11 @@ ProtectKernelTunables = true; ProtectProc = "invisible"; ProtectSystem = "strict"; - RestrictAddressFamilies = ["AF_INET" "AF_INET6" "AF_UNIX"]; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + "AF_UNIX" + ]; RestrictNamespaces = true; RestrictRealtime = true; RestrictSUIDSGID = true; @@ -102,8 +117,8 @@ }; systemd.services.wakapi = { - requires = ["postgresql.service"]; - after = ["postgresql.service"]; + requires = [ "postgresql.service" ]; + after = [ "postgresql.service" ]; }; }; @@ -122,10 +137,11 @@ public_url = mkDefault cfg.domain; }; }; -in { +in +{ options.services.wakapi = { enable = mkEnableOption "Wakapi"; - package = mkPackageOption pkgs "wakapi" {}; + package = mkPackageOption pkgs "wakapi" { }; port = mkOption { type = types.int; @@ -216,7 +232,7 @@ in { settings = mkOption { inherit (settingsFormat) type; - default = {}; + default = { }; description = '' Settings for Wakapi. diff --git a/modules/iso/boot.nix b/modules/iso/boot.nix index 7ce1b7343..f00d2d3e2 100644 --- a/modules/iso/boot.nix +++ b/modules/iso/boot.nix @@ -1,6 +1,7 @@ -{lib, ...}: { +{ lib, ... }: +{ boot = { - kernelParams = lib.mkAfter ["noquiet"]; + kernelParams = lib.mkAfter [ "noquiet" ]; # we have no need for systemd in initrd installation media initrd.systemd = { diff --git a/modules/iso/console.nix b/modules/iso/console.nix index cc34e96b7..43833814e 100644 --- a/modules/iso/console.nix +++ b/modules/iso/console.nix @@ -1,27 +1,8 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ console = { # hidpi terminal font font = "${pkgs.terminus_font}/share/consolefonts/ter-d18n.psf.gz"; keyMap = "en"; - - # make the terminal that bit more readable - colors = [ - "1e1e2e" - "585b70" - "bac2de" - "a6adc8" - "f38ba8" - "f38ba8" - "a6e3a1" - "a6e3a1" - "f9e2af" - "f9e2af" - "89b4fa" - "89b4fa" - "f5c2e7" - "f5c2e7" - "94e2d5" - "94e2d5" - ]; }; } diff --git a/modules/iso/image.nix b/modules/iso/image.nix index 6c4696370..4a99fec08 100644 --- a/modules/iso/image.nix +++ b/modules/iso/image.nix @@ -4,47 +4,51 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkImageMediaOverride; -in { +in +{ # We don't want to alter the iso image itself so we prevent rebuilds system.switch.enable = false; - isoImage = let - # Get the hostname from our networking name provided in the mkNixosIso builder - # If none is set then default to "nixos" - hostname = config.networking.hostName or "nixos"; - - # We get the rev of the git tree here and if we don't have one that - # must mean we have made local changes so we call the git tree "dirty" - rev = self.shortRev or "dirty"; - - # Give all the isos a consistant name - # $hostname-$release-$rev-$arch - name = "${hostname}-${config.system.nixos.release}-${rev}-${pkgs.stdenv.hostPlatform.uname.processor}"; - in { - # From the name defined before we end up with: name.iso - isoName = mkImageMediaOverride "${name}.iso"; - - # volumeID is used is used by stage 1 of the boot process, so it must be distintctive - volumeID = mkImageMediaOverride "${name}"; - - # maximum compression, in exchange for build speed - squashfsCompression = "zstd -Xcompression-level 10"; - - # ISO image should be an EFI-bootable volume - makeEfiBootable = true; - - # ISO image should be bootable from USB - makeUsbBootable = true; - - # This should help for debugging if we ever get an unbootable system and have to - # prefrom some repairs on the system itself - contents = [ - { - source = pkgs.memtest86plus + "/memtest.bin"; - target = "boot/memtest.bin"; - } - ]; - }; + isoImage = + let + # Get the hostname from our networking name provided in the mkNixosIso builder + # If none is set then default to "nixos" + hostname = config.networking.hostName or "nixos"; + + # We get the rev of the git tree here and if we don't have one that + # must mean we have made local changes so we call the git tree "dirty" + rev = self.shortRev or "dirty"; + + # Give all the isos a consistent name + # $hostname-$release-$rev-$arch + name = "${hostname}-${config.system.nixos.release}-${rev}-${pkgs.stdenv.hostPlatform.uname.processor}"; + in + { + # From the name defined before we end up with: name.iso + isoName = mkImageMediaOverride "${name}.iso"; + + # volumeID is used is used by stage 1 of the boot process, so it must be distintctive + volumeID = mkImageMediaOverride "${name}"; + + # maximum compression, in exchange for build speed + squashfsCompression = "zstd -Xcompression-level 10"; + + # ISO image should be an EFI-bootable volume + makeEfiBootable = true; + + # ISO image should be bootable from USB + makeUsbBootable = true; + + # This should help for debugging if we ever get an unbootable system and have to + # prefrom some repairs on the system itself + contents = [ + { + source = pkgs.memtest86plus + "/memtest.bin"; + target = "boot/memtest.bin"; + } + ]; + }; } diff --git a/modules/iso/networking.nix b/modules/iso/networking.nix index 8e724b42c..d213150ff 100644 --- a/modules/iso/networking.nix +++ b/modules/iso/networking.nix @@ -1,14 +1,11 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { # use networkmanager in the live environment networking.networkmanager.enable = lib.mkForce true; networking.wireless.enable = lib.mkForce false; # allow ssh into the system for headless installs - systemd.services.sshd.wantedBy = pkgs.lib.mkForce ["multi-user.target"]; + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; users.users.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZmzCZrKIdTSUf1GFWB9bF2nDRfjdWI4+jfcZbsscsSdNHBBaYnDjQftj8lVUMmSzjKasIeU3yKmuai6t2GBnIfxZq+5L/uvIZhYfgJwcjhLkXZL2CCG1UtxFV6Gwe2RJWA7VrGzhfU+Kjx6O7oCKlwy0M6cknUU+G17rqoGlOwDtMiDR+as6UoxeEf//xIdvBdEb3A+JGo4WVx1+/8XedKM5ngyY0zH6vKb12kudVMjJsqQ4cES8JozuL4LMEExsPRALPVGYQ69ulMLl4zkbbP2Ne5UO9Uf/BsBF2DJU3uWVIG6nAUIeNr4NXaa7h4/cnlpP+f4H/7MvOeif85TYU2WK+yiy11z7N6wxbB1/Mtq2sMldMq3Csb7A0GkeF1qXazG0yp4Oa0sene0JfPI3AsYSFOHuByVRkb6kI3f+d/xogwoLJ645olZLcobsqWoS4TQZHj44CTRseXzCQiUGBKV9Bb/7hqY7TbcwRd7cEW91lbXIzO6PUDhi1E59VqYE= isabel" ]; diff --git a/modules/iso/nix.nix b/modules/iso/nix.nix index d7726f9f7..3941b35e7 100644 --- a/modules/iso/nix.nix +++ b/modules/iso/nix.nix @@ -1,12 +1,19 @@ { nix.settings = { - experimental-features = ["nix-command" "flakes" "repl-flake"]; + experimental-features = [ + "nix-command" + "flakes" + "repl-flake" + ]; log-lines = 30; - extra-experimental-features = ["ca-derivations"]; + extra-experimental-features = [ "ca-derivations" ]; warn-dirty = false; http-connections = 50; accept-flake-config = true; auto-optimise-store = true; - trusted-users = ["root" "nixos"]; + trusted-users = [ + "root" + "nixos" + ]; }; } diff --git a/modules/iso/programs.nix b/modules/iso/programs.nix index c5b2a956d..ab18bd448 100644 --- a/modules/iso/programs.nix +++ b/modules/iso/programs.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ # we need git for flakes programs.git = { enable = true; diff --git a/modules/iso/space.nix b/modules/iso/space.nix index ca8c28979..2d886e79d 100644 --- a/modules/iso/space.nix +++ b/modules/iso/space.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkDefault mkForce; -in { +in +{ # disable sound related programs sound.enable = false; @@ -19,6 +21,6 @@ in { noXlibs = mkDefault true; # no packages other, other then the ones I provide - defaultPackages = []; + defaultPackages = [ ]; }; } diff --git a/modules/iso/users.nix b/modules/iso/users.nix index 5af1b3d5d..6389c8ba7 100644 --- a/modules/iso/users.nix +++ b/modules/iso/users.nix @@ -6,6 +6,6 @@ password = "nixos"; description = "default"; isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; }; } diff --git a/modules/nixos/emulation.nix b/modules/nixos/emulation.nix index b4032a439..bd7693a7a 100644 --- a/modules/nixos/emulation.nix +++ b/modules/nixos/emulation.nix @@ -3,12 +3,17 @@ pkgs, lib, ... -}: let +}: +let inherit (lib) mkIf; sys = config.modules.system; -in { +in +{ config = mkIf sys.emulation.enable { - nix.settings.extra-sandbox-paths = ["/run/binfmt" "${pkgs.qemu}"]; + nix.settings.extra-sandbox-paths = [ + "/run/binfmt" + "${pkgs.qemu}" + ]; boot.binfmt = { emulatedSystems = sys.emulation.systems; diff --git a/modules/nixos/encryption.nix b/modules/nixos/encryption.nix index 281b6cdf5..e8c174b8b 100644 --- a/modules/nixos/encryption.nix +++ b/modules/nixos/encryption.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.system.encryption; -in { +in +{ config = mkIf cfg.enable { # mildly improves performance for the disk encryption boot = { @@ -33,7 +31,7 @@ in { bypassWorkqueues = true; preLVM = true; - # the device with the maching id will be searched for the key file + # the device with the matching id will be searched for the key file keyFile = mkIf (cfg.keyFile != null) "${cfg.keyFile}"; keyFileSize = cfg.keySize; diff --git a/modules/nixos/gaming/gamemode.nix b/modules/nixos/gaming/gamemode.nix index 81c26cd74..f620628f6 100644 --- a/modules/nixos/gaming/gamemode.nix +++ b/modules/nixos/gaming/gamemode.nix @@ -3,17 +3,21 @@ pkgs, config, ... -}: let +}: +let inherit (lib) makeBinPath mkIf optionalString; env = config.modules.environment; - programs = makeBinPath (with pkgs; [ - hyprland - coreutils - power-profiles-daemon - systemd - ]); + programs = makeBinPath ( + with pkgs; + [ + hyprland + coreutils + power-profiles-daemon + systemd + ] + ); startscript = pkgs.writeShellScript "gamemode-start" '' ${optionalString (env.desktop == "Hyprland") '' @@ -38,8 +42,9 @@ ''; cfg = config.modules.programs.gaming; -in { - imports = [./steam.nix]; +in +{ + imports = [ ./steam.nix ]; config = mkIf cfg.enable { programs = { gamemode = { diff --git a/modules/nixos/gaming/steam.nix b/modules/nixos/gaming/steam.nix index 66c2ee488..100b41479 100644 --- a/modules/nixos/gaming/steam.nix +++ b/modules/nixos/gaming/steam.nix @@ -3,9 +3,11 @@ pkgs, config, ... -}: let +}: +let cfg = config.modules.programs.gaming; -in { +in +{ programs.steam = lib.mkIf cfg.enable { enable = true; # Open ports in the firewall for Steam Remote Play @@ -14,14 +16,13 @@ in { # dedicatedServer.openFirewall = true; # Compatibility tools to install # this option used to be provided by modules/shared/nixos/steam - extraCompatPackages = [ - pkgs.proton-ge-bin.steamcompattool - ]; + extraCompatPackages = [ pkgs.proton-ge-bin.steamcompattool ]; }; nixpkgs = { config = { - allowUnfreePredicate = pkg: + allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) [ "steam" "steam-original" @@ -31,39 +32,46 @@ in { overlays = [ (_: prev: { - steam = prev.steam.override ({extraPkgs ? _: [], ...}: { - extraPkgs = pkgs': - (extraPkgs pkgs') - ++ (with pkgs'; [ - # Add missing dependencies - libgdiplus - keyutils - libkrb5 - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - at-spi2-atk - fmodex - gtk3 - gtk3-x11 - harfbuzz - icu - glxinfo - inetutils - libthai - mono5 - pango - stdenv.cc.cc.lib - strace - zlib - libunwind # for titanfall 2 Northstart launcher - ]); - }); + steam = prev.steam.override ( + { + extraPkgs ? _: [ ], + ... + }: + { + extraPkgs = + pkgs': + (extraPkgs pkgs') + ++ (with pkgs'; [ + # Add missing dependencies + libgdiplus + keyutils + libkrb5 + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + at-spi2-atk + fmodex + gtk3 + gtk3-x11 + harfbuzz + icu + glxinfo + inetutils + libthai + mono5 + pango + stdenv.cc.cc.lib + strace + zlib + libunwind # for titanfall 2 Northstart launcher + ]); + } + ); }) ]; }; diff --git a/modules/nixos/hardware/bluetooth.nix b/modules/nixos/hardware/bluetooth.nix index e2730f23c..448794f47 100644 --- a/modules/nixos/hardware/bluetooth.nix +++ b/modules/nixos/hardware/bluetooth.nix @@ -3,17 +3,19 @@ pkgs, lib, ... -}: let +}: +let sys = config.modules.system; -in { +in +{ config = lib.mkIf (sys.bluetooth.enable) { - modules.system.boot.extraKernelParams = ["btusb"]; + modules.system.boot.extraKernelParams = [ "btusb" ]; hardware.bluetooth = { enable = true; package = pkgs.bluez; #hsphfpd.enable = true; powerOnBoot = true; - disabledPlugins = ["sap"]; + disabledPlugins = [ "sap" ]; settings = { General = { JustWorksRepairing = "always"; diff --git a/modules/nixos/hardware/cpu/amd.nix b/modules/nixos/hardware/cpu/amd.nix index ed5cbfc42..c3be7f811 100644 --- a/modules/nixos/hardware/cpu/amd.nix +++ b/modules/nixos/hardware/cpu/amd.nix @@ -1,11 +1,9 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (config.modules) device; inherit (lib) mkIf; -in { +in +{ config = mkIf (device.cpu == "amd" || device.cpu == "vm-amd") { hardware.cpu.amd.updateMicrocode = true; diff --git a/modules/nixos/hardware/cpu/intel.nix b/modules/nixos/hardware/cpu/intel.nix index 9ee927b26..c73ee05e8 100644 --- a/modules/nixos/hardware/cpu/intel.nix +++ b/modules/nixos/hardware/cpu/intel.nix @@ -3,17 +3,22 @@ pkgs, config, ... -}: let +}: +let inherit (config.modules) device; -in { +in +{ config = lib.mkIf (device.cpu == "intel" || device.cpu == "vm-intel") { hardware.cpu.intel.updateMicrocode = true; boot = { - kernelModules = ["kvm-intel"]; - kernelParams = ["i915.fastboot=1" "enable_gvt=1"]; + kernelModules = [ "kvm-intel" ]; + kernelParams = [ + "i915.fastboot=1" + "enable_gvt=1" + ]; }; - environment.systemPackages = with pkgs; [intel-gpu-tools]; + environment.systemPackages = with pkgs; [ intel-gpu-tools ]; }; } diff --git a/modules/nixos/hardware/default.nix b/modules/nixos/hardware/default.nix index be8dc305a..ed53c1bb5 100644 --- a/modules/nixos/hardware/default.nix +++ b/modules/nixos/hardware/default.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ imports = [ ./cpu # cpu specific options ./gpu # gpu specific options diff --git a/modules/nixos/hardware/gpu/amd.nix b/modules/nixos/hardware/gpu/amd.nix index dc53f7165..cc7aa7910 100644 --- a/modules/nixos/hardware/gpu/amd.nix +++ b/modules/nixos/hardware/gpu/amd.nix @@ -3,17 +3,19 @@ pkgs, config, ... -}: let +}: +let inherit (config.modules) device; -in { +in +{ config = lib.mkIf (device.gpu == "amd" || device.gpu == "hybrid-amd") { # enable amdgpu xorg drivers - services.xserver.videoDrivers = ["amdgpu"]; + services.xserver.videoDrivers = [ "amdgpu" ]; # enable amdgpu kernel module boot = { - kernelModules = ["amdgpu"]; - initrd.kernelModules = ["amdgpu"]; + kernelModules = [ "amdgpu" ]; + initrd.kernelModules = [ "amdgpu" ]; }; # enables AMDVLK & OpenCL support diff --git a/modules/nixos/hardware/gpu/intel.nix b/modules/nixos/hardware/gpu/intel.nix index 00afcb059..b72950f0b 100644 --- a/modules/nixos/hardware/gpu/intel.nix +++ b/modules/nixos/hardware/gpu/intel.nix @@ -3,19 +3,21 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; inherit (config.modules) device; -in { +in +{ config = mkIf (device.gpu == "intel" || device.gpu == "hybrid-nv") { # i915 kernel module - boot.initrd.kernelModules = ["i915"]; + boot.initrd.kernelModules = [ "i915" ]; # better performance than the actual Intel driver, lol - services.xserver.videoDrivers = ["modesetting"]; + services.xserver.videoDrivers = [ "modesetting" ]; # let me play youtube videos without h.264 nixpkgs.config.packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; }; # OpenCL support and VAAPI diff --git a/modules/nixos/hardware/gpu/nvidia.nix b/modules/nixos/hardware/gpu/nvidia.nix index d840c48a4..4d2657cf2 100644 --- a/modules/nixos/hardware/gpu/nvidia.nix +++ b/modules/nixos/hardware/gpu/nvidia.nix @@ -3,27 +3,30 @@ pkgs, config, ... -}: let +}: +let # only the newest nvidia package nvStable = config.boot.kernelPackages.nvidiaPackages.stable; nvBeta = config.boot.kernelPackages.nvidiaPackages.beta; - nvidiaPackage = - if (versionOlder nvBeta.version nvStable.version) - then nvStable - else nvBeta; + nvidiaPackage = if (versionOlder nvBeta.version nvStable.version) then nvStable else nvBeta; inherit (config.modules) device; - inherit (lib) mkIf mkMerge mkDefault versionOlder isWayland; -in { + inherit (lib) + mkIf + mkMerge + mkDefault + versionOlder + isWayland + ; +in +{ config = mkIf (device.gpu == "nvidia" || device.gpu == "hybrid-nv") { # nvidia drivers kinda are unfree software nixpkgs.config.allowUnfree = true; services.xserver = mkMerge [ - { - videoDrivers = ["nvidia"]; - } + { videoDrivers = [ "nvidia" ]; } # xorg settings (mkIf (!lib.isWayland config) { @@ -43,13 +46,11 @@ in { ]; # blacklist nouveau module as otherwise it conflicts with nvidia drm - boot.blacklistedKernelModules = ["nouveau"]; + boot.blacklistedKernelModules = [ "nouveau" ]; environment = { sessionVariables = mkMerge [ - { - LIBVA_DRIVER_NAME = "nvidia"; - } + { LIBVA_DRIVER_NAME = "nvidia"; } (mkIf (isWayland config) { WLR_NO_HARDWARE_CURSORS = "1"; @@ -98,8 +99,8 @@ in { }; opengl = { - extraPackages = with pkgs; [nvidia-vaapi-driver]; - extraPackages32 = with pkgs.pkgsi686Linux; [nvidia-vaapi-driver]; + extraPackages = with pkgs; [ nvidia-vaapi-driver ]; + extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ]; }; }; }; diff --git a/modules/nixos/hardware/media/sound.nix b/modules/nixos/hardware/media/sound.nix index 65f2268d7..8e7868351 100644 --- a/modules/nixos/hardware/media/sound.nix +++ b/modules/nixos/hardware/media/sound.nix @@ -3,11 +3,13 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf mkDefault isx86Linux; inherit (config.modules) device; cfg = config.modules.system.sound; -in { +in +{ config = mkIf (cfg.enable && device.hasSound) { # enable sound support and media keys if device has sound sound = { @@ -51,8 +53,8 @@ in { }; systemd.user.services = { - pipewire.wantedBy = ["default.target"]; - pipewire-pulse.wantedBy = ["default.target"]; + pipewire.wantedBy = [ "default.target" ]; + pipewire-pulse.wantedBy = [ "default.target" ]; }; }; } diff --git a/modules/nixos/hardware/media/video.nix b/modules/nixos/hardware/media/video.nix index 4707a6b6c..9584ddab1 100644 --- a/modules/nixos/hardware/media/video.nix +++ b/modules/nixos/hardware/media/video.nix @@ -3,10 +3,12 @@ lib, config, ... -}: let +}: +let inherit (lib) mkIf isx86Linux; sys = config.modules.system; -in { +in +{ config = mkIf sys.video.enable { hardware = { opengl = { diff --git a/modules/nixos/hardware/tmp.nix b/modules/nixos/hardware/tmp.nix index e7f97eb1b..a827dd1b7 100644 --- a/modules/nixos/hardware/tmp.nix +++ b/modules/nixos/hardware/tmp.nix @@ -1,11 +1,9 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkDefault mkIf; inherit (config.modules) device; -in { +in +{ config = mkIf device.hasTPM { security.tpm2 = { # enable Trusted Platform Module 2 support diff --git a/modules/nixos/hardware/yubikey.nix b/modules/nixos/hardware/yubikey.nix index 6fc56a862..50158a58a 100644 --- a/modules/nixos/hardware/yubikey.nix +++ b/modules/nixos/hardware/yubikey.nix @@ -3,13 +3,14 @@ lib, pkgs, ... -}: { +}: +{ config = lib.mkIf config.modules.system.yubikeySupport.enable { hardware.gpgSmartcards.enable = true; services = { pcscd.enable = true; - udev.packages = [pkgs.yubikey-personalization]; + udev.packages = [ pkgs.yubikey-personalization ]; }; programs = { diff --git a/modules/nixos/nix.nix b/modules/nixos/nix.nix index fe9597266..4a6035ef4 100644 --- a/modules/nixos/nix.nix +++ b/modules/nixos/nix.nix @@ -1,8 +1,5 @@ +{ lib, config, ... }: { - lib, - config, - ... -}: { config = { nix = { gc = { @@ -13,7 +10,7 @@ # automatically optimize /nix/store by removing hard links optimise = { automatic = true; - dates = ["04:00"]; + dates = [ "04:00" ]; }; # Make builds run with a low priority, keeping the system fast diff --git a/modules/nixos/options/device/capabilities.nix b/modules/nixos/options/device/capabilities.nix index c261dff76..db8e6317a 100644 --- a/modules/nixos/options/device/capabilities.nix +++ b/modules/nixos/options/device/capabilities.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkOption types; -in { +in +{ options.modules.device = { hasBluetooth = mkOption { type = types.bool; diff --git a/modules/nixos/options/device/hardware.nix b/modules/nixos/options/device/hardware.nix index 35326226c..f2f1c7c08 100644 --- a/modules/nixos/options/device/hardware.nix +++ b/modules/nixos/options/device/hardware.nix @@ -1,22 +1,37 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkOption types; -in { +in +{ options.modules.device = { cpu = mkOption { - type = types.nullOr (types.enum ["intel" "vm-intel" "amd" "vm-amd"]); + type = types.nullOr ( + types.enum [ + "intel" + "vm-intel" + "amd" + "vm-amd" + ] + ); default = null; - description = "The manifacturer of the primary system gpu"; + description = "The manufacturer of the primary system gpu"; }; gpu = mkOption { - type = types.nullOr (types.enum ["amd" "intel" "nvidia"]); + type = types.nullOr ( + types.enum [ + "amd" + "intel" + "nvidia" + ] + ); default = null; - description = "The manifacturer of the primary system gpu"; + description = "The manufacturer of the primary system gpu"; }; monitors = mkOption { type = with types; listOf str; - default = []; + default = [ ]; description = '' this does not affect any drivers and such, it is only necessary for declaring things like monitors in window manager configurations @@ -25,7 +40,10 @@ in { }; keyboard = mkOption { - type = types.enum ["us" "gb"]; + type = types.enum [ + "us" + "gb" + ]; default = "gb"; }; }; diff --git a/modules/nixos/options/system/boot.nix b/modules/nixos/options/system/boot.nix index ff5d4db8a..6ad8a7a2b 100644 --- a/modules/nixos/options/system/boot.nix +++ b/modules/nixos/options/system/boot.nix @@ -3,9 +3,16 @@ lib, pkgs, ... -}: let - inherit (lib) literalExpression mkOption mkEnableOption types; -in { +}: +let + inherit (lib) + literalExpression + mkOption + mkEnableOption + types + ; +in +{ options.modules.system.boot = { enableKernelTweaks = mkEnableOption "security and performance related kernel parameters"; recommendedLoaderConfig = mkEnableOption "tweaks for common bootloader configs per my liking"; @@ -44,22 +51,28 @@ in { mkEnableOption '' almost entirely silent boot process through `quiet` kernel parameter '' - // {default = config.modules.system.boot.plymouth.enable;}; + // { + default = config.modules.system.boot.plymouth.enable; + }; extraKernelParams = mkOption { type = with types; listOf str; - default = []; + default = [ ]; }; extraModulePackages = mkOption { type = with types; listOf package; - default = []; + default = [ ]; example = literalExpression ''with config.boot.kernelPackages; [acpi_call]''; description = "Extra kernel modules to be loaded."; }; loader = mkOption { - type = types.enum ["none" "grub" "systemd-boot"]; + type = types.enum [ + "none" + "grub" + "systemd-boot" + ]; default = "none"; description = "The bootloader that should be used for the device."; }; diff --git a/modules/nixos/options/system/default.nix b/modules/nixos/options/system/default.nix index 3bd4280fb..fd0234914 100644 --- a/modules/nixos/options/system/default.nix +++ b/modules/nixos/options/system/default.nix @@ -1,10 +1,13 @@ +{ lib, config, ... }: +let + inherit (lib) + mkOption + mkEnableOption + optionals + types + ; +in { - lib, - config, - ... -}: let - inherit (lib) mkOption mkEnableOption optionals types; -in { imports = [ ./boot.nix ./emulation.nix @@ -15,7 +18,7 @@ in { ./virtualization.nix ]; - config.warnings = optionals (config.modules.system.fs == []) [ + config.warnings = optionals (config.modules.system.fs == [ ]) [ '' You have not added any filesystems to be supported by your system. You may end up with an unbootable system! @@ -35,7 +38,10 @@ in { fs = mkOption { type = with types; listOf str; - default = ["vfat" "ext4"]; + default = [ + "vfat" + "ext4" + ]; description = '' A list of filesystems available supported by the system it will enable services based on what strings are found in the list. @@ -47,7 +53,12 @@ in { yubikeySupport = { enable = mkEnableOption "yubikey support"; deviceType = mkOption { - type = with types; nullOr (enum ["NFC5" "nano"]); + type = + with types; + nullOr (enum [ + "NFC5" + "nano" + ]); default = null; description = "A list of devices to enable Yubikey support for"; }; diff --git a/modules/nixos/options/system/emulation.nix b/modules/nixos/options/system/emulation.nix index 01250d3c0..e38722d14 100644 --- a/modules/nixos/options/system/emulation.nix +++ b/modules/nixos/options/system/emulation.nix @@ -1,22 +1,23 @@ -{ - lib, - pkgs, - ... -}: let +{ lib, pkgs, ... }: +let inherit (lib) mkEnableOption mkOption types; -in { +in +{ options.modules.system.emulation = { - # should we enable emulation for additional architechtures? + # should we enable emulation for additional architectures? # enabling this option will make it so that you can build for, e.g. # aarch64 on x86_&4 and vice verse - not recommended on weaker machines enable = mkEnableOption '' emulation of additional arcitechtures via binfmt. enabling this option will make it so that the system can build for - addiitonal systems such as aarc64 on x86_64 and vice versa. + additional systems such as aarc64 on x86_64 and vice versa. ''; systems = mkOption { type = with types; listOf str; - default = builtins.filter (system: system != pkgs.system) ["aarch64-linux" "i686-linux"]; + default = builtins.filter (system: system != pkgs.system) [ + "aarch64-linux" + "i686-linux" + ]; description = '' the systems to enable emulation for ''; diff --git a/modules/nixos/options/system/encryption.nix b/modules/nixos/options/system/encryption.nix index 0ddd4ce8c..fbc8f1786 100644 --- a/modules/nixos/options/system/encryption.nix +++ b/modules/nixos/options/system/encryption.nix @@ -1,19 +1,23 @@ +{ config, lib, ... }: +let + inherit (lib) + mkEnableOption + mkOption + types + mkIf + ; +in { - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types mkIf; -in { config = mkIf config.modules.system.encryption.enable { warnings = - if config.modules.system.encryption.device == "" - then [ - '' - You have enabled LUKS encryption, but have not selected a device, you may not be able to decrypt your disk on boot. - '' - ] - else []; + if config.modules.system.encryption.device == "" then + [ + '' + You have enabled LUKS encryption, but have not selected a device, you may not be able to decrypt your disk on boot. + '' + ] + else + [ ]; }; options.modules.system.encryption = { enable = mkEnableOption "LUKS encryption"; diff --git a/modules/nixos/options/system/networking.nix b/modules/nixos/options/system/networking.nix index 6a8481e4a..36288db38 100644 --- a/modules/nixos/options/system/networking.nix +++ b/modules/nixos/options/system/networking.nix @@ -1,18 +1,19 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkEnableOption mkOption types; sys = config.modules.system; cfg = sys.networking.tailscale; -in { +in +{ options.modules.system.networking = { optimizeTcp = mkEnableOption "Enable tcp optimizations"; wirelessBackend = mkOption { - type = types.enum ["iwd" "wpa_supplicant"]; + type = types.enum [ + "iwd" + "wpa_supplicant" + ]; default = "wpa_supplicant"; description = '' Backend that will be used for wireless connections using either `networking.wireless` @@ -26,7 +27,7 @@ in { defaultFlags = mkOption { type = with types; listOf str; - default = ["--ssh"]; + default = [ "--ssh" ]; description = '' A list of command-line flags that will be passed to the Tailscale daemon on startup using the {option}`config.services.tailscale.extraUpFlags`. @@ -41,7 +42,7 @@ in { example = true; description = '' Whether the target host should utilize Tailscale client features"; - This option is mutually exlusive with {option}`tailscale.isServer` as they both + This option is mutually exclusive with {option}`tailscale.isServer` as they both configure Taiscale, but with different flags ''; }; @@ -52,7 +53,7 @@ in { example = true; description = '' Whether the target host should utilize Tailscale server features. - This option is mutually exlusive with {option}`tailscale.isClient` as they both + This option is mutually exclusive with {option}`tailscale.isClient` as they both configure Taiscale, but with different flags ''; }; diff --git a/modules/nixos/options/system/printing.nix b/modules/nixos/options/system/printing.nix index 071108507..1763eb048 100644 --- a/modules/nixos/options/system/printing.nix +++ b/modules/nixos/options/system/printing.nix @@ -1,12 +1,14 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkEnableOption mkOption types; -in { +in +{ options.modules.system.printing = { enable = mkEnableOption "printing"; extraDrivers = mkOption { type = with types; listOf str; - default = []; + default = [ ]; description = "A list of additional drivers to install for printing"; }; }; diff --git a/modules/nixos/options/system/security.nix b/modules/nixos/options/system/security.nix index 7fe052377..1ce2995e1 100644 --- a/modules/nixos/options/system/security.nix +++ b/modules/nixos/options/system/security.nix @@ -1,10 +1,8 @@ -{ - pkgs, - lib, - ... -}: let +{ pkgs, lib, ... }: +let inherit (lib) mkOption mkEnableOption types; -in { +in +{ options.modules.system.security = { fixWebcam = mkEnableOption "Fix the purposefully broken webcam by un-blacklisting the related kernel module."; tor.enable = mkEnableOption "Tor daemon"; @@ -13,7 +11,13 @@ in { selinux = { enable = mkEnableOption "system SELinux support + kernel patches"; state = mkOption { - type = with types; enum ["enforcing" "permissive" "disabled"]; + type = + with types; + enum [ + "enforcing" + "permissive" + "disabled" + ]; default = "enforcing"; description = '' SELinux state to boot with. The default is enforcing. @@ -21,7 +25,13 @@ in { }; type = mkOption { - type = with types; enum ["targeted" "minimum" "mls"]; + type = + with types; + enum [ + "targeted" + "minimum" + "mls" + ]; default = "targeted"; description = '' SELinux policy type to boot with. The default is targeted. @@ -54,7 +64,14 @@ in { daemon = { settings = mkOption { - type = with types; attrsOf (oneOf [bool int str (listOf str)]); + type = + with types; + attrsOf (oneOf [ + bool + int + str + (listOf str) + ]); default = { LogFile = "/var/log/clamd.log"; LogTime = true; @@ -95,8 +112,15 @@ in { }; settings = mkOption { - type = with types; attrsOf (oneOf [bool int str (listOf str)]); - default = {}; + type = + with types; + attrsOf (oneOf [ + bool + int + str + (listOf str) + ]); + default = { }; description = '' freshclam configuration. Refer to , for details on supported values. diff --git a/modules/nixos/options/system/virtualization.nix b/modules/nixos/options/system/virtualization.nix index e2b2eddc7..4e58941a1 100644 --- a/modules/nixos/options/system/virtualization.nix +++ b/modules/nixos/options/system/virtualization.nix @@ -1,12 +1,24 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkEnableOption; -in { +in +{ options.modules.system.virtualization = { enable = mkEnableOption "Should the device be allowed to virtualizle processes"; - docker = {enable = mkEnableOption "docker";}; - podman = {enable = mkEnableOption "podman";}; - qemu = {enable = mkEnableOption "qemu";}; - distrobox = {enable = mkEnableOption "distrobox";}; - waydroid = {enable = mkEnableOption "waydroid";}; + docker = { + enable = mkEnableOption "docker"; + }; + podman = { + enable = mkEnableOption "podman"; + }; + qemu = { + enable = mkEnableOption "qemu"; + }; + distrobox = { + enable = mkEnableOption "distrobox"; + }; + waydroid = { + enable = mkEnableOption "waydroid"; + }; }; } diff --git a/modules/nixos/os/boot/generic.nix b/modules/nixos/os/boot/generic.nix index f514d69bb..ccefbea84 100644 --- a/modules/nixos/os/boot/generic.nix +++ b/modules/nixos/os/boot/generic.nix @@ -1,11 +1,16 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkDefault mkForce mkOverride mkMerge mkIf optionals; +{ lib, config, ... }: +let + inherit (lib) + mkDefault + mkForce + mkOverride + mkMerge + mkIf + optionals + ; sys = config.modules.system; -in { +in +{ boot = { consoleLogLevel = 3; @@ -98,11 +103,13 @@ in { ]; }) - (mkIf sys.boot.initrd.optimizeCompressor - { - compressor = "zstd"; - compressorArgs = ["-19" "-T0"]; - }) + (mkIf sys.boot.initrd.optimizeCompressor { + compressor = "zstd"; + compressorArgs = [ + "-19" + "-T0" + ]; + }) ]; # https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html diff --git a/modules/nixos/os/boot/loader/grub.nix b/modules/nixos/os/boot/loader/grub.nix index 463e3c392..81016a10c 100644 --- a/modules/nixos/os/boot/loader/grub.nix +++ b/modules/nixos/os/boot/loader/grub.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkDefault mkIf; cfg = config.modules.system; -in { +in +{ config = mkIf (cfg.boot.loader == "grub") { boot.loader = { grub = { diff --git a/modules/nixos/os/boot/loader/none.nix b/modules/nixos/os/boot/loader/none.nix index 4456ccbdc..24413265d 100644 --- a/modules/nixos/os/boot/loader/none.nix +++ b/modules/nixos/os/boot/loader/none.nix @@ -1,11 +1,9 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf mkForce; cfg = config.modules.system; -in { +in +{ config = mkIf (cfg.boot.loader == "none") { boot.loader = { grub.enable = mkForce false; diff --git a/modules/nixos/os/boot/loader/systemd-boot.nix b/modules/nixos/os/boot/loader/systemd-boot.nix index bedff3b8d..c2a972bd4 100644 --- a/modules/nixos/os/boot/loader/systemd-boot.nix +++ b/modules/nixos/os/boot/loader/systemd-boot.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkDefault mkIf optionalAttrs; cfg = config.modules.system.boot; -in { +in +{ config = mkIf (cfg.loader == "systemd-boot") { boot.loader = { systemd-boot = diff --git a/modules/nixos/os/boot/plymouth.nix b/modules/nixos/os/boot/plymouth.nix index 3020fc1e7..51353a952 100644 --- a/modules/nixos/os/boot/plymouth.nix +++ b/modules/nixos/os/boot/plymouth.nix @@ -4,12 +4,14 @@ self', pkgs, ... -}: let +}: +let inherit (pkgs) plymouth; inherit (lib) mkIf; cfg = config.modules.system.boot.plymouth; -in { +in +{ config = mkIf cfg.enable { boot.plymouth = { @@ -17,7 +19,7 @@ in { } // lib.optionalAttrs cfg.withThemes { theme = "catppuccin-mocha"; - themePackages = [self'.packages.plymouth-theme-catppuccin]; + themePackages = [ self'.packages.plymouth-theme-catppuccin ]; }; # make plymouth work with sleep diff --git a/modules/nixos/os/boot/secure-boot.nix b/modules/nixos/os/boot/secure-boot.nix index b84c64bc9..e0318bc24 100644 --- a/modules/nixos/os/boot/secure-boot.nix +++ b/modules/nixos/os/boot/secure-boot.nix @@ -4,13 +4,13 @@ lib, inputs, ... -}: let +}: +let inherit (lib) mkIf mkForce; sys = config.modules.system.boot; -in { - imports = [ - inputs.lanzaboote.nixosModules.lanzaboote - ]; +in +{ + imports = [ inputs.lanzaboote.nixosModules.lanzaboote ]; config = mkIf sys.secureBoot { environment.systemPackages = [ diff --git a/modules/nixos/os/display/portals.nix b/modules/nixos/os/display/portals.nix index 6fe68de5c..a6b5b7706 100644 --- a/modules/nixos/os/display/portals.nix +++ b/modules/nixos/os/display/portals.nix @@ -3,27 +3,25 @@ pkgs, config, ... -}: let +}: +let sys = config.modules.system; env = config.modules.environment; inherit (lib) mkForce mkIf isWayland; -in { +in +{ config = mkIf (sys.video.enable && pkgs.stdenv.isLinux) { xdg.portal = { enable = true; # xdgOpenUsePortal = true; config.common = { - default = ["gtk"]; + default = [ "gtk" ]; - "org.freedesktop.impl.portal.Secret" = [ - "gnome-keyring" - ]; + "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; }; - extraPortals = with pkgs; [ - xdg-desktop-portal-gtk - ]; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; wlr = { enable = mkForce (isWayland config && env.desktop != "Hyprland"); diff --git a/modules/nixos/os/display/wayland/environment.nix b/modules/nixos/os/display/wayland/environment.nix index b47323daa..64bc5200a 100644 --- a/modules/nixos/os/display/wayland/environment.nix +++ b/modules/nixos/os/display/wayland/environment.nix @@ -1,12 +1,10 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf isWayland optionalString; env = config.modules.environment; -in { +in +{ config = mkIf (isWayland config) { environment = { etc."greetd/environments".text = mkIf config.services.greetd.enable '' diff --git a/modules/nixos/os/display/wayland/hyprland.nix b/modules/nixos/os/display/wayland/hyprland.nix index 23ac69c44..86564b00e 100644 --- a/modules/nixos/os/display/wayland/hyprland.nix +++ b/modules/nixos/os/display/wayland/hyprland.nix @@ -3,12 +3,14 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; env = config.modules.environment; -in { +in +{ config = mkIf (env.desktop == "Hyprland") { - services.displayManager.sessionPackages = [pkgs.hyprland]; + services.displayManager.sessionPackages = [ pkgs.hyprland ]; }; } diff --git a/modules/nixos/os/display/wayland/services.nix b/modules/nixos/os/display/wayland/services.nix index 05365958b..2fa94e0d4 100644 --- a/modules/nixos/os/display/wayland/services.nix +++ b/modules/nixos/os/display/wayland/services.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIf getExe isWayland; -in { +in +{ config = mkIf (isWayland config && pkgs.stdenv.isLinux) { systemd.services.seatd = { enable = true; @@ -16,7 +18,7 @@ in { Restart = "always"; RestartSec = "1"; }; - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; }; }; } diff --git a/modules/nixos/os/environment/console.nix b/modules/nixos/os/environment/console.nix index 650e9abcd..90826045e 100644 --- a/modules/nixos/os/environment/console.nix +++ b/modules/nixos/os/environment/console.nix @@ -1,8 +1,5 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { console = { enable = lib.mkDefault true; earlySetup = true; diff --git a/modules/nixos/os/environment/locale.nix b/modules/nixos/os/environment/locale.nix index 41efe052a..d9c2d6b32 100644 --- a/modules/nixos/os/environment/locale.nix +++ b/modules/nixos/os/environment/locale.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ time = { timeZone = "Europe/London"; hardwareClockInLocalTime = true; diff --git a/modules/nixos/os/environment/packages.nix b/modules/nixos/os/environment/packages.nix index 579cc68aa..f4f8d4e6d 100644 --- a/modules/nixos/os/environment/packages.nix +++ b/modules/nixos/os/environment/packages.nix @@ -1,8 +1,5 @@ +{ pkgs, lib, ... }: { - pkgs, - lib, - ... -}: { environment = { # packages that should be on all deviecs systemPackages = with pkgs; [ @@ -14,6 +11,6 @@ ]; # disable all packages installed by default, i prefer my own packages - defaultPackages = lib.mkForce []; + defaultPackages = lib.mkForce [ ]; }; } diff --git a/modules/nixos/os/fs/default.nix b/modules/nixos/os/fs/default.nix index 15b79a513..cb638b486 100644 --- a/modules/nixos/os/fs/default.nix +++ b/modules/nixos/os/fs/default.nix @@ -1,42 +1,40 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf mkMerge; sys = config.modules.system; -in { +in +{ config = mkMerge [ (mkIf (builtins.elem "btrfs" sys.fs) { # clean btrfs devices services.btrfs.autoScrub = { enable = true; - fileSystems = ["/"]; + fileSystems = [ "/" ]; }; # fix: initrd.systemd.enable boot = { - supportedFilesystems = ["btrfs"]; + supportedFilesystems = [ "btrfs" ]; initrd = { - supportedFilesystems = ["btrfs"]; + supportedFilesystems = [ "btrfs" ]; }; }; }) (mkIf (builtins.elem "ext4" sys.fs) { boot = { - supportedFilesystems = ["ext4"]; + supportedFilesystems = [ "ext4" ]; initrd = { - supportedFilesystems = ["ext4"]; + supportedFilesystems = [ "ext4" ]; }; }; }) (mkIf (builtins.elem "exfat" sys.fs) { boot = { - supportedFilesystems = ["exfat"]; + supportedFilesystems = [ "exfat" ]; initrd = { - supportedFilesystems = ["exfat"]; + supportedFilesystems = [ "exfat" ]; }; }; }) @@ -44,7 +42,7 @@ in { # accept both ntfs and ntfs3 as valid values (mkIf ((builtins.elem "ntfs" sys.fs) || (builtins.elem "ntfs3" sys.fs)) { boot = { - supportedFilesystems = ["ntfs"]; + supportedFilesystems = [ "ntfs" ]; }; }) ]; diff --git a/modules/nixos/os/misc/documentation.nix b/modules/nixos/os/misc/documentation.nix index 074cf2b08..f8cdac3d0 100644 --- a/modules/nixos/os/misc/documentation.nix +++ b/modules/nixos/os/misc/documentation.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkForce; -in { +in +{ documentation = lib.mapAttrs (_: mkForce) { enable = false; dev.enable = false; diff --git a/modules/nixos/os/misc/realtime.nix b/modules/nixos/os/misc/realtime.nix index ff2053d33..1bd93a39f 100644 --- a/modules/nixos/os/misc/realtime.nix +++ b/modules/nixos/os/misc/realtime.nix @@ -1,11 +1,12 @@ -{config, ...}: { +{ config, ... }: +{ # port of https://gitlab.archlinux.org/archlinux/packaging/packages/realtime-privileges # see https://wiki.archlinux.org/title/Realtime_process_management # tldr: realtime processes have higher priority than normal processes users = { - users."${config.modules.system.mainUser}".extraGroups = ["realtime"]; - groups.realtime = {}; + users."${config.modules.system.mainUser}".extraGroups = [ "realtime" ]; + groups.realtime = { }; }; services.udev.extraRules = '' diff --git a/modules/nixos/os/networking/blocker.nix b/modules/nixos/os/networking/blocker.nix index f7bf28bab..fb0e87ec6 100644 --- a/modules/nixos/os/networking/blocker.nix +++ b/modules/nixos/os/networking/blocker.nix @@ -1,6 +1,8 @@ -{config, ...}: let +{ config, ... }: +let inherit (config.modules) device; -in { +in +{ # remove stupid sites that i just don't want to see networking.stevenblack = { enable = device.type != "server"; diff --git a/modules/nixos/os/networking/default.nix b/modules/nixos/os/networking/default.nix index b22700b52..a23024e1f 100644 --- a/modules/nixos/os/networking/default.nix +++ b/modules/nixos/os/networking/default.nix @@ -1,12 +1,10 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf mkDefault mkForce; dev = config.modules.device; -in { +in +{ imports = [ ./firewall diff --git a/modules/nixos/os/networking/firewall/default.nix b/modules/nixos/os/networking/firewall/default.nix index 66ab67143..6c5c75036 100644 --- a/modules/nixos/os/networking/firewall/default.nix +++ b/modules/nixos/os/networking/firewall/default.nix @@ -3,11 +3,13 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkForce mkIf; inherit (config.modules) programs device; -in { - imports = [./fail2ban.nix]; +in +{ + imports = [ ./fail2ban.nix ]; config = { # enable opensnitch firewall @@ -21,7 +23,7 @@ in { 443 8080 ]; - allowedUDPPorts = []; + allowedUDPPorts = [ ]; allowedTCPPortRanges = mkIf programs.gui.kdeconnect.enable [ { from = 1714; diff --git a/modules/nixos/os/networking/firewall/fail2ban.nix b/modules/nixos/os/networking/firewall/fail2ban.nix index 241dbf151..7905b7c63 100644 --- a/modules/nixos/os/networking/firewall/fail2ban.nix +++ b/modules/nixos/os/networking/firewall/fail2ban.nix @@ -1,12 +1,15 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkIf mkMerge concatStringsSep mkForce; +{ lib, config, ... }: +let + inherit (lib) + mkIf + mkMerge + concatStringsSep + mkForce + ; cfg = config.modules.services; -in { +in +{ # fail2ban firewall jail services.fail2ban = { enable = true; diff --git a/modules/nixos/os/networking/networkmanager.nix b/modules/nixos/os/networking/networkmanager.nix index c3106e146..49b2b5ea2 100644 --- a/modules/nixos/os/networking/networkmanager.nix +++ b/modules/nixos/os/networking/networkmanager.nix @@ -3,17 +3,19 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf mkForce; dev = config.modules.device; sys = config.modules.system; -in { - environment.systemPackages = with pkgs; [networkmanagerapplet]; +in +{ + environment.systemPackages = with pkgs; [ networkmanagerapplet ]; networking.networkmanager = { enable = true; - plugins = mkForce []; + plugins = mkForce [ ]; dns = "systemd-resolved"; unmanaged = [ "interface-name:tailscale*" diff --git a/modules/nixos/os/networking/optimise.nix b/modules/nixos/os/networking/optimise.nix index f46a38597..02bb6f00a 100644 --- a/modules/nixos/os/networking/optimise.nix +++ b/modules/nixos/os/networking/optimise.nix @@ -1,14 +1,15 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let sys = config.modules.system; inherit (lib) mkIf; -in { +in +{ config = mkIf sys.networking.optimizeTcp { boot = { - kernelModules = ["tls" "tcp_bbr"]; + kernelModules = [ + "tls" + "tcp_bbr" + ]; kernel.sysctl = { # TCP hardening # Prevent bogus ICMP errors from filling up logs. diff --git a/modules/nixos/os/networking/ssh.nix b/modules/nixos/os/networking/ssh.nix index abab8181e..8e4eccf2e 100644 --- a/modules/nixos/os/networking/ssh.nix +++ b/modules/nixos/os/networking/ssh.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ services.openssh = { enable = true; startWhenNeeded = true; @@ -41,7 +42,7 @@ openFirewall = true; # the port(s) openssh daemon should listen on - ports = [22]; + ports = [ 22 ]; hostKeys = [ { @@ -59,47 +60,47 @@ # find these with `ssh-keyscan ` knownHosts = { github-rsa = { - hostNames = ["github.com"]; + hostNames = [ "github.com" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; }; github-ed25519 = { - hostNames = ["github.com"]; + hostNames = [ "github.com" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; }; gitlab-rsa = { - hostNames = ["gitlab.com"]; + hostNames = [ "gitlab.com" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9"; }; gitlab-ed25519 = { - hostNames = ["gitlab.com"]; + hostNames = [ "gitlab.com" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf"; }; codeberg-rsa = { - hostNames = ["codeberg.org"]; + hostNames = [ "codeberg.org" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hZi7K1/2E2uBX8gwPRJAHvRAob+3Sn+y2hxiEhN0buv1igjYFTgFO2qQD8vLfU/HT/P/rqvEeTvaDfY1y/vcvQ8+YuUYyTwE2UaVU5aJv89y6PEZBYycaJCPdGIfZlLMmjilh/Sk8IWSEK6dQr+g686lu5cSWrFW60ixWpHpEVB26eRWin3lKYWSQGMwwKv4LwmW3ouqqs4Z4vsqRFqXJ/eCi3yhpT+nOjljXvZKiYTpYajqUC48IHAxTWugrKe1vXWOPxVXXMQEPsaIRc2hpK+v1LmfB7GnEGvF1UAKnEZbUuiD9PBEeD5a1MZQIzcoPWCrTxipEpuXQ5Tni4mN"; }; codeberg-ed25519 = { - hostNames = ["codeberg.org"]; + hostNames = [ "codeberg.org" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIVIC02vnjFyL+I4RHfvIGNtOgJMe769VTF1VR4EB3ZB"; }; sourcehut-rsa = { - hostNames = ["git.sr.ht"]; + hostNames = [ "git.sr.ht" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDZ+l/lvYmaeOAPeijHL8d4794Am0MOvmXPyvHTtrqvgmvCJB8pen/qkQX2S1fgl9VkMGSNxbp7NF7HmKgs5ajTGV9mB5A5zq+161lcp5+f1qmn3Dp1MWKp/AzejWXKW+dwPBd3kkudDBA1fa3uK6g1gK5nLw3qcuv/V4emX9zv3P2ZNlq9XRvBxGY2KzaCyCXVkL48RVTTJJnYbVdRuq8/jQkDRA8lHvGvKI+jqnljmZi2aIrK9OGT2gkCtfyTw2GvNDV6aZ0bEza7nDLU/I+xmByAOO79R1Uk4EYCvSc1WXDZqhiuO2sZRmVxa0pQSBDn1DB3rpvqPYW+UvKB3SOz"; }; sourcehut-ed25519 = { - hostNames = ["git.sr.ht"]; + hostNames = [ "git.sr.ht" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMZvRd4EtM7R+IHVMWmDkVU3VLQTSwQDSAvW0t2Tkj60"; }; git-isabelroses-rsa = { - hostNames = ["git.isabelroses.com"]; + hostNames = [ "git.isabelroses.com" ]; publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC30qar0Hn17YQOW/aPud1wegi5tXrrXEFGYA8OxWPxgdAqEwYm99FsDoThEMtRFavYOkzfyV3lCBJFRlXeaXC4iqLcDtaE5tQmKxnhPoSQa0moCTsy0TE4B5t0eTgIgNPOPu/7rfyVZCyRAA5RMA8mgM1L4DmuAlm74ExLlfXDnZKkZMU2o2N3ew/JPCLKMwp84e9gEEGlNV2cFVjh8eu1frykoc9YOMICGfEMdnMaScMpCu4OwFIhkzUowJUQMeFYQfQmzrFCR2j8Tn1ES8yEmc4xniEEOoTbdqq2Wqp+FFPLNWOWAW+/fqrxZ07gyYjByaXp/8Mp08xR9hZFn61NKtqFFnl9fgQj49jF58gZfg4jIzxRQaFStNK3dkcMNEkOXx+caKHzVHTQgwV2JNzz/7ZuB5vOaZh2ZNJw+M+9Z16xBVfd7daog0gt1bxFSYj6Y2/V9eET7+1Fgipfzs/rp6Zrr9MjpeRn8njDxh9DF24vz3k7SLoWZfzwjyeuU7E="; }; git-isabelroses-ed25519 = { - hostNames = ["git.isabelroses.com"]; + hostNames = [ "git.isabelroses.com" ]; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGHXU5QFwqTAW/3MrHXfeqRlit4VrxhymLLb32RFSZjf"; }; }; diff --git a/modules/nixos/os/networking/systemd.nix b/modules/nixos/os/networking/systemd.nix index ab0d15722..d5f18f89c 100644 --- a/modules/nixos/os/networking/systemd.nix +++ b/modules/nixos/os/networking/systemd.nix @@ -1,11 +1,13 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) concatMapAttrs genAttrs mkForce; ethernetDevices = [ "wlp1s0f0u8" # wifi dongle "enp7s0" # ethernet interface on the motherboard ]; -in { +in +{ # systemd DNS resolver daemon services.resolved.enable = true; @@ -21,10 +23,12 @@ in { systemd-networkd.stopIfChanged = false; systemd-resolved.stopIfChanged = false; } - // concatMapAttrs (_: v: v) (genAttrs ethernetDevices (device: { - # Assign an IP address when the device is plugged in rather than on startup. Needed to prevent - # blocking the boot sequence when the device is unavailable, as it is hotpluggable. - "network-addresses-${device}".wantedBy = mkForce ["sys-subsystem-net-devices-${device}.device"]; - })); + // concatMapAttrs (_: v: v) ( + genAttrs ethernetDevices (device: { + # Assign an IP address when the device is plugged in rather than on startup. Needed to prevent + # blocking the boot sequence when the device is unavailable, as it is hotpluggable. + "network-addresses-${device}".wantedBy = mkForce [ "sys-subsystem-net-devices-${device}.device" ]; + }) + ); }; } diff --git a/modules/nixos/os/networking/tailscale.nix b/modules/nixos/os/networking/tailscale.nix index ae77e1ea7..aeded3a58 100644 --- a/modules/nixos/os/networking/tailscale.nix +++ b/modules/nixos/os/networking/tailscale.nix @@ -3,24 +3,26 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIf mkDefault optionals; inherit (config.services) tailscale; sys = config.modules.system.networking; cfg = sys.tailscale; -in { +in +{ config = mkIf cfg.enable { # make the tailscale command usable to users - environment.systemPackages = [pkgs.tailscale]; + environment.systemPackages = [ pkgs.tailscale ]; networking.firewall = { # always allow traffic from your Tailscale network - trustedInterfaces = ["${tailscale.interfaceName}"]; + trustedInterfaces = [ "${tailscale.interfaceName}" ]; checkReversePath = "loose"; # allow the Tailscale UDP port through the firewall - allowedUDPPorts = [tailscale.port]; + allowedUDPPorts = [ tailscale.port ]; }; # enable tailscale, inter-machine VPN service @@ -28,7 +30,9 @@ in { enable = true; permitCertUid = "root"; useRoutingFeatures = mkDefault "server"; - extraUpFlags = sys.tailscale.defaultFlags ++ optionals sys.tailscale.enable ["--advertise-exit-node"]; + extraUpFlags = + sys.tailscale.defaultFlags + ++ optionals sys.tailscale.enable [ "--advertise-exit-node" ]; }; # server can't be client and client be server diff --git a/modules/nixos/os/networking/tcpcrypt.nix b/modules/nixos/os/networking/tcpcrypt.nix index 38af253c4..dd2746a37 100644 --- a/modules/nixos/os/networking/tcpcrypt.nix +++ b/modules/nixos/os/networking/tcpcrypt.nix @@ -1,18 +1,16 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; inherit (config.modules) device; -in { +in +{ # enable opportunistic TCP encryption # this is NOT a pancea, however, if the receiver supports encryption and the attacker is passive # privacy will be more plausible (but not guaranteed, unlike what the option docs suggest) networking.tcpcrypt.enable = device.type != "server"; users = mkIf config.networking.tcpcrypt.enable { - groups.tcpcryptd = {}; + groups.tcpcryptd = { }; users.tcpcryptd = { group = "tcpcryptd"; isSystemUser = true; diff --git a/modules/nixos/os/networking/wireless.nix b/modules/nixos/os/networking/wireless.nix index ff1eb87c2..e49325a7b 100644 --- a/modules/nixos/os/networking/wireless.nix +++ b/modules/nixos/os/networking/wireless.nix @@ -1,6 +1,8 @@ -{config, ...}: let +{ config, ... }: +let inherit (config.modules.system.networking) wirelessBackend; -in { +in +{ # enable wireless database, it helps keeping wifi speedy hardware.wirelessRegulatoryDatabase = true; diff --git a/modules/nixos/os/programs/default.nix b/modules/nixos/os/programs/default.nix index 3aa04f63e..3cd8e169c 100644 --- a/modules/nixos/os/programs/default.nix +++ b/modules/nixos/os/programs/default.nix @@ -3,9 +3,11 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf isModernShell; -in { +in +{ programs = { # less pager less.enable = true; diff --git a/modules/nixos/os/services/default.nix b/modules/nixos/os/services/default.nix index f6c197045..97337b167 100644 --- a/modules/nixos/os/services/default.nix +++ b/modules/nixos/os/services/default.nix @@ -1,11 +1,9 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf mkDefault; inherit (config.modules) device; -in { +in +{ imports = [ ./systemd.nix ./zram.nix diff --git a/modules/nixos/os/services/systemd.nix b/modules/nixos/os/services/systemd.nix index e9ba5bcbb..2a2c93ed9 100644 --- a/modules/nixos/os/services/systemd.nix +++ b/modules/nixos/os/services/systemd.nix @@ -1,8 +1,5 @@ +{ config, lib, ... }: { - config, - lib, - ... -}: { systemd = { # Systemd OOMd # Fedora enables these options by default. See the 10-oomd-* files here: diff --git a/modules/nixos/os/services/zram.nix b/modules/nixos/os/services/zram.nix index 512782d78..ac289c358 100644 --- a/modules/nixos/os/services/zram.nix +++ b/modules/nixos/os/services/zram.nix @@ -1,10 +1,8 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; -in { +in +{ # compress half of the ram to use as swap # basically, get more memory per memory zramSwap = { diff --git a/modules/nixos/security/apparmor.nix b/modules/nixos/security/apparmor.nix index 83d66b102..d23f8a458 100644 --- a/modules/nixos/security/apparmor.nix +++ b/modules/nixos/security/apparmor.nix @@ -1,8 +1,5 @@ +{ config, pkgs, ... }: { - config, - pkgs, - ... -}: { services.dbus.apparmor = "disabled"; # apparmor configuration @@ -18,7 +15,7 @@ killUnconfinedConfinables = true; # packages to be added to AppArmor’s include path - packages = [pkgs.apparmor-profiles]; + packages = [ pkgs.apparmor-profiles ]; # apparmor policies policies = { diff --git a/modules/nixos/security/auditd.nix b/modules/nixos/security/auditd.nix index 5981abd96..d0d7b465c 100644 --- a/modules/nixos/security/auditd.nix +++ b/modules/nixos/security/auditd.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.system.security; -in { +in +{ config = mkIf cfg.auditd.enable { security = { auditd.enable = true; @@ -14,16 +12,14 @@ in { enable = true; backlogLimit = 8192; failureMode = "printk"; - rules = [ - "-a exit,always -F arch=b64 -S execve" - ]; + rules = [ "-a exit,always -F arch=b64 -S execve" ]; }; }; systemd = { timers."clean-audit-log" = { description = "Periodically clean audit log"; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = "daily"; Persistent = true; diff --git a/modules/nixos/security/clamav.nix b/modules/nixos/security/clamav.nix index d52cc36ed..a5269854d 100644 --- a/modules/nixos/security/clamav.nix +++ b/modules/nixos/security/clamav.nix @@ -3,21 +3,25 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIf; sys = config.modules.system; -in { +in +{ config = mkIf sys.security.clamav.enable { services.clamav = { - daemon = {enable = true;} // sys.security.clamav.daemon; - updater = {enable = true;} // sys.security.clamav.updater; + daemon = { + enable = true; + } // sys.security.clamav.daemon; + updater = { + enable = true; + } // sys.security.clamav.updater; }; systemd = { - tmpfiles.rules = [ - "D /var/lib/clamav 755 clamav clamav" - ]; + tmpfiles.rules = [ "D /var/lib/clamav 755 clamav clamav" ]; services = { clamav-daemon = { @@ -38,8 +42,8 @@ in { }; clamav-init-database = { - wantedBy = ["clamav-daemon.service"]; - before = ["clamav-daemon.service"]; + wantedBy = [ "clamav-daemon.service" ]; + before = [ "clamav-daemon.service" ]; serviceConfig.ExecStart = "systemctl start clamav-freshclam"; unitConfig = { # opposite condition of clamav-daemon: only run this service if @@ -52,14 +56,32 @@ in { }; clamav-freshclam = { - wants = ["clamav-daemon.service"]; + wants = [ "clamav-daemon.service" ]; serviceConfig = { - ExecStart = let - message = "Updating ClamAV database"; - in '' - ${pkgs.coreutils}/bin/echo -en ${message} - ''; - SuccessExitStatus = lib.mkForce [11 40 50 51 52 53 54 55 56 57 58 59 60 61 62]; + ExecStart = + let + message = "Updating ClamAV database"; + in + '' + ${pkgs.coreutils}/bin/echo -en ${message} + ''; + SuccessExitStatus = lib.mkForce [ + 11 + 40 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + ]; }; }; }; diff --git a/modules/nixos/security/kernel.nix b/modules/nixos/security/kernel.nix index 98075e0bd..85ee02212 100644 --- a/modules/nixos/security/kernel.nix +++ b/modules/nixos/security/kernel.nix @@ -1,11 +1,9 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let sys = config.modules.system; inherit (lib) mkIf optionals concatLists; -in { +in +{ security = { protectKernelImage = true; lockKernelModules = false; # breaks virtd, wireguard and iptables @@ -69,7 +67,7 @@ in { "vsyscall=none" # reduce most of the exposure of a heap attack to a single cache "slab_nomerge" - # Disable debugfs whcich exposes sensitive kernel data + # Disable debugfs which exposes sensitive kernel data "debugfs=off" # Sometimes certain kernel exploits will cause what is called an "oops" which is a kernel panic # that is recoverable. This will make it unrecoverable, and therefore safe to those attacks @@ -106,7 +104,7 @@ in { "n-hdlc" # High-level Data Link Control "netrom" # NetRom "x25" # X.25 - "ax25" # Amatuer X.25 + "ax25" # Amateur X.25 "rose" # ROSE "decnet" # DECnet "econet" # Econet @@ -147,7 +145,7 @@ in { "nfs" # Network File System "nilfs2" # New Implementation of a Log-structured File System "omfs" # Optimized MPEG Filesystem - "qnx4" # extent-based file system used by the QNX4 and QNX6 OSes + "qnx4" # extent-based file system used by the QNX4 and QNX6 OSes "qnx6" # ^ "squashfs" # compressed read-only file system (used by live CDs) "sysv" # implements all of Xenix FS, SystemV/386 FS and Coherent FS. diff --git a/modules/nixos/security/polkit.nix b/modules/nixos/security/polkit.nix index 2eb6e1196..79fb7e379 100644 --- a/modules/nixos/security/polkit.nix +++ b/modules/nixos/security/polkit.nix @@ -1,10 +1,8 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib.modules) mkIf mkDefault; -in { +in +{ # have polkit log all actions security.polkit = { enable = true; diff --git a/modules/nixos/security/selinux.nix b/modules/nixos/security/selinux.nix index 337c4a405..60a677592 100644 --- a/modules/nixos/security/selinux.nix +++ b/modules/nixos/security/selinux.nix @@ -3,22 +3,27 @@ pkgs, lib, ... -}: let +}: +let inherit (lib) mkIf; sys = config.modules.system; cfg = sys.security.selinux; -in { +in +{ config = mkIf cfg.enable { # build systemd with SE Linux support so it loads policy at boot and supports file labelling - systemd.package = pkgs.systemd.override {withSelinux = true;}; + systemd.package = pkgs.systemd.override { withSelinux = true; }; # we cannot have apparmor and security together. disable apparmor security.apparmor.enable = lib.mkForce false; boot = { # tell kernel to use SE Linux by adding necessary parameters - kernelParams = ["security=selinux" "selinux=1"]; + kernelParams = [ + "security=selinux" + "selinux=1" + ]; # compile kernel with SE Linux support # with additional support for other LSM modules @@ -40,7 +45,7 @@ in { }; environment = { - systemPackages = with pkgs; [policycoreutils]; # for load_policy, fixfiles, setfiles, setsebool, semodile, and sestatus. + systemPackages = with pkgs; [ policycoreutils ]; # for load_policy, fixfiles, setfiles, setsebool, semodile, and sestatus. # write selinux config to /etc/selinux etc."selinux/config".text = '' diff --git a/modules/nixos/security/sudo.nix b/modules/nixos/security/sudo.nix index 1dcd97b50..0070fec91 100644 --- a/modules/nixos/security/sudo.nix +++ b/modules/nixos/security/sudo.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkDefault; -in { +in +{ security = { # sudo-rs is still a feature-incomplete sudo fork that can and will mess things up sudo-rs.enable = lib.mkForce false; @@ -26,42 +28,59 @@ in { extraRules = [ { # allow wheel group to run nixos-rebuild without password - groups = ["sudo" "wheel"]; - commands = let - currentSystem = "/run/current-system/"; - storePath = "/nix/store/"; - in [ - { - command = "${storePath}/*/bin/switch-to-configuration"; - options = ["SETENV" "NOPASSWD"]; - } - { - command = "${currentSystem}/sw/bin/nix-store"; - options = ["SETENV" "NOPASSWD"]; - } - { - command = "${currentSystem}/sw/bin/nix-env"; - options = ["SETENV" "NOPASSWD"]; - } - { - command = "${currentSystem}/sw/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - { - command = "${currentSystem}/sw/bin/darwin-rebuild"; - options = ["NOPASSWD"]; - } - { - # let wheel group collect garbage without password - command = "${currentSystem}/sw/bin/nix-collect-garbage"; - options = ["SETENV" "NOPASSWD"]; - } - { - # let wheel group interact with systemd without password - command = "${currentSystem}/sw/bin/systemctl"; - options = ["NOPASSWD"]; - } + groups = [ + "sudo" + "wheel" ]; + commands = + let + currentSystem = "/run/current-system/"; + storePath = "/nix/store/"; + in + [ + { + command = "${storePath}/*/bin/switch-to-configuration"; + options = [ + "SETENV" + "NOPASSWD" + ]; + } + { + command = "${currentSystem}/sw/bin/nix-store"; + options = [ + "SETENV" + "NOPASSWD" + ]; + } + { + command = "${currentSystem}/sw/bin/nix-env"; + options = [ + "SETENV" + "NOPASSWD" + ]; + } + { + command = "${currentSystem}/sw/bin/nixos-rebuild"; + options = [ "NOPASSWD" ]; + } + { + command = "${currentSystem}/sw/bin/darwin-rebuild"; + options = [ "NOPASSWD" ]; + } + { + # let wheel group collect garbage without password + command = "${currentSystem}/sw/bin/nix-collect-garbage"; + options = [ + "SETENV" + "NOPASSWD" + ]; + } + { + # let wheel group interact with systemd without password + command = "${currentSystem}/sw/bin/systemctl"; + options = [ "NOPASSWD" ]; + } + ]; } ]; }; diff --git a/modules/nixos/services/blahaj.nix b/modules/nixos/services/blahaj.nix index 26fa6c119..8787801da 100644 --- a/modules/nixos/services/blahaj.nix +++ b/modules/nixos/services/blahaj.nix @@ -4,11 +4,12 @@ config, inputs', ... -}: { +}: +{ systemd.services."blahaj" = lib.mkIf config.modules.services.blahaj.enable { description = "blahaj"; - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; diff --git a/modules/nixos/services/databases/influxdb.nix b/modules/nixos/services/databases/influxdb.nix index 15bc3591a..6bff65e37 100644 --- a/modules/nixos/services/databases/influxdb.nix +++ b/modules/nixos/services/databases/influxdb.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.services; -in { +in +{ config = mkIf cfg.database.influxdb.enable { services.influxdb2 = { enable = true; diff --git a/modules/nixos/services/databases/mongodb.nix b/modules/nixos/services/databases/mongodb.nix index c3da462bc..9313c3cca 100644 --- a/modules/nixos/services/databases/mongodb.nix +++ b/modules/nixos/services/databases/mongodb.nix @@ -3,11 +3,13 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; cfg = config.modules.services.database.mongodb; -in { +in +{ config = mkIf cfg.enable { services.mongodb = { enable = true; diff --git a/modules/nixos/services/databases/mysql.nix b/modules/nixos/services/databases/mysql.nix index a97b99e57..5eba53e33 100644 --- a/modules/nixos/services/databases/mysql.nix +++ b/modules/nixos/services/databases/mysql.nix @@ -3,18 +3,20 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) mkIf; cfg = config.modules.services.database.mysql; -in { +in +{ config = mkIf cfg.enable { services.mysql = { enable = true; package = pkgs.mariadb; # databases and users - ensureDatabases = ["mkm"]; + ensureDatabases = [ "mkm" ]; ensureUsers = [ { name = "mkm"; diff --git a/modules/nixos/services/databases/postgresql.nix b/modules/nixos/services/databases/postgresql.nix index b1ce9415d..87b779e40 100644 --- a/modules/nixos/services/databases/postgresql.nix +++ b/modules/nixos/services/databases/postgresql.nix @@ -3,11 +3,13 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; cfg = config.modules.services; -in { +in +{ config = mkIf cfg.database.postgresql.enable { services.postgresql = { enable = true; diff --git a/modules/nixos/services/databases/redis.nix b/modules/nixos/services/databases/redis.nix index b16314a56..c42f4a628 100644 --- a/modules/nixos/services/databases/redis.nix +++ b/modules/nixos/services/databases/redis.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.services; -in { +in +{ config = mkIf cfg.database.redis.enable { services.redis = { vmOverCommit = true; diff --git a/modules/nixos/services/dev/atuin.nix b/modules/nixos/services/dev/atuin.nix index b2309f79a..edea8d77a 100644 --- a/modules/nixos/services/dev/atuin.nix +++ b/modules/nixos/services/dev/atuin.nix @@ -1,13 +1,11 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.dev.atuin; -in { +in +{ services = mkIf cfg.enable { atuin = { enable = true; @@ -16,12 +14,10 @@ in { maxHistoryLength = 1024 * 16; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - proxyPass = "http://${cfg.host}:${toString cfg.port}"; - }; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + proxyPass = "http://${cfg.host}:${toString cfg.port}"; + }; + } // template.ssl rdomain; }; } diff --git a/modules/nixos/services/dev/forgejo.nix b/modules/nixos/services/dev/forgejo.nix index 3f8d87a29..ccfaf2c78 100644 --- a/modules/nixos/services/dev/forgejo.nix +++ b/modules/nixos/services/dev/forgejo.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: let +}: +let cfg = config.modules.services.dev.forgejo; rdomain = config.networking.domain; @@ -15,7 +16,8 @@ sha256 = "sha256-14XqO1ZhhPS7VDBSzqW55kh6n5cFZGZmvRCtMEh8JPI="; stripRoot = false; }; -in { +in +{ config = mkIf cfg.enable { modules.services = { networking.nginx.enable = true; @@ -32,9 +34,10 @@ in { systemd.services = { forgejo = { - preStart = let - inherit (config.services.forgejo) stateDir; - in + preStart = + let + inherit (config.services.forgejo) stateDir; + in lib.mkAfter '' rm -rf ${stateDir}/custom/public/assets mkdir -p ${stateDir}/custom/public/assets @@ -76,12 +79,12 @@ in { ui = { DEFAULT_THEME = "catppuccin-mocha-pink"; - THEMES = - builtins.concatStringsSep - "," - (["auto,forgejo-auto,forgejo-dark,forgejo-light,arc-gree,gitea"] - ++ (map (name: lib.removePrefix "theme-" (lib.removeSuffix ".css" name)) - (builtins.attrNames (builtins.readDir theme)))); + THEMES = builtins.concatStringsSep "," ( + [ "auto,forgejo-auto,forgejo-dark,forgejo-light,arc-gree,gitea" ] + ++ (map (name: lib.removePrefix "theme-" (lib.removeSuffix ".css" name)) ( + builtins.attrNames (builtins.readDir theme) + )) + ); }; "ui.meta" = { @@ -152,14 +155,12 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - recommendedProxySettings = true; - proxyPass = "http://unix:/run/forgejo/forgejo.sock"; - }; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + recommendedProxySettings = true; + proxyPass = "http://unix:/run/forgejo/forgejo.sock"; + }; + } // template.ssl rdomain; }; }; } diff --git a/modules/nixos/services/dev/plausible.nix b/modules/nixos/services/dev/plausible.nix index 3909a68ce..95936e27d 100644 --- a/modules/nixos/services/dev/plausible.nix +++ b/modules/nixos/services/dev/plausible.nix @@ -1,13 +1,11 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.dev.plausible; -in { +in +{ config = mkIf cfg.enable { modules.services.database = { postgresql.enable = true; @@ -38,15 +36,13 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; + } // template.ssl rdomain; }; users = { - groups.plausible = {}; + groups.plausible = { }; users.plausible = { group = "plausible"; diff --git a/modules/nixos/services/dev/vscode-server.nix b/modules/nixos/services/dev/vscode-server.nix index c96257a2f..0a521b6a2 100644 --- a/modules/nixos/services/dev/vscode-server.nix +++ b/modules/nixos/services/dev/vscode-server.nix @@ -4,8 +4,9 @@ config, inputs, ... -}: { - imports = [inputs.vscode-server.nixosModules.default]; +}: +{ + imports = [ inputs.vscode-server.nixosModules.default ]; # enable the vscode server config.services.vscode-server = lib.mkIf config.modules.services.dev.vscode-server.enable { diff --git a/modules/nixos/services/dev/wakapi.nix b/modules/nixos/services/dev/wakapi.nix index f96b84b82..d16c7aaa9 100644 --- a/modules/nixos/services/dev/wakapi.nix +++ b/modules/nixos/services/dev/wakapi.nix @@ -4,13 +4,15 @@ self, config, ... -}: let +}: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.dev.wakapi; -in { - imports = [self.nixosModules.wakapi]; +in +{ + imports = [ self.nixosModules.wakapi ]; config = mkIf cfg.enable { modules.services = { @@ -41,19 +43,21 @@ in { disable_frontpage = true; }; - mail = let - mailer = "noreply@${rdomain}"; - in { - enabled = true; - sender = "<${mailer}>"; - provider = "smtp"; - smtp = { - host = "mail.${rdomain}"; - port = 465; - username = mailer; - tls = true; + mail = + let + mailer = "noreply@${rdomain}"; + in + { + enabled = true; + sender = "<${mailer}>"; + provider = "smtp"; + smtp = { + host = "mail.${rdomain}"; + port = 465; + username = mailer; + tls = true; + }; }; - }; }; }; diff --git a/modules/nixos/services/kanidm.nix b/modules/nixos/services/kanidm.nix index 864621404..f5279a61a 100644 --- a/modules/nixos/services/kanidm.nix +++ b/modules/nixos/services/kanidm.nix @@ -1,8 +1,5 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; rdomain = config.networking.domain; @@ -10,7 +7,8 @@ certDir = certs.directory; cfg = config.modules.services.kanidm; -in { +in +{ # might need this later # https://discourse.nixos.org/t/reuse-lets-encrypt-acme-certificate-for-multiple-services-with-lego/6720 # https://ashhhleyyy.dev/blog/2023-02-05-from-keycloak-to-kanidm @@ -38,18 +36,16 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/".proxyPass = "https://${config.services.kanidm.serverSettings.bindaddress}"; - } - // lib.template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "https://${config.services.kanidm.serverSettings.bindaddress}"; + } // lib.template.ssl rdomain; }; systemd.services.kanidm = { - after = ["acme-selfsigned-internal.${rdomain}.target"]; + after = [ "acme-selfsigned-internal.${rdomain}.target" ]; serviceConfig = { - SupplementaryGroups = [certs.group]; - BindReadOnlyPaths = [certDir]; + SupplementaryGroups = [ certs.group ]; + BindReadOnlyPaths = [ certDir ]; }; }; }; diff --git a/modules/nixos/services/mailserver.nix b/modules/nixos/services/mailserver.nix index 06e06bf35..7b9d93426 100644 --- a/modules/nixos/services/mailserver.nix +++ b/modules/nixos/services/mailserver.nix @@ -4,13 +4,15 @@ pkgs, inputs, ... -}: let +}: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.mailserver; -in { - imports = [inputs.simple-nixos-mailserver.nixosModule]; +in +{ + imports = [ inputs.simple-nixos-mailserver.nixosModule ]; config = mkIf cfg.enable { modules.services = { @@ -22,7 +24,10 @@ in { }; # required for roundcube - networking.firewall.allowedTCPPorts = [80 443]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; mailserver = { enable = true; @@ -61,12 +66,10 @@ in { localDnsResolver = false; fqdn = "${cfg.domain}"; certificateScheme = "acme-nginx"; - domains = ["${rdomain}"]; + domains = [ "${rdomain}" ]; # Set all no-reply addresses - rejectRecipients = [ - "noreply@${rdomain}" - ]; + rejectRecipients = [ "noreply@${rdomain}" ]; loginAccounts = { "isabel@${rdomain}" = { @@ -88,27 +91,44 @@ in { }; "git@${rdomain}" = { - aliases = ["git" "git@${rdomain}"]; + aliases = [ + "git" + "git@${rdomain}" + ]; hashedPasswordFile = config.age.secrets.mailserver-git.path; }; "vaultwarden@${rdomain}" = { - aliases = ["vaultwarden" "bitwarden" "bitwarden@${rdomain}"]; + aliases = [ + "vaultwarden" + "bitwarden" + "bitwarden@${rdomain}" + ]; hashedPasswordFile = config.age.secrets.mailserver-vaultwarden.path; }; "grafana@${rdomain}" = { - aliases = ["grafana" "monitor" "monitor@${rdomain}"]; + aliases = [ + "grafana" + "monitor" + "monitor@${rdomain}" + ]; hashedPasswordFile = config.age.secrets.mailserver-grafana.path; }; "noreply@${rdomain}" = { - aliases = ["noreply"]; + aliases = [ "noreply" ]; hashedPasswordFile = config.age.secrets.mailserver-noreply.path; }; "spam@${rdomain}" = { - aliases = ["spam" "shush" "shush@${rdomain}" "stfu" "stfu@${rdomain}"]; + aliases = [ + "spam" + "shush" + "shush@${rdomain}" + "stfu" + "stfu@${rdomain}" + ]; hashedPasswordFile = config.age.secrets.mailserver-spam.path; }; }; @@ -151,11 +171,10 @@ in { enable = true; package = pkgs.roundcube.withPlugins ( - plugins: - with plugins; [ - persistent_login - carddav - ] + plugins: with plugins; [ + persistent_login + carddav + ] ); # database = { @@ -164,7 +183,7 @@ in { # }; maxAttachmentSize = 50; - dicts = with pkgs.aspellDicts; [en]; + dicts = with pkgs.aspellDicts; [ en ]; plugins = [ "carddav" @@ -207,7 +226,7 @@ in { ''; config = { - smtp_helo_name = config.mailserver.fqdn; + smtp_hello_name = config.mailserver.fqdn; }; }; @@ -216,11 +235,9 @@ in { "listen.group" = config.services.nginx.group; }; - nginx.virtualHosts."webmail.${rdomain}" = - { - locations."/".extraConfig = lib.mkForce ""; - } - // template.ssl rdomain; + nginx.virtualHosts."webmail.${rdomain}" = { + locations."/".extraConfig = lib.mkForce ""; + } // template.ssl rdomain; }; }; } diff --git a/modules/nixos/services/media/akkoma/blocklist.nix b/modules/nixos/services/media/akkoma/blocklist.nix index 79bfa26db..22917b75a 100644 --- a/modules/nixos/services/media/akkoma/blocklist.nix +++ b/modules/nixos/services/media/akkoma/blocklist.nix @@ -2,7 +2,9 @@ # Automated moderation list # Largely borrowed from https://github.com/chaossocial/about/blob/master/blocked_instances.md - media_nsfw = {"sinblr.com" = "Untagged NSFW content";}; + media_nsfw = { + "sinblr.com" = "Untagged NSFW content"; + }; reject = { "bae.st" = ''Discrimination, racism, "free speech zone"²''; diff --git a/modules/nixos/services/media/akkoma/default.nix b/modules/nixos/services/media/akkoma/default.nix index 69dd9471d..049726bfd 100644 --- a/modules/nixos/services/media/akkoma/default.nix +++ b/modules/nixos/services/media/akkoma/default.nix @@ -4,21 +4,26 @@ self', config, ... -}: let +}: +let inherit (lib) mkIf; - inherit ((pkgs.formats.elixirConf {}).lib) mkRaw mkMap; + inherit ((pkgs.formats.elixirConf { }).lib) mkRaw mkMap; rdomain = config.networking.domain; cfg = config.modules.services.media.akkoma; -in { +in +{ config = mkIf cfg.enable { services.akkoma = { enable = true; - extraPackages = with pkgs; [ffmpeg exiftool imagemagick]; + extraPackages = with pkgs; [ + ffmpeg + exiftool + imagemagick + ]; extraStatic = { - "static/terms-of-service.html" = - pkgs.writeText "terms-of-service.html" "Just be normal please"; + "static/terms-of-service.html" = pkgs.writeText "terms-of-service.html" "Just be normal please"; "favicon.png" = pkgs.fetchurl { url = "https://avatars.githubusercontent.com/u/71222764?v=4"; @@ -38,7 +43,7 @@ in { email = "isabel@isabelroses.com"; notify_email = "noreply@isabelroses.com"; - languages = ["en"]; + languages = [ "en" ]; registrations_open = false; invites_enabled = true; @@ -80,21 +85,22 @@ in { path = "/api/pleroma/app_metrics"; }; - ":pleroma".":mrf".policies = - map mkRaw ["Pleroma.Web.ActivityPub.MRF.SimplePolicy"]; + ":pleroma".":mrf".policies = map mkRaw [ "Pleroma.Web.ActivityPub.MRF.SimplePolicy" ]; # we configure from nix ":pleroma".":configurable_from_database" = false; ":pleroma"."Pleroma.Captcha".enabled = false; - ":pleroma".":mrf_simple" = let - blocklist = import ./blocklist.nix; - in { - media_nsfw = mkMap blocklist.media_nsfw; - reject = mkMap blocklist.reject; - followers_only = mkMap blocklist.followers_only; - }; + ":pleroma".":mrf_simple" = + let + blocklist = import ./blocklist.nix; + in + { + media_nsfw = mkMap blocklist.media_nsfw; + reject = mkMap blocklist.reject; + followers_only = mkMap blocklist.followers_only; + }; }; nginx = { diff --git a/modules/nixos/services/media/jellyfin.nix b/modules/nixos/services/media/jellyfin.nix index d39e2bd34..23a49f4a2 100644 --- a/modules/nixos/services/media/jellyfin.nix +++ b/modules/nixos/services/media/jellyfin.nix @@ -1,11 +1,9 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf; cfg = config.modules.services.media.jellyfin; -in { +in +{ services.jellyfin = mkIf cfg.enable { enable = true; group = "jellyfin"; diff --git a/modules/nixos/services/media/matrix.nix b/modules/nixos/services/media/matrix.nix index e36d813a8..d62502b32 100644 --- a/modules/nixos/services/media/matrix.nix +++ b/modules/nixos/services/media/matrix.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf template; rdomain = config.networking.domain; @@ -24,9 +25,10 @@ add_header X-Content-Type-Options nosniff; return 200 '${builtins.toJSON data}'; ''; -in { +in +{ config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = [cfg.port]; + networking.firewall.allowedTCPPorts = [ cfg.port ]; modules.services = { networking.nginx.enable = true; @@ -46,23 +48,19 @@ in { }; nginx.virtualHosts = { - ${rdomain} = - { - locations = { - "= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig; - "= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig; - "/_matrix".proxyPass = "http://[${bindAddress}]:${toString cfg.port}"; - "/_synapse/client".proxyPass = "http://[${bindAddress}]:${toString cfg.port}"; - }; - serverAliases = ["${cfg.domain}"]; - } - // template.ssl rdomain; - - "matrix-sync.${rdomain}" = - { - locations."/".proxyPass = "http://[${bindAddress}]:8002"; - } - // template.ssl rdomain; + ${rdomain} = { + locations = { + "= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig; + "= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig; + "/_matrix".proxyPass = "http://[${bindAddress}]:${toString cfg.port}"; + "/_synapse/client".proxyPass = "http://[${bindAddress}]:${toString cfg.port}"; + }; + serverAliases = [ "${cfg.domain}" ]; + } // template.ssl rdomain; + + "matrix-sync.${rdomain}" = { + locations."/".proxyPass = "http://[${bindAddress}]:8002"; + } // template.ssl rdomain; }; matrix-sliding-sync = { @@ -77,7 +75,7 @@ in { matrix-synapse = { enable = true; - extraConfigFiles = [config.age.secrets.matrix.path]; + extraConfigFiles = [ config.age.secrets.matrix.path ]; settings = { withJemalloc = true; enable_registration = true; @@ -134,10 +132,13 @@ in { listeners = [ { inherit (cfg) port; - bind_addresses = ["${bindAddress}"]; + bind_addresses = [ "${bindAddress}" ]; resources = [ { - names = ["client" "federation"]; + names = [ + "client" + "federation" + ]; compress = true; } ]; diff --git a/modules/nixos/services/media/nextcloud.nix b/modules/nixos/services/media/nextcloud.nix index b90fd1932..31716222e 100644 --- a/modules/nixos/services/media/nextcloud.nix +++ b/modules/nixos/services/media/nextcloud.nix @@ -3,13 +3,15 @@ pkgs, config, ... -}: let +}: +let rdomain = config.networking.domain; inherit (lib) mkIf template; cfg = config.modules.services.media.nextcloud; -in { +in +{ config = mkIf cfg.enable { modules.services = { networking.nginx.enable = true; @@ -62,8 +64,8 @@ in { defaultPhoneRegion = "UK"; overwriteProtocol = "https"; - extraTrustedDomains = ["https://${toString cfg.domain}"]; - trustedProxies = ["https://${toString cfg.domain}"]; + extraTrustedDomains = [ "https://${toString cfg.domain}" ]; + trustedProxies = [ "https://${toString cfg.domain}" ]; redis = { host = "/run/redis-nextcloud/redis.sock"; @@ -82,11 +84,11 @@ in { }; systemd.services = { - phpfpm-nextcloud.aliases = ["nextcloud.service"]; + phpfpm-nextcloud.aliases = [ "nextcloud.service" ]; "nextcloud-setup" = { - requires = ["postgresql.service"]; - after = ["postgresql.service"]; + requires = [ "postgresql.service" ]; + after = [ "postgresql.service" ]; serviceConfig = { Restart = "on-failure"; RestartSec = "10s"; diff --git a/modules/nixos/services/media/photoprism.nix b/modules/nixos/services/media/photoprism.nix index c4eac18ed..4dcb99b4f 100644 --- a/modules/nixos/services/media/photoprism.nix +++ b/modules/nixos/services/media/photoprism.nix @@ -1,12 +1,10 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.media.photoprism; -in { +in +{ config = mkIf cfg.enable { modules.services = { networking.nginx.enable = true; diff --git a/modules/nixos/services/monitoring/grafana/dashboards.nix b/modules/nixos/services/monitoring/grafana/dashboards.nix index af401f75f..199714982 100644 --- a/modules/nixos/services/monitoring/grafana/dashboards.nix +++ b/modules/nixos/services/monitoring/grafana/dashboards.nix @@ -1,22 +1,23 @@ -{ - lib, - pkgs, - ... -}: let - loadDashboard = file: +{ lib, pkgs, ... }: +let + loadDashboard = + file: lib.pipe file [ lib.importJSON - ({dashboard, ...}: rec { - name = "provision-dashboard-${dashboard.uid}.json"; - path = builtins.toFile name (builtins.toJSON dashboard); - }) + ( + { dashboard, ... }: + rec { + name = "provision-dashboard-${dashboard.uid}.json"; + path = builtins.toFile name (builtins.toJSON dashboard); + } + ) ]; - dashboardsDir = - pkgs.linkFarm - "grafana-provisioning-dashboards" - (map loadDashboard (lib.filesystem.listFilesRecursive ./dashboards)); -in { + dashboardsDir = pkgs.linkFarm "grafana-provisioning-dashboards" ( + map loadDashboard (lib.filesystem.listFilesRecursive ./dashboards) + ); +in +{ services.grafana.provision.dashboards.settings = { providers = lib.singleton { options.path = dashboardsDir; diff --git a/modules/nixos/services/monitoring/grafana/default.nix b/modules/nixos/services/monitoring/grafana/default.nix index 3abfe1361..01c8c66f9 100644 --- a/modules/nixos/services/monitoring/grafana/default.nix +++ b/modules/nixos/services/monitoring/grafana/default.nix @@ -1,16 +1,14 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; srv = config.modules.services; cfg = srv.monitoring.grafana; -in { +in +{ config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = [cfg.port]; + networking.firewall.allowedTCPPorts = [ cfg.port ]; modules.services.database = { postgresql.enable = true; @@ -36,18 +34,20 @@ in { ssl_mode = "disable"; }; - smtp = let - mailer = "grafana@${cfg.domain}"; - in { - enabled = true; + smtp = + let + mailer = "grafana@${cfg.domain}"; + in + { + enabled = true; - user = mailer; - password = "$__file{" + config.age.secrets.mailserver-grafana-nohash.path + "}"; + user = mailer; + password = "$__file{" + config.age.secrets.mailserver-grafana-nohash.path + "}"; - host = "${config.modules.services.mailserver.domain}:465"; - from_address = mailer; - startTLS_policy = "MandatoryStartTLS"; - }; + host = "${config.modules.services.mailserver.domain}:465"; + from_address = mailer; + startTLS_policy = "MandatoryStartTLS"; + }; security = { cookie_secure = true; @@ -62,23 +62,25 @@ in { "auth.anonymous".enabled = false; "auth.basic".enabled = false; - "auth.generic_oauth" = let - sso = "https://${config.modules.services.kanidm.domain}"; - in { - enabled = true; - # auto_login = true; - allow_signup = true; - icon = "signin"; - name = "Kanidm"; - client_id = "grafana"; - client_secret = "$__file{${config.age.secrets.grafana-oauth2.path}}"; - use_pkce = true; - scopes = "openid email profile"; - login_attribute_path = "prefered_username"; - auth_url = "${sso}/ui/oauth2"; - token_url = "${sso}/oauth2/token"; - api_url = "${sso}/oauth2/openid/grafana/userinfo"; - }; + "auth.generic_oauth" = + let + sso = "https://${config.modules.services.kanidm.domain}"; + in + { + enabled = true; + # auto_login = true; + allow_signup = true; + icon = "signin"; + name = "Kanidm"; + client_id = "grafana"; + client_secret = "$__file{${config.age.secrets.grafana-oauth2.path}}"; + use_pkce = true; + scopes = "openid email profile"; + login_attribute_path = "preferred_username"; + auth_url = "${sso}/ui/oauth2"; + token_url = "${sso}/oauth2/token"; + api_url = "${sso}/oauth2/openid/grafana/userinfo"; + }; users = { allow_signup = false; @@ -124,14 +126,12 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - proxyPass = "http://${cfg.host}:${toString cfg.port}/"; - proxyWebsockets = true; - }; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + proxyPass = "http://${cfg.host}:${toString cfg.port}/"; + proxyWebsockets = true; + }; + } // template.ssl rdomain; }; }; } diff --git a/modules/nixos/services/monitoring/loki.nix b/modules/nixos/services/monitoring/loki.nix index 95893a965..17f4f16c0 100644 --- a/modules/nixos/services/monitoring/loki.nix +++ b/modules/nixos/services/monitoring/loki.nix @@ -1,19 +1,17 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.services.monitoring.loki; lcfg = config.services.loki; -in { +in +{ config = mkIf cfg.enable { # https://gist.github.com/rickhull/895b0cb38fdd537c1078a858cf15d63e services.loki = { enable = true; dataDir = "/srv/storage/loki"; - extraFlags = ["--config.expand-env=true"]; + extraFlags = [ "--config.expand-env=true" ]; configuration = { server = { diff --git a/modules/nixos/services/monitoring/prometheus.nix b/modules/nixos/services/monitoring/prometheus.nix index 5abace5a7..26e0f6f47 100644 --- a/modules/nixos/services/monitoring/prometheus.nix +++ b/modules/nixos/services/monitoring/prometheus.nix @@ -1,12 +1,10 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; cfg = config.modules.services.monitoring.prometheus; -in { +in +{ config = mkIf cfg.enable { services = { # Prometheus exporter for Grafana @@ -59,53 +57,49 @@ in { }; }; - scrapeConfigs = let - exp = config.services.prometheus.exporters; - in [ - { - job_name = "prometheus"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString config.services.prometheus.port}"];}]; - } - { - job_name = "node"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString exp.node.port}"];}]; - } - { - job_name = "redis"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString exp.redis.port}"];}]; - } - { - job_name = "postgres"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString exp.postgres.port}"];}]; - } - { - job_name = "nginx"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString exp.nginx.port}"];}]; - } - { - job_name = "uptime-kuma"; - scrape_interval = "30s"; - scrape_timeout = "10s"; - metrics_path = "/metrics"; - static_configs = [ - { - targets = [ - "${cfg.host}:3500" - ]; - } - ]; - } - { - job_name = "smartctl"; - scrape_interval = "30s"; - static_configs = [{targets = ["${cfg.host}:${toString exp.smartctl.port}"];}]; - } - ]; + scrapeConfigs = + let + exp = config.services.prometheus.exporters; + in + [ + { + job_name = "prometheus"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString config.services.prometheus.port}" ]; } ]; + } + { + job_name = "node"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString exp.node.port}" ]; } ]; + } + { + job_name = "redis"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString exp.redis.port}" ]; } ]; + } + { + job_name = "postgres"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString exp.postgres.port}" ]; } ]; + } + { + job_name = "nginx"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString exp.nginx.port}" ]; } ]; + } + { + job_name = "uptime-kuma"; + scrape_interval = "30s"; + scrape_timeout = "10s"; + metrics_path = "/metrics"; + static_configs = [ { targets = [ "${cfg.host}:3500" ]; } ]; + } + { + job_name = "smartctl"; + scrape_interval = "30s"; + static_configs = [ { targets = [ "${cfg.host}:${toString exp.smartctl.port}" ]; } ]; + } + ]; }; }; }; diff --git a/modules/nixos/services/monitoring/uptime-kuma.nix b/modules/nixos/services/monitoring/uptime-kuma.nix index ba2ac93bc..2a5778a3f 100644 --- a/modules/nixos/services/monitoring/uptime-kuma.nix +++ b/modules/nixos/services/monitoring/uptime-kuma.nix @@ -1,13 +1,11 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.monitoring.uptime-kuma; -in { +in +{ config = mkIf cfg.enable { services.uptime-kuma = { enable = true; @@ -18,13 +16,11 @@ in { }; }; - services.nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - proxyPass = "http://${cfg.host}:${toString cfg.port}"; - proxyWebsockets = true; - }; - } - // template.ssl rdomain; + services.nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + proxyPass = "http://${cfg.host}:${toString cfg.port}"; + proxyWebsockets = true; + }; + } // template.ssl rdomain; }; } diff --git a/modules/nixos/services/networking/cloudflared.nix b/modules/nixos/services/networking/cloudflared.nix index a4727ebcc..b1ffb72a1 100644 --- a/modules/nixos/services/networking/cloudflared.nix +++ b/modules/nixos/services/networking/cloudflared.nix @@ -1,13 +1,11 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf; cfg = config.modules.services.networking.cloudflared; -in { - users.groups.cloudflared = {}; +in +{ + users.groups.cloudflared = { }; users.users.cloudflared = { description = "Cloudflared user"; home = "/var/lib/cloudflared"; diff --git a/modules/nixos/services/networking/headscale.nix b/modules/nixos/services/networking/headscale.nix index 8a7c541cf..e69fec5e9 100644 --- a/modules/nixos/services/networking/headscale.nix +++ b/modules/nixos/services/networking/headscale.nix @@ -3,20 +3,22 @@ lib, self', ... -}: let +}: +let inherit (lib) mkIf; rdomain = config.networking.domain; cfg = config.modules.services.networking.headscale; -in { +in +{ config = mkIf cfg.enable { modules.services = { networking.nginx.enable = true; database.postgresql.enable = true; }; - environment.systemPackages = [config.services.headscale.package]; - networking.firewall.allowedUDPPorts = [cfg.port]; + environment.systemPackages = [ config.services.headscale.package ]; + networking.firewall.allowedUDPPorts = [ cfg.port ]; services = { headscale = { @@ -31,10 +33,8 @@ in { override_local_dns = true; base_domain = "${rdomain}"; magic_dns = true; - domains = ["${cfg.domain}"]; - nameservers = [ - "9.9.9.9" - ]; + domains = [ "${cfg.domain}" ]; + nameservers = [ "9.9.9.9" ]; }; log = { @@ -60,19 +60,17 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - recommendedProxySettings = true; - proxyPass = "http://localhost:${toString cfg.port}"; - proxyWebsockets = true; - }; + nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + recommendedProxySettings = true; + proxyPass = "http://localhost:${toString cfg.port}"; + proxyWebsockets = true; + }; - locations."/web" = { - root = "${self'.packages.headscale-ui}/share"; - }; - } - // lib.template.ssl rdomain; + locations."/web" = { + root = "${self'.packages.headscale-ui}/share"; + }; + } // lib.template.ssl rdomain; }; }; } diff --git a/modules/nixos/services/networking/nginx.nix b/modules/nixos/services/networking/nginx.nix index 15908b141..148344f09 100644 --- a/modules/nixos/services/networking/nginx.nix +++ b/modules/nixos/services/networking/nginx.nix @@ -3,10 +3,12 @@ pkgs, config, ... -}: let +}: +let cfg = config.modules.services.networking.nginx; inherit (lib) mkIf; -in { +in +{ config = mkIf cfg.enable { networking.domain = cfg.domain; @@ -16,24 +18,20 @@ in { defaults.email = "isabel@${cfg.domain}"; certs.${cfg.domain} = { - extraDomainNames = [ - "*.${cfg.domain}" - ]; + extraDomainNames = [ "*.${cfg.domain}" ]; dnsProvider = "cloudflare"; credentialsFile = config.age.secrets."cloudflare-cert-api".path; }; }; }; - users.users.nginx.extraGroups = ["acme"]; + users.users.nginx.extraGroups = [ "acme" ]; services.nginx = { enable = true; statusPage = true; # For monitoring scraping. - package = pkgs.nginxQuic.override { - withKTLS = true; - }; + package = pkgs.nginxQuic.override { withKTLS = true; }; commonHttpConfig = '' # real_ip_header CF-Connecting-IP; diff --git a/modules/nixos/services/vaultwarden.nix b/modules/nixos/services/vaultwarden.nix index 69f93c7c2..2d4d43a36 100644 --- a/modules/nixos/services/vaultwarden.nix +++ b/modules/nixos/services/vaultwarden.nix @@ -1,13 +1,11 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.vaultwarden; -in { +in +{ config = mkIf cfg.enable { # this forces the system to create backup folder systemd.services.backup-vaultwarden.serviceConfig = { @@ -43,14 +41,12 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/" = { - proxyPass = "http://${cfg.host}:${toString cfg.port}"; - extraConfig = "proxy_pass_header Authorization;"; - }; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/" = { + proxyPass = "http://${cfg.host}:${toString cfg.port}"; + extraConfig = "proxy_pass_header Authorization;"; + }; + } // template.ssl rdomain; }; }; } diff --git a/modules/nixos/services/vikunja.nix b/modules/nixos/services/vikunja.nix index 28ef10584..ec3d9d28c 100644 --- a/modules/nixos/services/vikunja.nix +++ b/modules/nixos/services/vikunja.nix @@ -1,13 +1,11 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf template; rdomain = config.networking.domain; cfg = config.modules.services.vikunja; -in { +in +{ config = mkIf cfg.enable { modules.services = { networking.nginx.enable = true; @@ -24,7 +22,7 @@ in { frontendHostname = cfg.domain; frontendScheme = "https"; - environmentFiles = [config.age.secrets.vikunja-env.path]; + environmentFiles = [ config.age.secrets.vikunja-env.path ]; database = { type = "postgres"; @@ -55,16 +53,18 @@ in { openid = { enabled = true; redirecturl = "https://${cfg.domain}/auth/openid/"; - providers = let - sso = config.modules.services.kanidm.domain; - in [ - { - name = "Isabel's SSO"; - authurl = "https://${sso}/oauth2/openid/vikunja/"; - logouturl = "https://${sso}/logout"; - clientid = "vikunja"; - } - ]; + providers = + let + sso = config.modules.services.kanidm.domain; + in + [ + { + name = "Isabel's SSO"; + authurl = "https://${sso}/oauth2/openid/vikunja/"; + logouturl = "https://${sso}/logout"; + clientid = "vikunja"; + } + ]; }; # redis @@ -76,15 +76,13 @@ in { }; }; - nginx.virtualHosts.${cfg.domain} = - { - locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; - } - // template.ssl rdomain; + nginx.virtualHosts.${cfg.domain} = { + locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; + } // template.ssl rdomain; }; users = { - groups.vikunja = {}; + groups.vikunja = { }; users."vikunja" = { group = "vikunja"; diff --git a/modules/nixos/services/website.nix b/modules/nixos/services/website.nix index 8a4996b29..3d6ddf9a0 100644 --- a/modules/nixos/services/website.nix +++ b/modules/nixos/services/website.nix @@ -3,21 +3,21 @@ lib, inputs, ... -}: let +}: +let inherit (config.networking) domain; inherit (lib) mkIf template; cfg = config.modules.services.isabelroses-website; -in { - imports = [inputs.isabelroses-website.nixosModules.default]; +in +{ + imports = [ inputs.isabelroses-website.nixosModules.default ]; config = mkIf cfg.enable { services.isabelroses-website.enable = true; - services.nginx.virtualHosts.${domain} = - { - locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; - } - // template.ssl domain; + services.nginx.virtualHosts.${domain} = { + locations."/".proxyPass = "http://${cfg.host}:${toString cfg.port}"; + } // template.ssl domain; }; } diff --git a/modules/nixos/themes.nix b/modules/nixos/themes.nix index 88067d535..5ad7e7ec7 100644 --- a/modules/nixos/themes.nix +++ b/modules/nixos/themes.nix @@ -1,5 +1,6 @@ -{inputs, ...}: { - imports = [inputs.catppuccin.nixosModules.catppuccin]; +{ inputs, ... }: +{ + imports = [ inputs.catppuccin.nixosModules.catppuccin ]; config.catppuccin = { enable = true; diff --git a/modules/nixos/virtualization.nix b/modules/nixos/virtualization.nix index dfaad8cf7..b5fed9a9c 100644 --- a/modules/nixos/virtualization.nix +++ b/modules/nixos/virtualization.nix @@ -3,13 +3,16 @@ config, pkgs, ... -}: let +}: +let inherit (lib) optionals mkIf concatLists; sys = config.modules.system; cfg = sys.virtualization; -in { +in +{ config = mkIf cfg.enable { - environment.systemPackages = with pkgs; + environment.systemPackages = + with pkgs; concatLists [ (optionals cfg.qemu.enable [ virt-manager @@ -19,15 +22,9 @@ in { podman podman-compose ]) - (optionals (cfg.docker.enable && sys.video.enable) [ - lxd - ]) - (optionals cfg.distrobox.enable [ - distrobox - ]) - (optionals cfg.waydroid.enable [ - waydroid - ]) + (optionals (cfg.docker.enable && sys.video.enable) [ lxd ]) + (optionals cfg.distrobox.enable [ distrobox ]) + (optionals cfg.waydroid.enable [ waydroid ]) ]; virtualisation = { @@ -41,7 +38,7 @@ in { package = pkgs.qemu_kvm; ovmf = { enable = true; - packages = [pkgs.OVMFFull.fd]; + packages = [ pkgs.OVMFFull.fd ]; }; swtpm.enable = true; }; @@ -58,7 +55,7 @@ in { enableNvidia = builtins.any (driver: driver == "nvidia") config.services.xserver.videoDrivers; autoPrune = { enable = true; - flags = ["--all"]; + flags = [ "--all" ]; dates = "weekly"; }; }; @@ -69,7 +66,7 @@ in { systemd.user = mkIf cfg.distrobox.enable { timers."distrobox-update" = { enable = true; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { OnBootSec = "1h"; OnUnitActiveSec = "1d"; diff --git a/modules/profiles/hardware/desktop/default.nix b/modules/profiles/hardware/desktop/default.nix index 0967ef424..ffcd4415b 100644 --- a/modules/profiles/hardware/desktop/default.nix +++ b/modules/profiles/hardware/desktop/default.nix @@ -1 +1 @@ -{} +{ } diff --git a/modules/profiles/hardware/laptop/power/default.nix b/modules/profiles/hardware/laptop/power/default.nix index 7ffe22cde..5f84dd6e4 100644 --- a/modules/profiles/hardware/laptop/power/default.nix +++ b/modules/profiles/hardware/laptop/power/default.nix @@ -4,10 +4,12 @@ lib, inputs, ... -}: let +}: +let inherit (lib) mkDefault; -in { - imports = [inputs.auto-cpufreq.nixosModules.default]; +in +{ + imports = [ inputs.auto-cpufreq.nixosModules.default ]; config = { hardware.acpilight.enable = true; @@ -19,22 +21,24 @@ in { programs.auto-cpufreq = { enable = true; - settings = let - MHz = x: x * 1000; - in { - battery = { - governor = "powersave"; - scaling_min_freq = mkDefault (MHz 1200); - scaling_max_freq = mkDefault (MHz 1800); - turbo = "never"; - }; - charger = { - governor = "performance"; - scaling_min_freq = mkDefault (MHz 1800); - scaling_max_freq = mkDefault (MHz 3800); - turbo = "auto"; + settings = + let + MHz = x: x * 1000; + in + { + battery = { + governor = "powersave"; + scaling_min_freq = mkDefault (MHz 1200); + scaling_max_freq = mkDefault (MHz 1800); + turbo = "never"; + }; + charger = { + governor = "performance"; + scaling_min_freq = mkDefault (MHz 1800); + scaling_max_freq = mkDefault (MHz 3800); + turbo = "auto"; + }; }; - }; }; services = { @@ -51,23 +55,23 @@ in { }; /* - # superior power management - auto-cpufreq.enable = true; + # superior power management + auto-cpufreq.enable = true; - auto-cpufreq.settings = { - battery = { - governor = "powersave"; - scaling_min_freq = mkDefault (MHz 1200); - scaling_max_freq = mkDefault (MHz 1800); - turbo = "never"; + auto-cpufreq.settings = { + battery = { + governor = "powersave"; + scaling_min_freq = mkDefault (MHz 1200); + scaling_max_freq = mkDefault (MHz 1800); + turbo = "never"; + }; + charger = { + governor = "performance"; + scaling_min_freq = mkDefault (MHz 1800); + scaling_max_freq = mkDefault (MHz 3000); + turbo = "auto"; + }; }; - charger = { - governor = "performance"; - scaling_min_freq = mkDefault (MHz 1800); - scaling_max_freq = mkDefault (MHz 3000); - turbo = "auto"; - }; - }; */ # DBus service that provides power management support to applications. @@ -81,7 +85,7 @@ in { }; boot = { - kernelModules = ["acpi_call"]; + kernelModules = [ "acpi_call" ]; extraModulePackages = with config.boot.kernelPackages; [ acpi_call cpupower diff --git a/modules/profiles/hardware/laptop/power/plugged.nix b/modules/profiles/hardware/laptop/power/plugged.nix index 9b64ee4f8..f62a3e4e3 100644 --- a/modules/profiles/hardware/laptop/power/plugged.nix +++ b/modules/profiles/hardware/laptop/power/plugged.nix @@ -1,10 +1,8 @@ +{ lib, pkgs, ... }: +let + programs = lib.makeBinPath [ pkgs.hyprland ]; +in { - lib, - pkgs, - ... -}: let - programs = lib.makeBinPath [pkgs.hyprland]; -in { unplugged = pkgs.writeShellScript "unplugged" '' export PATH=$PATH:${programs} export HYPRLAND_INSTANCE_SIGNATURE=$(ls -w1 /tmp/hypr | tail -1) diff --git a/modules/profiles/hardware/laptop/power/tlp.nix b/modules/profiles/hardware/laptop/power/tlp.nix index 346e7c12d..a62a1f395 100644 --- a/modules/profiles/hardware/laptop/power/tlp.nix +++ b/modules/profiles/hardware/laptop/power/tlp.nix @@ -1,11 +1,9 @@ -{ - config, - lib, - ... -}: let +{ config, lib, ... }: +let inherit (lib) mkIf; MHz = x: x * 1000; -in { +in +{ config = { services = { # Enable the TLP daemon for laptop power management. @@ -16,7 +14,7 @@ in { TLP_ENABLE = 1; TLP_DEFAULT_MODE = "BAT"; - # Timeout (in seconds) for the audio power saving mode (supports Intel HDA, AC97). + # Timeout (in seconds) for the audio power saving mode (supports Intel HAD, AC97). # A value of 1 is recommended for Linux desktop environments with PulseAudio, # systems without PulseAudio may require 10. The value 0 disables power save. SOUND_POWER_SAVE_ON_AC = 10; diff --git a/modules/profiles/hardware/server/default.nix b/modules/profiles/hardware/server/default.nix index 14812ea03..a44355772 100644 --- a/modules/profiles/hardware/server/default.nix +++ b/modules/profiles/hardware/server/default.nix @@ -1,5 +1 @@ -{ - imports = [ - ./users - ]; -} +{ imports = [ ./users ]; } diff --git a/modules/profiles/hardware/server/users/default.nix b/modules/profiles/hardware/server/users/default.nix index d8438c3ae..a02a22f18 100644 --- a/modules/profiles/hardware/server/users/default.nix +++ b/modules/profiles/hardware/server/users/default.nix @@ -1,5 +1 @@ -{ - imports = [ - ./git.nix - ]; -} +{ imports = [ ./git.nix ]; } diff --git a/modules/profiles/hardware/server/users/git.nix b/modules/profiles/hardware/server/users/git.nix index 915ffd526..e4d5eddc5 100644 --- a/modules/profiles/hardware/server/users/git.nix +++ b/modules/profiles/hardware/server/users/git.nix @@ -1,13 +1,11 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (lib) mkIf; cfg = config.modules.services.dev.forgejo; -in { +in +{ users = mkIf cfg.enable { - groups.git = {}; + groups.git = { }; users.git = { isSystemUser = true; diff --git a/modules/profiles/hardware/wsl/default.nix b/modules/profiles/hardware/wsl/default.nix index c2149e56d..de4a1b9f7 100644 --- a/modules/profiles/hardware/wsl/default.nix +++ b/modules/profiles/hardware/wsl/default.nix @@ -3,10 +3,12 @@ config, lib, ... -}: let +}: +let inherit (lib) mkForce; -in { - imports = [inputs.nixos-wsl.nixosModules.wsl]; +in +{ + imports = [ inputs.nixos-wsl.nixosModules.wsl ]; config = { wsl = { enable = true; diff --git a/modules/profiles/meta/graphical/display.nix b/modules/profiles/meta/graphical/display.nix index e1b591d69..b14429b45 100644 --- a/modules/profiles/meta/graphical/display.nix +++ b/modules/profiles/meta/graphical/display.nix @@ -1,10 +1,11 @@ -{config, ...}: let +{ config, ... }: +let inherit (config.modules) environment; -in { +in +{ services.displayManager.sddm = { enable = environment.loginManager == "sddm"; wayland.enable = true; - # theme = pkgs.catppuccin-sddm; settings.General.InputMethod = ""; }; } diff --git a/modules/profiles/meta/graphical/flatpak.nix b/modules/profiles/meta/graphical/flatpak.nix index e84297687..f6dabcbe5 100644 --- a/modules/profiles/meta/graphical/flatpak.nix +++ b/modules/profiles/meta/graphical/flatpak.nix @@ -2,5 +2,5 @@ # enable flatpak services.flatpak.enable = true; - environment.sessionVariables.XDG_DATA_DIRS = ["/var/lib/flatpak/exports/share"]; + environment.sessionVariables.XDG_DATA_DIRS = [ "/var/lib/flatpak/exports/share" ]; } diff --git a/modules/profiles/meta/graphical/login/greetd.nix b/modules/profiles/meta/graphical/login/greetd.nix index e9ea70e72..74786f59f 100644 --- a/modules/profiles/meta/graphical/login/greetd.nix +++ b/modules/profiles/meta/graphical/login/greetd.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: let +}: +let inherit (config.modules) system environment; inherit (lib) mkIf getExe concatStringsSep; @@ -29,7 +30,8 @@ "--sessions '${sessionPath}'" ]; }; -in { +in +{ services.greetd = { enable = environment.loginManager == "greetd"; vt = 2; diff --git a/modules/profiles/meta/graphical/login/pam.nix b/modules/profiles/meta/graphical/login/pam.nix index 99dc6144b..b5903b940 100644 --- a/modules/profiles/meta/graphical/login/pam.nix +++ b/modules/profiles/meta/graphical/login/pam.nix @@ -1,19 +1,21 @@ { # unlock GPG keyring on login - security.pam.services = let - common = { - enableGnomeKeyring = true; - gnupg = { - enable = true; - noAutostart = true; - storeOnly = true; + security.pam.services = + let + common = { + enableGnomeKeyring = true; + gnupg = { + enable = true; + noAutostart = true; + storeOnly = true; + }; }; - }; - in { - login = common; + in + { + login = common; - greetd = common; + greetd = common; - tuigreet = common; - }; + tuigreet = common; + }; } diff --git a/modules/profiles/meta/graphical/misc.nix b/modules/profiles/meta/graphical/misc.nix index c2821d371..d590062da 100644 --- a/modules/profiles/meta/graphical/misc.nix +++ b/modules/profiles/meta/graphical/misc.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ # enable the unified cgroup hierarchy (cgroupsv2) systemd.enableUnifiedCgroupHierarchy = lib.mkForce true; } diff --git a/modules/profiles/meta/graphical/programs/ccache.nix b/modules/profiles/meta/graphical/programs/ccache.nix index bfcebf4ee..397143f20 100644 --- a/modules/profiles/meta/graphical/programs/ccache.nix +++ b/modules/profiles/meta/graphical/programs/ccache.nix @@ -1,48 +1,43 @@ +{ lib, config, ... }: { - lib, - config, - ... -}: { programs.ccache = { enable = true; cacheDir = "/var/cache/sccache"; }; - systemd.tmpfiles.rules = [ - "z ${config.programs.ccache.cacheDir} 770 root nixbld - -" - ]; + systemd.tmpfiles.rules = [ "z ${config.programs.ccache.cacheDir} 770 root nixbld - -" ]; - nix.settings.extra-sandbox-paths = [ - config.programs.ccache.cacheDir - ]; + nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ]; - nixpkgs.overlays = lib.mkIf (config.programs.ccache.enable && config.programs.ccache.packageNames == []) [ - (_: super: { - ccacheWrapper = super.ccacheWrapper.override { - extraConfig = '' - export CCACHE_COMPRESS=1 - export CCACHE_DIR="${config.programs.ccache.cacheDir}" - export CCACHE_UMASK=007 - export CCACHE_SLOPPINESS=include_file_mtime,time_macros - export CCACHE_NODIRECT=1 - if [ ! -d "$CCACHE_DIR" ]; then - echo "=====" - echo "Directory '$CCACHE_DIR' does not exist" - echo "Please create it with:" - echo " sudo mkdir -m0770 '$CCACHE_DIR'" - echo " sudo chown root:nixbld '$CCACHE_DIR'" - echo "=====" - exit 1 - fi - if [ ! -w "$CCACHE_DIR" ]; then - echo "=====" - echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" - echo "Please verify its access permissions" - echo "=====" - exit 1 - fi - ''; - }; - }) - ]; + nixpkgs.overlays = + lib.mkIf (config.programs.ccache.enable && config.programs.ccache.packageNames == [ ]) + [ + (_: super: { + ccacheWrapper = super.ccacheWrapper.override { + extraConfig = '' + export CCACHE_COMPRESS=1 + export CCACHE_DIR="${config.programs.ccache.cacheDir}" + export CCACHE_UMASK=007 + export CCACHE_SLOPPINESS=include_file_mtime,time_macros + export CCACHE_NODIRECT=1 + if [ ! -d "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' does not exist" + echo "Please create it with:" + echo " sudo mkdir -m0770 '$CCACHE_DIR'" + echo " sudo chown root:nixbld '$CCACHE_DIR'" + echo "=====" + exit 1 + fi + if [ ! -w "$CCACHE_DIR" ]; then + echo "=====" + echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" + echo "Please verify its access permissions" + echo "=====" + exit 1 + fi + ''; + }; + }) + ]; } diff --git a/modules/profiles/meta/graphical/programs/cli.nix b/modules/profiles/meta/graphical/programs/cli.nix index 9705b2839..e1f483768 100644 --- a/modules/profiles/meta/graphical/programs/cli.nix +++ b/modules/profiles/meta/graphical/programs/cli.nix @@ -3,7 +3,8 @@ pkgs, config, ... -}: { +}: +{ programs = { # home-manager is so strange and needs these declared multiple times fish.enable = true; @@ -24,9 +25,7 @@ # faster, persistent implementation of use_nix and use_flake nix-direnv = { enable = true; - package = pkgs.nix-direnv.override { - nix = config.nix.package; - }; + package = pkgs.nix-direnv.override { nix = config.nix.package; }; }; # enable loading direnv in nix-shell nix shell or nix develop @@ -35,11 +34,11 @@ }; # determine which version of wine to use - environment.systemPackages = with pkgs; let - winePackage = - if (lib.isWayland config) - then wineWowPackages.waylandFull - else wineWowPackages.stableFull; - in - lib.mkIf config.modules.programs.agnostic.wine.enable [winePackage]; + environment.systemPackages = + with pkgs; + let + winePackage = + if (lib.isWayland config) then wineWowPackages.waylandFull else wineWowPackages.stableFull; + in + lib.mkIf config.modules.programs.agnostic.wine.enable [ winePackage ]; } diff --git a/modules/profiles/meta/graphical/programs/gui.nix b/modules/profiles/meta/graphical/programs/gui.nix index e84cf715a..148e72ec5 100644 --- a/modules/profiles/meta/graphical/programs/gui.nix +++ b/modules/profiles/meta/graphical/programs/gui.nix @@ -3,7 +3,8 @@ lib, config, ... -}: { +}: +{ environment.systemPackages = with pkgs; [ # packages necessary for thunar thumbnails xfce.tumbler diff --git a/modules/profiles/meta/graphical/programs/xdg.nix b/modules/profiles/meta/graphical/programs/xdg.nix index f53af9ae4..14c41f1cb 100644 --- a/modules/profiles/meta/graphical/programs/xdg.nix +++ b/modules/profiles/meta/graphical/programs/xdg.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let template = import lib.template.xdg "nixos"; -in { +in +{ environment = { variables = template.glEnv; sessionVariables = template.sysEnv; diff --git a/modules/profiles/meta/graphical/security/polkit.nix b/modules/profiles/meta/graphical/security/polkit.nix index 203c51141..caa09d017 100644 --- a/modules/profiles/meta/graphical/security/polkit.nix +++ b/modules/profiles/meta/graphical/security/polkit.nix @@ -3,9 +3,11 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; -in { +in +{ systemd = mkIf config.modules.system.video.enable { user.services.polkit-pantheon-authentication-agent-1 = { description = "Pantheon PolicyKit agent"; @@ -17,9 +19,9 @@ in { TimeoutStopSec = 10; }; - wantedBy = ["graphical-session.target"]; - wants = ["graphical-session.target"]; - after = ["graphical-session.target"]; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; }; }; } diff --git a/modules/profiles/meta/graphical/security/tor.nix b/modules/profiles/meta/graphical/security/tor.nix index 3489baf88..24a5903c7 100644 --- a/modules/profiles/meta/graphical/security/tor.nix +++ b/modules/profiles/meta/graphical/security/tor.nix @@ -1,8 +1,5 @@ +{ lib, config, ... }: { - lib, - config, - ... -}: { services.tor = lib.mkIf config.modules.system.security.tor.enable { enable = true; client.enable = true; diff --git a/modules/profiles/meta/graphical/services/earlyoom.nix b/modules/profiles/meta/graphical/services/earlyoom.nix index 4529bdcbc..e3dba338c 100644 --- a/modules/profiles/meta/graphical/services/earlyoom.nix +++ b/modules/profiles/meta/graphical/services/earlyoom.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ # https://dataswamp.org/~solene/2022-09-28-earlyoom.html # avoid the linux kernel from locking itself when we're putting too much strain on the memory # this helps avoid having to shut down forcefully when we OOM diff --git a/modules/profiles/meta/graphical/services/gnome.nix b/modules/profiles/meta/graphical/services/gnome.nix index 0e0ab2415..24624655d 100644 --- a/modules/profiles/meta/graphical/services/gnome.nix +++ b/modules/profiles/meta/graphical/services/gnome.nix @@ -1,12 +1,7 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { services = { - udev.packages = with pkgs; [ - gnome.gnome-settings-daemon - ]; + udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; gnome = { glib-networking.enable = true; diff --git a/modules/profiles/meta/graphical/services/location.nix b/modules/profiles/meta/graphical/services/location.nix index 259ad3ca5..4176e3522 100644 --- a/modules/profiles/meta/graphical/services/location.nix +++ b/modules/profiles/meta/graphical/services/location.nix @@ -1,11 +1,13 @@ -{ - lib, - config, - ... -}: let +{ lib, config, ... }: +let inherit (config.modules) device; - acceptedTypes = ["desktop" "laptop" "lite"]; -in { + acceptedTypes = [ + "desktop" + "laptop" + "lite" + ]; +in +{ config = lib.mkIf (builtins.elem device.type acceptedTypes) { location.provider = "geoclue2"; diff --git a/modules/profiles/meta/graphical/services/misc.nix b/modules/profiles/meta/graphical/services/misc.nix index 490b84d04..544505007 100644 --- a/modules/profiles/meta/graphical/services/misc.nix +++ b/modules/profiles/meta/graphical/services/misc.nix @@ -1,8 +1,5 @@ +{ lib, pkgs, ... }: { - lib, - pkgs, - ... -}: { services = { # enable GVfs, a userspace virtual filesystem. gvfs.enable = true; @@ -14,7 +11,11 @@ udisks2.enable = true; dbus = { - packages = with pkgs; [dconf gcr udisks2]; + packages = with pkgs; [ + dconf + gcr + udisks2 + ]; enable = true; # Use the faster dbus-broker instead of the classic dbus-daemon implementation = "broker"; diff --git a/modules/profiles/meta/graphical/services/printing.nix b/modules/profiles/meta/graphical/services/printing.nix index 4cf6008f2..2b5194d90 100644 --- a/modules/profiles/meta/graphical/services/printing.nix +++ b/modules/profiles/meta/graphical/services/printing.nix @@ -3,9 +3,11 @@ pkgs, config, ... -}: let +}: +let sys = config.modules.system; -in { +in +{ config = lib.mkIf sys.printing.enable { # enable cups and some drivers for common printers services = { diff --git a/modules/profiles/meta/graphical/services/runners.nix b/modules/profiles/meta/graphical/services/runners.nix index 0c8dc77cd..79e5eb1e6 100644 --- a/modules/profiles/meta/graphical/services/runners.nix +++ b/modules/profiles/meta/graphical/services/runners.nix @@ -3,19 +3,27 @@ pkgs, config, ... -}: let +}: +let inherit (lib) mkIf; inherit (config.modules) device; -in { +in +{ config = mkIf (device.type != "server") { - environment.systemPackages = [pkgs.appimage-run]; + environment.systemPackages = [ pkgs.appimage-run ]; # run appimages with appimage-run - boot.binfmt.registrations = lib.genAttrs ["appimage" "AppImage"] (ext: { - recognitionType = "extension"; - magicOrExtension = ext; - interpreter = "/run/current-system/sw/bin/appimage-run"; - }); + boot.binfmt.registrations = + lib.genAttrs + [ + "appimage" + "AppImage" + ] + (ext: { + recognitionType = "extension"; + magicOrExtension = ext; + interpreter = "/run/current-system/sw/bin/appimage-run"; + }); # run unpatched linux binaries with nix-ld programs.nix-ld = { diff --git a/modules/profiles/meta/graphical/services/systemd.nix b/modules/profiles/meta/graphical/services/systemd.nix index 8f713fbcf..e90efd2e0 100644 --- a/modules/profiles/meta/graphical/services/systemd.nix +++ b/modules/profiles/meta/graphical/services/systemd.nix @@ -1,22 +1,26 @@ { - systemd = let - extraConfig = '' - DefaultTimeoutStartSec=15s - DefaultTimeoutStopSec=15s - DefaultTimeoutAbortSec=15s - DefaultDeviceTimeoutSec=15s - ''; - in { - inherit extraConfig; - user = {inherit extraConfig;}; + systemd = + let + extraConfig = '' + DefaultTimeoutStartSec=15s + DefaultTimeoutStopSec=15s + DefaultTimeoutAbortSec=15s + DefaultDeviceTimeoutSec=15s + ''; + in + { + inherit extraConfig; + user = { + inherit extraConfig; + }; - services = { - "getty@tty1".enable = false; - "autovt@tty1".enable = false; - "getty@tty7".enable = false; - "autovt@tty7".enable = false; - "kmsconvt@tty1".enable = false; - "kmsconvt@tty7".enable = false; + services = { + "getty@tty1".enable = false; + "autovt@tty1".enable = false; + "getty@tty7".enable = false; + "autovt@tty7".enable = false; + "kmsconvt@tty1".enable = false; + "kmsconvt@tty7".enable = false; + }; }; - }; } diff --git a/modules/profiles/meta/graphical/xserver.nix b/modules/profiles/meta/graphical/xserver.nix index f2038e339..eaecd5bb1 100644 --- a/modules/profiles/meta/graphical/xserver.nix +++ b/modules/profiles/meta/graphical/xserver.nix @@ -1,11 +1,10 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ services.xserver = { enable = false; displayManager.gdm.enable = false; displayManager.lightdm.enable = false; - excludePackages = [ - pkgs.xterm - ]; + excludePackages = [ pkgs.xterm ]; }; } diff --git a/modules/profiles/meta/headless/documentation.nix b/modules/profiles/meta/headless/documentation.nix index d5068a159..8ce3ec790 100644 --- a/modules/profiles/meta/headless/documentation.nix +++ b/modules/profiles/meta/headless/documentation.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkForce mapAttrs; -in { +in +{ documentation = mapAttrs (_: mkForce) { enable = false; dev.enable = false; diff --git a/modules/profiles/meta/headless/fonts.nix b/modules/profiles/meta/headless/fonts.nix index ec6a165b2..05e31a986 100644 --- a/modules/profiles/meta/headless/fonts.nix +++ b/modules/profiles/meta/headless/fonts.nix @@ -1,11 +1,14 @@ -{lib, ...}: { +{ lib, ... }: +{ # we don't need fonts on a server # since there are no fonts to be configured outside the console - fonts = let - inherit (lib) mkForce; - in { - packages = mkForce []; - fontDir.enable = mkForce false; - fontconfig.enable = mkForce false; - }; + fonts = + let + inherit (lib) mkForce; + in + { + packages = mkForce [ ]; + fontDir.enable = mkForce false; + fontconfig.enable = mkForce false; + }; } diff --git a/modules/profiles/meta/headless/xdg.nix b/modules/profiles/meta/headless/xdg.nix index 490309c96..d3fbb1874 100644 --- a/modules/profiles/meta/headless/xdg.nix +++ b/modules/profiles/meta/headless/xdg.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let inherit (lib) mkForce mapAttrs; -in { +in +{ xdg = mapAttrs (_: mkForce) { sounds.enable = false; mime.enable = false; diff --git a/parts/args.nix b/parts/args.nix index e945de573..423163cb5 100644 --- a/parts/args.nix +++ b/parts/args.nix @@ -1,18 +1,17 @@ -{inputs, ...}: { - perSystem = { - config, - system, - ... - }: { - imports = [{_module.args.pkgs = config.legacyPackages;}]; +{ inputs, ... }: +{ + perSystem = + { config, system, ... }: + { + imports = [ { _module.args.pkgs = config.legacyPackages; } ]; - legacyPackages = import inputs.nixpkgs { - inherit system; - config = { - allowUnfree = true; - allowUnsupportedSystem = true; + legacyPackages = import inputs.nixpkgs { + inherit system; + config = { + allowUnfree = true; + allowUnsupportedSystem = true; + }; + overlays = [ ]; }; - overlays = []; }; - }; } diff --git a/parts/lib/builders.nix b/parts/lib/builders.nix index cf8ef5285..2467e2966 100644 --- a/parts/lib/builders.nix +++ b/parts/lib/builders.nix @@ -1,116 +1,122 @@ -{ - lib, - inputs, - ... -}: let +{ lib, inputs, ... }: +let inherit (inputs) self; - inherit (import ./hardware.nix {inherit lib;}) ldTernary; + inherit (import ./hardware.nix { inherit lib; }) ldTernary; # mkSystem is a helper function that wraps lib.nixosSystem mkSystem = lib.nixosSystem; # mkNixSystem is a function that uses withSystem to give us inputs' and self' # it also assumes the the system type either nixos or darwin and uses the appropriate - mkNixSystem = { - host, - deployable ? false, - modules, - system, - withSystem, - ... - } @ args: + mkNixSystem = + { + host, + deployable ? false, + modules, + system, + withSystem, + ... + }@args: withSystem system ( - { - inputs', - self', - ... - }: let + { inputs', self', ... }: + let pkgs = inputs.nixpkgs.legacyPackages.${system}; # yet another helper function that wraps lib.nixosSystem # or lib.darwinSystem based on the system type mkSystem' = ldTernary pkgs mkSystem inputs.darwin.lib.darwinSystem; - # this is used to determin the target system and modules that are going to be needed + # this is used to determine the target system and modules that are going to be needed # for this specific system target = ldTernary pkgs "nixos" "darwin"; in - lib.mkMerge [ - { - "${target}Configurations".${args.host} = mkSystem' { - inherit (args) system; - modules = - [ - # depending on the base operating system we can only use some options therfore these - # options means that we can limit these options to only those given operating systems - "${self}/modules/${target}" - inputs.home-manager."${target}Modules".home-manager + lib.mkMerge [ + { + "${target}Configurations".${args.host} = mkSystem' { + inherit (args) system; + modules = [ + # depending on the base operating system we can only use some options therefore these + # options means that we can limit these options to only those given operating systems + "${self}/modules/${target}" + inputs.home-manager."${target}Modules".home-manager - # configrations based on that are imported based hostname - "${self}/hosts/${args.host}" - { - config = { - modules.system.hostname = args.host; - nixpkgs.hostPlatform = lib.mkDefault args.system; - }; - } - ] - ++ args.modules or []; - specialArgs = {inherit lib inputs self inputs' self';} // args.specialArgs or {}; - }; - } + # configurations based on that are imported based hostname + "${self}/hosts/${args.host}" + { + config = { + modules.system.hostname = args.host; + nixpkgs.hostPlatform = lib.mkDefault args.system; + }; + } + ] ++ args.modules or [ ]; + specialArgs = { + inherit + lib + inputs + self + inputs' + self' + ; + } // args.specialArgs or { }; + }; + } - # deploy-rs allows us to deploy to a remote system - # this is will enabled hosts if they are deployable - (lib.mkIf deployable { - deploy = { - autoRollback = true; - magicRollback = true; + # deploy-rs allows us to deploy to a remote system + # this is will enabled hosts if they are deployable + (lib.mkIf deployable { + deploy = { + autoRollback = true; + magicRollback = true; - nodes.${args.host} = { - hostname = args.host; - skipChecks = true; - sshUser = "root"; - user = "root"; - profiles.system.path = inputs.deploy-rs.lib.${system}.activate.nixos inputs.self.nixosConfigurations.${args.host}; - }; + nodes.${args.host} = { + hostname = args.host; + skipChecks = true; + sshUser = "root"; + user = "root"; + profiles.system.path = + inputs.deploy-rs.lib.${system}.activate.nixos + inputs.self.nixosConfigurations.${args.host}; }; - }) - ] + }; + }) + ] ); # mkNixosIso is a helper function that wraps mkSystem to create an iso - # DO NOT use mkNixSystem here as it is overkill for isos, futhermore we cannot use darwinSystem here - mkNixosIso = { - host, - system, - modules, - ... - } @ args: { - nixosConfigurations.${args.host} = mkSystem { - inherit (args) system; - specialArgs = {inherit inputs lib self;} // args.specialArgs or {}; - modules = - [ + # DO NOT use mkNixSystem here as it is overkill for isos, furthermore we cannot use darwinSystem here + mkNixosIso = + { + host, + system, + modules, + ... + }@args: + { + nixosConfigurations.${args.host} = mkSystem { + inherit (args) system; + specialArgs = { + inherit inputs lib self; + } // args.specialArgs or { }; + modules = [ # get an installer profile from nixpkgs to base the Isos off of "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix" "${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" "${self}/modules/iso" - {config.networking.hostName = args.host;} - ] - ++ args.modules or []; - }; + { config.networking.hostName = args.host; } + ] ++ args.modules or [ ]; + }; - images.${args.host} = self.nixosConfigurations.${args.host}.config.system.build.isoImage; - }; + images.${args.host} = self.nixosConfigurations.${args.host}.config.system.build.isoImage; + }; # mkSystems is a wrapper for mkNixSystem to create a list of systems mkSystems = systems: lib.mkMerge (map mkNixSystem systems); # mkNixosIsos likewise to mkSystems is a wrapper for mkNixosIso to create a list of isos mkNixosIsos = isos: lib.mkMerge (map mkNixosIso isos); -in { +in +{ inherit mkSystems mkNixosIsos; } diff --git a/parts/lib/default.nix b/parts/lib/default.nix index 9063db040..9cb38bd59 100644 --- a/parts/lib/default.nix +++ b/parts/lib/default.nix @@ -1,3 +1,4 @@ -{inputs, ...}: { - flake.lib = import ./import.nix {inherit inputs;}; +{ inputs, ... }: +{ + flake.lib = import ./import.nix { inherit inputs; }; } diff --git a/parts/lib/hardware.nix b/parts/lib/hardware.nix index 1536cb172..52258baeb 100644 --- a/parts/lib/hardware.nix +++ b/parts/lib/hardware.nix @@ -1,4 +1,5 @@ -_: let +_: +let # check if the host platform is linux and x86 # (isx86Linux pkgs) -> true isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86; @@ -6,17 +7,20 @@ _: let # ldTernary, short for linux darwin ternary, is a ternary operator that takes 3 arguments # the pkgs used to determine the standard environment, l: the linux result, d: the darwin result # https://github.com/nekowinston/dotfiles/blob/36f7f4a86af4d1ecd3d2da483585e4d2503a978a/machines/lib.nix#L32 - ldTernary = pkgs: l: d: - if pkgs.stdenv.isLinux - then l - else if pkgs.stdenv.isDarwin - then d - else throw "Unsupported system: ${pkgs.stdenv.system}"; + ldTernary = + pkgs: l: d: + if pkgs.stdenv.isLinux then + l + else if pkgs.stdenv.isDarwin then + d + else + throw "Unsupported system: ${pkgs.stdenv.system}"; # assume the first monitor in the list of monitors is primary # get its name from the list of monitors # `primaryMonitor osConfig` -> "DP-1" primaryMonitor = config: builtins.elemAt config.modules.device.monitors 0; -in { +in +{ inherit isx86Linux primaryMonitor ldTernary; } diff --git a/parts/lib/helpers.nix b/parts/lib/helpers.nix index 83c5443ba..0284305f3 100644 --- a/parts/lib/helpers.nix +++ b/parts/lib/helpers.nix @@ -1,23 +1,30 @@ -{lib, ...}: let - inherit (lib) lists filesystem mapAttrsToList filterAttrs hasSuffix; +{ lib, ... }: +let + inherit (lib) + lists + filesystem + mapAttrsToList + filterAttrs + hasSuffix + ; # filter files for the .nix suffix filterNixFiles = k: v: v == "regular" && hasSuffix ".nix" k; # import files that are selected by filterNixFiles - importNixFiles = path: - (lists.forEach (mapAttrsToList (name: _: path + ("/" + name)) - (filterAttrs filterNixFiles (builtins.readDir path)))) - import; + importNixFiles = + path: + (lists.forEach ( + mapAttrsToList (name: _: path + ("/" + name)) (filterAttrs filterNixFiles (builtins.readDir path)) + )) + import; # import all nix files and directories - importNixFilesAndDirs = dir: lists.filter (f: f != "default.nix") (filesystem.listFilesRecursive dir); + importNixFilesAndDirs = + dir: lists.filter (f: f != "default.nix") (filesystem.listFilesRecursive dir); # return an int based on boolean value - boolToNum = bool: - if bool - then 1 - else 0; + boolToNum = bool: if bool then 1 else 0; # a basic function to fetch a specified user's public keys from github .keys url fetchKeys = username: (builtins.fetchurl "https://github.com/${username}.keys"); @@ -25,26 +32,39 @@ # convert a list of integers to a list of string # `intListToStringList [1 2 3]` -> ["1" "2" "3"] intListToStringList = list: map (toString list); - indexOf = list: elem: let - f = f: i: - if i == (builtins.length list) - then null - else if (builtins.elemAt list i) == elem - then i - else f f (i + 1); - in + indexOf = + list: elem: + let + f = + f: i: + if i == (builtins.length list) then + null + else if (builtins.elemAt list i) == elem then + i + else + f f (i + 1); + in f f 0; # a function to go from normal text to lower snake case # "A Normal String" -> "a-normal-string" - serializeTheme = inputString: lib.strings.toLower (builtins.replaceStrings [" "] ["-"] inputString); + serializeTheme = + inputString: lib.strings.toLower (builtins.replaceStrings [ " " ] [ "-" ] inputString); # a function that checks if a list contains a list of given strings - containsStrings = { - list, - targetStrings, - }: - builtins.all (s: builtins.any (x: x == s) list) targetStrings; -in { - inherit filterNixFiles importNixFiles importNixFilesAndDirs boolToNum fetchKeys containsStrings serializeTheme indexOf intListToStringList; + containsStrings = + { list, targetStrings }: builtins.all (s: builtins.any (x: x == s) list) targetStrings; +in +{ + inherit + filterNixFiles + importNixFiles + importNixFilesAndDirs + boolToNum + fetchKeys + containsStrings + serializeTheme + indexOf + intListToStringList + ; } diff --git a/parts/lib/import.nix b/parts/lib/import.nix index 124dc0b74..2729ac568 100644 --- a/parts/lib/import.nix +++ b/parts/lib/import.nix @@ -1,28 +1,42 @@ -{inputs}: let +{ inputs }: +let inherit (inputs.nixpkgs) lib; inherit (lib) foldl recursiveUpdate; # wrap the import with a pre-inherited lib to avoid typing it over and over again # credits to @nrabulinski - import' = path: let - func = import path; - args = lib.functionArgs func; - requiredArgs = lib.filterAttrs (_: val: !val) args; - defaultArgs = (lib.mapAttrs (_: _: null) requiredArgs) // {inherit lib;}; - functor = {__functor = _: attrs: func (defaultArgs // attrs);}; - in + import' = + path: + let + func = import path; + args = lib.functionArgs func; + requiredArgs = lib.filterAttrs (_: val: !val) args; + defaultArgs = (lib.mapAttrs (_: _: null) requiredArgs) // { + inherit lib; + }; + functor = { + __functor = _: attrs: func (defaultArgs // attrs); + }; + in (func defaultArgs) // functor; - builders = import' ./builders.nix {inherit inputs;}; + builders = import' ./builders.nix { inherit inputs; }; services = import' ./services.nix; validators = import' ./validators.nix; helpers = import' ./helpers.nix; hardware = import' ./hardware.nix; # templates, selections of code and etc that are repeated - template = import ./template {}; + template = import ./template { }; # recursively merges two attribute sets - importedLibs = [builders services validators helpers hardware template]; + importedLibs = [ + builders + services + validators + helpers + hardware + template + ]; in - lib.extend (_: _: foldl recursiveUpdate {} importedLibs) +lib.extend (_: _: foldl recursiveUpdate { } importedLibs) diff --git a/parts/lib/services.nix b/parts/lib/services.nix index b865e7248..794f17179 100644 --- a/parts/lib/services.nix +++ b/parts/lib/services.nix @@ -1,16 +1,18 @@ -{lib, ...}: let +{ lib, ... }: +let # make a service that is a part of the graphical session target mkGraphicalService = lib.recursiveUpdate { - Unit.PartOf = ["graphical-session.target"]; - Unit.After = ["graphical-session.target"]; - Install.WantedBy = ["graphical-session.target"]; + Unit.PartOf = [ "graphical-session.target" ]; + Unit.After = [ "graphical-session.target" ]; + Install.WantedBy = [ "graphical-session.target" ]; }; mkHyprlandService = lib.recursiveUpdate { - Unit.PartOf = ["graphical-session.target"]; - Unit.After = ["graphical-session.target"]; - Install.WantedBy = ["hyprland-session.target"]; + Unit.PartOf = [ "graphical-session.target" ]; + Unit.After = [ "graphical-session.target" ]; + Install.WantedBy = [ "hyprland-session.target" ]; }; -in { +in +{ inherit mkGraphicalService mkHyprlandService; } diff --git a/parts/lib/template/default.nix b/parts/lib/template/default.nix index 659ef3125..df8653cc9 100644 --- a/parts/lib/template/default.nix +++ b/parts/lib/template/default.nix @@ -1,4 +1,5 @@ -_: let +_: +let template = { # this is a forced SSL template for Nginx # returns the attribute set with our desired settings @@ -11,6 +12,7 @@ _: let xdg = ./. + /xdg.nix; }; -in { +in +{ inherit template; } diff --git a/parts/lib/template/xdg.nix b/parts/lib/template/xdg.nix index b39fb964b..8e4562ad7 100644 --- a/parts/lib/template/xdg.nix +++ b/parts/lib/template/xdg.nix @@ -1,4 +1,5 @@ -system: let +system: +let # copy paste done right XDG_CONFIG_HOME = "$HOME/.config"; XDG_CACHE_HOME = "$HOME/.cache"; @@ -6,11 +7,19 @@ system: let XDG_STATE_HOME = "$HOME/.local/state"; XDG_BIN_HOME = "$HOME/.local/bin"; XDG_RUNTIME_DIR = "/run/user/$UID"; -in { +in +{ # global env glEnv = { - inherit XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME XDG_BIN_HOME XDG_RUNTIME_DIR; - PATH = ["$XDG_BIN_HOME"]; + inherit + XDG_CONFIG_HOME + XDG_CACHE_HOME + XDG_DATA_HOME + XDG_STATE_HOME + XDG_BIN_HOME + XDG_RUNTIME_DIR + ; + PATH = [ "$XDG_BIN_HOME" ]; }; sysEnv = { @@ -41,13 +50,10 @@ in { M2_HOME = "${XDG_DATA_HOME}/m2"; CARGO_HOME = "${XDG_DATA_HOME}/cargo"; NODE_REPL_HISTORY = "${XDG_DATA_HOME}/node_repl_history"; - NPM_CONFIG_CACE = "${XDG_CACHE_HOME}/npm"; + NPM_CONFIG_CACHE = "${XDG_CACHE_HOME}/npm"; NPM_CONFIG_TMP = "${XDG_RUNTIME_DIR}/npm"; NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/config"; - PYTHONSTARTUP = - if system == "nixos" - then "/etc/pythonrc" - else "${XDG_CONFIG_HOME}/python/pythonrc"; + PYTHONSTARTUP = if system == "nixos" then "/etc/pythonrc" else "${XDG_CONFIG_HOME}/python/pythonrc"; }; npmrc.text = '' diff --git a/parts/lib/validators.nix b/parts/lib/validators.nix index c2676f50e..0d00c8aeb 100644 --- a/parts/lib/validators.nix +++ b/parts/lib/validators.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{ lib, ... }: +let # a function that will append a list of groups if they exist in config.users.groups - ifTheyExist = config: groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; + ifTheyExist = + config: groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; # a function that returns a boolean based on whether or not the groups exist ifGroupsExist = config: groups: lib.any (group: builtins.hasAttr group config.users.groups) groups; @@ -17,10 +19,21 @@ # ifOneEnabled takes a parent option and 3 child options and checks if at least one of them is enabled # `ifOneEnabled config.modules.services "service1" "service2" "service3"` - ifOneEnabled = cfg: a: b: c: (cfg.a || cfg.b || cfg.c); + ifOneEnabled = + cfg: a: b: c: + (cfg.a || cfg.b || cfg.c); # check if modernshell and cli are both enabled - isModernShell = conf: conf.modules.programs.cli.enable && conf.modules.programs.cli.modernShell.enable; -in { - inherit ifTheyExist ifGroupsExist isAcceptedDevice isWayland ifOneEnabled isModernShell; + isModernShell = + conf: conf.modules.programs.cli.enable && conf.modules.programs.cli.modernShell.enable; +in +{ + inherit + ifTheyExist + ifGroupsExist + isAcceptedDevice + isWayland + ifOneEnabled + isModernShell + ; } diff --git a/parts/modules/default.nix b/parts/modules/default.nix index e069d829b..02e30e1bb 100644 --- a/parts/modules/default.nix +++ b/parts/modules/default.nix @@ -1,9 +1,9 @@ -{self, ...}: let - mkModule = path: - if builtins.isPath path - then self + path - else builtins.throw "${path} does not exist"; -in { +{ self, ... }: +let + mkModule = + path: if builtins.isPath path then self + path else builtins.throw "${path} does not exist"; +in +{ flake = { nixosModules = { wakapi = mkModule /modules/extra/nixos/wakapi.nix; diff --git a/parts/overlays/btop.nix b/parts/overlays/btop.nix index b2a5b244b..7a7ebe7ba 100644 --- a/parts/overlays/btop.nix +++ b/parts/overlays/btop.nix @@ -1,14 +1,14 @@ _: prev: { btop = - if prev.stdenv.isLinux - then + if prev.stdenv.isLinux then prev.symlinkJoin { inherit (prev.btop) passthru; name = "btop-nodesktop"; - paths = [prev.btop]; + paths = [ prev.btop ]; postBuild = '' rm $out/share/applications/btop.desktop ''; } - else prev.btop; + else + prev.btop; } diff --git a/parts/overlays/default.nix b/parts/overlays/default.nix index f423d88e0..53344db9c 100644 --- a/parts/overlays/default.nix +++ b/parts/overlays/default.nix @@ -1,14 +1,10 @@ { - flake.overlays.default = final: prev: - prev.lib.composeManyExtensions - ( - prev.lib.pipe ./. [ - builtins.readDir - builtins.attrNames - (builtins.filter (name: name != "default.nix")) - (map (file: import ./${file})) - ] - ) - final - prev; + flake.overlays.default = + final: prev: + prev.lib.composeManyExtensions (prev.lib.pipe ./. [ + builtins.readDir + builtins.attrNames + (builtins.filter (name: name != "default.nix")) + (map (file: import ./${file})) + ]) final prev; } diff --git a/parts/overlays/fish.nix b/parts/overlays/fish.nix index 351766acd..8af29b444 100644 --- a/parts/overlays/fish.nix +++ b/parts/overlays/fish.nix @@ -1,14 +1,14 @@ _: prev: { fish = - if prev.stdenv.isLinux - then + if prev.stdenv.isLinux then prev.symlinkJoin { inherit (prev.fish) passthru meta; name = "fish-nodesktop"; - paths = [prev.fish]; + paths = [ prev.fish ]; postBuild = '' rm $out/share/applications/fish.desktop ''; } - else prev.fish; + else + prev.fish; } diff --git a/parts/overlays/ranger.nix b/parts/overlays/ranger.nix index 00c3e8228..552aa7dd4 100644 --- a/parts/overlays/ranger.nix +++ b/parts/overlays/ranger.nix @@ -1,14 +1,14 @@ _: prev: { ranger = - if prev.stdenv.isLinux - then + if prev.stdenv.isLinux then prev.symlinkJoin { inherit (prev.ranger) passthru; name = "ranger-nodesktop"; - paths = [prev.ranger]; + paths = [ prev.ranger ]; postBuild = '' rm $out/share/applications/ranger.desktop ''; } - else prev.ranger; + else + prev.ranger; } diff --git a/parts/pkgs/default.nix b/parts/pkgs/default.nix index 1f6b012b2..a46a4089e 100644 --- a/parts/pkgs/default.nix +++ b/parts/pkgs/default.nix @@ -1,29 +1,30 @@ -{self, ...}: { - perSystem = { - pkgs, - inputs', - ... - }: { - packages = let - docs = pkgs.callPackage (self + /docs) {inherit self;}; - in { - docs-md = docs.md; - docs-html = docs.html; +{ self, ... }: +{ + perSystem = + { pkgs, inputs', ... }: + { + packages = + let + docs = pkgs.callPackage (self + /docs) { inherit self; }; + in + { + docs-md = docs.md; + docs-html = docs.html; - patched-gjs = pkgs.callPackage ./patched-gjs.nix {}; - plymouth-theme-catppuccin = pkgs.callPackage ./plymouth-theme-catppuccin.nix {}; - headscale-ui = pkgs.callPackage ./headscale-ui.nix {}; - gh-eco = pkgs.callPackage ./gh-eco.nix {}; - fork-cleaner = pkgs.callPackage ./fork-cleaner.nix {}; - pace = pkgs.callPackage ./pace.nix {}; - emojis = pkgs.callPackage ./emojis.nix {}; + patched-gjs = pkgs.callPackage ./patched-gjs.nix { }; + plymouth-theme-catppuccin = pkgs.callPackage ./plymouth-theme-catppuccin.nix { }; + headscale-ui = pkgs.callPackage ./headscale-ui.nix { }; + gh-eco = pkgs.callPackage ./gh-eco.nix { }; + fork-cleaner = pkgs.callPackage ./fork-cleaner.nix { }; + pace = pkgs.callPackage ./pace.nix { }; + emojis = pkgs.callPackage ./emojis.nix { }; - bellado = inputs'.bellado.packages.default; - izrss = inputs'.izrss.packages.default; - zzz = inputs'.zzz.packages.default; - isabelroses-website = inputs'.isabelroses-website.packages.default; - catppuccinifier-cli = inputs'.catppuccinifier.packages.cli; - ringfairy = inputs'.ringfairy.packages.default; + bellado = inputs'.bellado.packages.default; + izrss = inputs'.izrss.packages.default; + zzz = inputs'.zzz.packages.default; + isabelroses-website = inputs'.isabelroses-website.packages.default; + catppuccinifier-cli = inputs'.catppuccinifier.packages.cli; + ringfairy = inputs'.ringfairy.packages.default; + }; }; - }; } diff --git a/parts/pkgs/emojis.nix b/parts/pkgs/emojis.nix index c4a52801e..52a2dd5e5 100644 --- a/parts/pkgs/emojis.nix +++ b/parts/pkgs/emojis.nix @@ -9,7 +9,7 @@ stdenvNoCC.mkDerivation { src = ./emojis; - nativeBuildInputs = [unzip]; + nativeBuildInputs = [ unzip ]; installPhase = '' runHook preInstall @@ -22,6 +22,6 @@ stdenvNoCC.mkDerivation { meta = with lib; { description = "emojis repacked as APNG"; license = licenses.unfree; - maintainers = with maintainers; [isabelroses]; + maintainers = with maintainers; [ isabelroses ]; }; } diff --git a/parts/pkgs/fork-cleaner.nix b/parts/pkgs/fork-cleaner.nix index 6f831bdc6..c1081849b 100644 --- a/parts/pkgs/fork-cleaner.nix +++ b/parts/pkgs/fork-cleaner.nix @@ -2,39 +2,40 @@ lib, buildGoModule, fetchFromGitHub, -}: let +}: +let version = "2.3.1"; in - buildGoModule { - name = "fork-cleaner"; - inherit version; +buildGoModule { + name = "fork-cleaner"; + inherit version; - src = fetchFromGitHub { - owner = "caarlos0"; - repo = "fork-cleaner"; - rev = "v${version}"; - sha256 = "sha256-JNmpcDwmxR+s4regOWz8FAJllBNRfOCmVwkDs7tlChA="; - }; + src = fetchFromGitHub { + owner = "caarlos0"; + repo = "fork-cleaner"; + rev = "v${version}"; + sha256 = "sha256-JNmpcDwmxR+s4regOWz8FAJllBNRfOCmVwkDs7tlChA="; + }; - vendorHash = "sha256-QuIaXXkch5PCpX8P755X8j7MeNnbewWo7NB+Vue1/Pk="; + vendorHash = "sha256-QuIaXXkch5PCpX8P755X8j7MeNnbewWo7NB+Vue1/Pk="; - # allowGoReference adds the flag `-trimpath` which is also denoted by, fork-cleaner goreleaser config - # - allowGoReference = true; + # allowGoReference adds the flag `-trimpath` which is also denoted by, fork-cleaner goreleaser config + # + allowGoReference = true; - ldflags = [ - "-s" - "-w" - "-X main.version=${version}" - "-X main.builtBy=nixpkgs" - ]; + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + "-X main.builtBy=nixpkgs" + ]; - meta = { - description = "Quickly clean up unused forks on your GitHub account"; - homepage = "https://github.com/caarlos0/fork-cleaner"; - changelog = "https://github.com/caarlos0/fork-cleaner/releases/tag/${version}"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [isabelroses]; - mainProgram = "fork-cleaner"; - }; - } + meta = { + description = "Quickly clean up unused forks on your GitHub account"; + homepage = "https://github.com/caarlos0/fork-cleaner"; + changelog = "https://github.com/caarlos0/fork-cleaner/releases/tag/${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ isabelroses ]; + mainProgram = "fork-cleaner"; + }; +} diff --git a/parts/pkgs/gh-eco.nix b/parts/pkgs/gh-eco.nix index 0c5490aef..abf275d74 100644 --- a/parts/pkgs/gh-eco.nix +++ b/parts/pkgs/gh-eco.nix @@ -2,33 +2,34 @@ lib, buildGoModule, fetchFromGitHub, -}: let +}: +let version = "d45b1e7de8cbcb692def0e94111262cdeff2835d"; in - buildGoModule { - pname = "gh-eco"; - inherit version; +buildGoModule { + pname = "gh-eco"; + inherit version; - src = fetchFromGitHub { - owner = "isabelroses"; - repo = "gh-eco"; - rev = "${version}"; - sha256 = "sha256-zIA7zwzl+Kge9szGkR93QR+Z2V7BQRZq/ShEytNp7Bg="; - }; + src = fetchFromGitHub { + owner = "isabelroses"; + repo = "gh-eco"; + rev = "${version}"; + sha256 = "sha256-zIA7zwzl+Kge9szGkR93QR+Z2V7BQRZq/ShEytNp7Bg="; + }; - vendorHash = "sha256-O3FQ+Z3KVYgTafwVXUhrGRuOAWlWlOhtVegKVoZBnDE="; + vendorHash = "sha256-O3FQ+Z3KVYgTafwVXUhrGRuOAWlWlOhtVegKVoZBnDE="; - ldflags = [ - "-s" - "-w" - "-X main.Version=${version}" - ]; + ldflags = [ + "-s" + "-w" + "-X main.Version=${version}" + ]; - meta = { - description = "a working fork of gh-eco"; - homepage = "https://github.com/isabelroses/gh-eco"; - license = lib.licenses.gpl3; - maintainers = with lib.maintainers; [isabelroses]; - platforms = lib.platforms.all; - }; - } + meta = { + description = "a working fork of gh-eco"; + homepage = "https://github.com/isabelroses/gh-eco"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ isabelroses ]; + platforms = lib.platforms.all; + }; +} diff --git a/parts/pkgs/headscale-ui.nix b/parts/pkgs/headscale-ui.nix index 9c130b570..3cade39b4 100644 --- a/parts/pkgs/headscale-ui.nix +++ b/parts/pkgs/headscale-ui.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-6SUgtSTFvJWNdsWz6AiOfUM9p33+8EhDwyqHX7O2+NQ="; }; - buildInputs = [unzip]; + buildInputs = [ unzip ]; dontStrip = true; @@ -31,6 +31,6 @@ stdenv.mkDerivation rec { meta = { description = "A web frontend for the headscale Tailscale-compatible coordination server"; homepage = "https://github.com/gurucomputing/headscale-ui"; - license = [lib.licenses.bsd3]; + license = [ lib.licenses.bsd3 ]; }; } diff --git a/parts/pkgs/pace.nix b/parts/pkgs/pace.nix index 738077648..35c0fb9aa 100644 --- a/parts/pkgs/pace.nix +++ b/parts/pkgs/pace.nix @@ -3,36 +3,37 @@ rustPlatform, fetchFromGitHub, installShellFiles, -}: let +}: +let version = "0.15.2"; in - rustPlatform.buildRustPackage { - pname = "pace"; - inherit version; +rustPlatform.buildRustPackage { + pname = "pace"; + inherit version; - src = fetchFromGitHub { - owner = "pace-rs"; - repo = "pace"; - rev = "refs/tags/pace-rs-v${version}"; - hash = "sha256-gyyf4GGHIEdiAWvzKbaOApFikoh3RLWBCZUfJ0MjbIE="; - }; + src = fetchFromGitHub { + owner = "pace-rs"; + repo = "pace"; + rev = "refs/tags/pace-rs-v${version}"; + hash = "sha256-gyyf4GGHIEdiAWvzKbaOApFikoh3RLWBCZUfJ0MjbIE="; + }; - cargoHash = "sha256-D7jxju2R0S5wAsK7Gd8W32t/KKFaDjLHNZ2X/OEuPtk="; + cargoHash = "sha256-D7jxju2R0S5wAsK7Gd8W32t/KKFaDjLHNZ2X/OEuPtk="; - nativeBuildInputs = [installShellFiles]; + nativeBuildInputs = [ installShellFiles ]; - postInstall = '' - installShellCompletion --cmd pace \ - --bash <($out/bin/pace setup completions bash) \ - --fish <($out/bin/pace setup completions fish) \ - --zsh <($out/bin/pace setup completions zsh) - ''; + postInstall = '' + installShellCompletion --cmd pace \ + --bash <($out/bin/pace setup completions bash) \ + --fish <($out/bin/pace setup completions fish) \ + --zsh <($out/bin/pace setup completions zsh) + ''; - meta = { - description = "Command-line program for mindful time tracking"; - homepage = "https://github.com/pace-rs/pace"; - license = lib.licenses.agpl3Only; - maintainers = with lib.maintainers; [isabelroses]; - mainProgram = "pace"; - }; - } + meta = { + description = "Command-line program for mindful time tracking"; + homepage = "https://github.com/pace-rs/pace"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ isabelroses ]; + mainProgram = "pace"; + }; +} diff --git a/parts/pkgs/patched-gjs.nix b/parts/pkgs/patched-gjs.nix index 90f1bba79..bfd6b821b 100644 --- a/parts/pkgs/patched-gjs.nix +++ b/parts/pkgs/patched-gjs.nix @@ -30,7 +30,8 @@ upower, glib-networking, gtk-layer-shell, -}: let +}: +let testDeps = [ gtk3 atk @@ -39,133 +40,123 @@ harfbuzz ]; in - stdenv.mkDerivation rec { - pname = "gjs"; - version = "1.76.2"; +stdenv.mkDerivation rec { + pname = "gjs"; + version = "1.76.2"; + + outputs = [ + "out" + "dev" + "installedTests" + ]; - outputs = ["out" "dev" "installedTests"]; + src = fetchurl { + url = "mirror://gnome/sources/gjs/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; + sha256 = "sha256-99jJ1lPqb9eK/kpQcg4EaqK/wHj9pjXdEwZ90ZnGJdQ="; + }; - src = fetchurl { - url = "mirror://gnome/sources/gjs/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; - sha256 = "sha256-99jJ1lPqb9eK/kpQcg4EaqK/wHj9pjXdEwZ90ZnGJdQ="; - }; + patches = [ + # Hard-code various paths + ./patches/gjs-fix-paths.patch - patches = [ - # Hard-code various paths - ./patches/gjs-fix-paths.patch - - # Allow installing installed tests to a separate output. - ./patches/gjs-installed-tests-path.patch - ]; - - nativeBuildInputs = - [ - meson - ninja - pkg-config - makeWrapper - wrapGAppsHook - which # for locale detection - libxml2 # for xml-stripblanks - dbus # for dbus-run-session - gobject-introspection - ] - ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ - mesonEmulatorHook - ]; - - buildInputs = [ - cairo - upower - gnome.gnome-bluetooth - glib-networking - gtk-layer-shell - networkmanager - readline - libsysprof-capture - spidermonkey_102 - ]; - - nativeCheckInputs = - [ - xvfb-run - ] - ++ testDeps; - - propagatedBuildInputs = [ - glib - ]; - - mesonFlags = - [ - "-Dinstalled_test_prefix=${placeholder "installedTests"}" - ] - ++ lib.optionals (!stdenv.isLinux || stdenv.hostPlatform.isMusl) [ - "-Dprofiler=disabled" - ]; - - doCheck = !stdenv.isDarwin; - - postPatch = - '' - patchShebangs build/choose-tests-locale.sh - substituteInPlace installed-tests/debugger-test.sh --subst-var-by gjsConsole $out/bin/gjs-console - '' - + lib.optionalString stdenv.hostPlatform.isMusl '' - substituteInPlace installed-tests/js/meson.build \ - --replace "'Encoding'," "#'Encoding'," - ''; - - preCheck = '' - # Our gobject-introspection patches make the shared library paths absolute - # in the GIR files. When running tests, the library is not yet installed, - # though, so we need to replace the absolute path with a local one during build. - # We are using a symlink that will be overridden during installation. - mkdir -p $out/lib $installedTests/libexec/installed-tests/gjs - ln -s $PWD/libgjs.so.0 $out/lib/libgjs.so.0 - ln -s $PWD/installed-tests/js/libgimarshallingtests.so $installedTests/libexec/installed-tests/gjs/libgimarshallingtests.so - ln -s $PWD/installed-tests/js/libgjstesttools/libgjstesttools.so $installedTests/libexec/installed-tests/gjs/libgjstesttools.so - ln -s $PWD/installed-tests/js/libregress.so $installedTests/libexec/installed-tests/gjs/libregress.so - ln -s $PWD/installed-tests/js/libwarnlib.so $installedTests/libexec/installed-tests/gjs/libwarnlib.so - ''; + # Allow installing installed tests to a separate output. + ./patches/gjs-installed-tests-path.patch + ]; - postInstall = '' - installedTestsSchemaDatadir="$installedTests/share/gsettings-schemas/${pname}-${version}" - mkdir -p "$installedTestsSchemaDatadir" - mv "$installedTests/share/glib-2.0" "$installedTestsSchemaDatadir" - ''; + nativeBuildInputs = [ + meson + ninja + pkg-config + makeWrapper + wrapGAppsHook + which # for locale detection + libxml2 # for xml-stripblanks + dbus # for dbus-run-session + gobject-introspection + ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ mesonEmulatorHook ]; + + buildInputs = [ + cairo + upower + gnome.gnome-bluetooth + glib-networking + gtk-layer-shell + networkmanager + readline + libsysprof-capture + spidermonkey_102 + ]; - postFixup = '' - wrapProgram "$installedTests/libexec/installed-tests/gjs/minijasmine" \ - --prefix XDG_DATA_DIRS : "$installedTestsSchemaDatadir" \ - --prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" testDeps}" - ''; + nativeCheckInputs = [ xvfb-run ] ++ testDeps; - checkPhase = '' - runHook preCheck - xvfb-run -s '-screen 0 800x600x24' \ - meson test --print-errorlogs - runHook postCheck - ''; + propagatedBuildInputs = [ glib ]; - separateDebugInfo = stdenv.isLinux; + mesonFlags = [ + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + ] ++ lib.optionals (!stdenv.isLinux || stdenv.hostPlatform.isMusl) [ "-Dprofiler=disabled" ]; - passthru = { - tests = { - installed-tests = nixosTests.installed-tests.gjs; - }; + doCheck = !stdenv.isDarwin; + + postPatch = + '' + patchShebangs build/choose-tests-locale.sh + substituteInPlace installed-tests/debugger-test.sh --subst-var-by gjsConsole $out/bin/gjs-console + '' + + lib.optionalString stdenv.hostPlatform.isMusl '' + substituteInPlace installed-tests/js/meson.build \ + --replace "'Encoding'," "#'Encoding'," + ''; - updateScript = gnome.updateScript { - packageName = "gjs"; - versionPolicy = "odd-unstable"; - }; + preCheck = '' + # Our gobject-introspection patches make the shared library paths absolute + # in the GIR files. When running tests, the library is not yet installed, + # though, so we need to replace the absolute path with a local one during build. + # We are using a symlink that will be overridden during installation. + mkdir -p $out/lib $installedTests/libexec/installed-tests/gjs + ln -s $PWD/libgjs.so.0 $out/lib/libgjs.so.0 + ln -s $PWD/installed-tests/js/libgimarshallingtests.so $installedTests/libexec/installed-tests/gjs/libgimarshallingtests.so + ln -s $PWD/installed-tests/js/libgjstesttools/libgjstesttools.so $installedTests/libexec/installed-tests/gjs/libgjstesttools.so + ln -s $PWD/installed-tests/js/libregress.so $installedTests/libexec/installed-tests/gjs/libregress.so + ln -s $PWD/installed-tests/js/libwarnlib.so $installedTests/libexec/installed-tests/gjs/libwarnlib.so + ''; + + postInstall = '' + installedTestsSchemaDatadir="$installedTests/share/gsettings-schemas/${pname}-${version}" + mkdir -p "$installedTestsSchemaDatadir" + mv "$installedTests/share/glib-2.0" "$installedTestsSchemaDatadir" + ''; + + postFixup = '' + wrapProgram "$installedTests/libexec/installed-tests/gjs/minijasmine" \ + --prefix XDG_DATA_DIRS : "$installedTestsSchemaDatadir" \ + --prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" testDeps}" + ''; + + checkPhase = '' + runHook preCheck + xvfb-run -s '-screen 0 800x600x24' \ + meson test --print-errorlogs + runHook postCheck + ''; + + separateDebugInfo = stdenv.isLinux; + + passthru = { + tests = { + installed-tests = nixosTests.installed-tests.gjs; }; - meta = { - description = "JavaScript bindings for GNOME"; - homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md"; - license = lib.licenses.lgpl2Plus; - maintainers = lib.teams.gnome.members; - platforms = lib.platforms.unix; + updateScript = gnome.updateScript { + packageName = "gjs"; + versionPolicy = "odd-unstable"; }; - } + }; + + meta = { + description = "JavaScript bindings for GNOME"; + homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md"; + license = lib.licenses.lgpl2Plus; + maintainers = lib.teams.gnome.members; + platforms = lib.platforms.unix; + }; +} diff --git a/parts/programs/formatter.nix b/parts/programs/formatter.nix index 7db6d078e..79b9c4fa3 100644 --- a/parts/programs/formatter.nix +++ b/parts/programs/formatter.nix @@ -1,36 +1,37 @@ -{inputs, ...}: { - imports = [inputs.treefmt-nix.flakeModule]; +{ inputs, ... }: +{ + imports = [ inputs.treefmt-nix.flakeModule ]; - perSystem = { - pkgs, - config, - ... - }: { - formatter = config.treefmt.build.wrapper; + perSystem = + { pkgs, config, ... }: + { + formatter = config.treefmt.build.wrapper; - treefmt = { - projectRootFile = "flake.nix"; + treefmt = { + projectRootFile = "flake.nix"; - programs = { - alejandra.enable = true; - deadnix.enable = false; + programs = { + shellcheck.enable = true; - shellcheck.enable = true; + nixfmt = { + enable = true; + package = pkgs.nixfmt-rfc-style; + }; - prettier = { - enable = true; - package = pkgs.prettierd; - excludes = ["*.age"]; - settings = { - editorconfig = true; + prettier = { + enable = true; + package = pkgs.prettierd; + excludes = [ "*.age" ]; + settings = { + editorconfig = true; + }; }; - }; - shfmt = { - enable = true; - indent_size = 2; + shfmt = { + enable = true; + indent_size = 2; + }; }; }; }; - }; } diff --git a/parts/programs/pre-commit.nix b/parts/programs/pre-commit.nix index 06a6b2014..214939169 100644 --- a/parts/programs/pre-commit.nix +++ b/parts/programs/pre-commit.nix @@ -1,63 +1,64 @@ +{ lib, inputs, ... }: { - lib, - inputs, - ... -}: { - imports = [inputs.pre-commit-hooks.flakeModule]; - - perSystem = {config, ...}: let - # don't format these - excludes = ["flake.lock" "r'.+\.age$'"]; - - mkHook = name: { - inherit excludes; - enable = true; - description = "pre commit hook for ${name}"; - fail_fast = true; - verbose = true; - }; + imports = [ inputs.pre-commit-hooks.flakeModule ]; - mkHook' = name: prev: (mkHook name) // prev; - in { - pre-commit = { - check.enable = true; + perSystem = + { pkgs, config, ... }: + let + # don't format these + excludes = [ + "flake.lock" + "r'.+\.age$'" + ]; - settings = { + mkHook = name: { inherit excludes; + enable = true; + description = "pre commit hook for ${name}"; + fail_fast = true; + verbose = true; + }; - hooks = { - alejandra = mkHook "Alejandra"; - actionlint = mkHook "actionlint"; - # commitizen = mkHook "commitizen"; - # nil = mkHook "nil"; + mkHook' = name: prev: (mkHook name) // prev; + in + { + pre-commit = { + check.enable = true; - prettier = mkHook' "prettier" { - settings.write = true; - }; + settings = { + inherit excludes; - typos = mkHook' "typos" { - settings = { - write = true; - configuration = '' - [default.extend-words] - "ags" = "ags" - "GIR" = "GIR" - "flate" = "flate" - "fo" = "fo" - ''; + hooks = { + nixfmt = mkHook "nixfmt" // { + package = pkgs.nixfmt-rfc-style; }; - }; + actionlint = mkHook "actionlint"; + # commitizen = mkHook "commitizen"; + # nil = mkHook "nil"; - editorconfig-checker = mkHook' "editorconfig" { - enable = lib.mkForce false; - always_run = true; - }; + prettier = mkHook' "prettier" { settings.write = true; }; + + typos = mkHook' "typos" { + settings = { + write = true; + configuration = '' + [default.extend-words] + "ags" = "ags" + "GIR" = "GIR" + "flate" = "flate" + "fo" = "fo" + ''; + }; + }; + + editorconfig-checker = mkHook' "editorconfig" { + enable = lib.mkForce false; + always_run = true; + }; - treefmt = mkHook' "treefmt" { - package = config.treefmt.build.wrapper; + treefmt = mkHook' "treefmt" { package = config.treefmt.build.wrapper; }; }; }; }; }; - }; } diff --git a/parts/programs/shell.nix b/parts/programs/shell.nix index e2761b2aa..69031eb32 100644 --- a/parts/programs/shell.nix +++ b/parts/programs/shell.nix @@ -1,35 +1,38 @@ { - perSystem = { - lib, - pkgs, - self', - config, - inputs', - ... - }: { - devShells.default = pkgs.mkShellNoCC { - name = "dotfiles"; - meta.description = "Development shell for this configuration"; + perSystem = + { + lib, + pkgs, + self', + config, + inputs', + ... + }: + { + devShells.default = pkgs.mkShellNoCC { + name = "dotfiles"; + meta.description = "Development shell for this configuration"; - shellHook = config.pre-commit.installationScript; + shellHook = config.pre-commit.installationScript; - # tell direnv to shut up - DIRENV_LOG_FORMAT = ""; + # tell direnv to shut up + DIRENV_LOG_FORMAT = ""; - packages = with pkgs; - [ - git # flakes require git - nixd # nix language server - just # quick and easy task runner - nodejs-slim # needed ags - self'.formatter # nix formatter - nix-output-monitor # get clean diff between generations - inputs'.agenix.packages.agenix # secrets - inputs'.deploy-rs.packages.deploy-rs # remote deployment - ] - ++ lib.optionals stdenv.isDarwin [inputs'.darwin.packages.darwin-rebuild]; + packages = + with pkgs; + [ + git # flakes require git + nixd # nix language server + just # quick and easy task runner + nodejs-slim # needed ags + self'.formatter # nix formatter + nix-output-monitor # get clean diff between generations + inputs'.agenix.packages.agenix # secrets + inputs'.deploy-rs.packages.deploy-rs # remote deployment + ] + ++ lib.optionals stdenv.isDarwin [ inputs'.darwin.packages.darwin-rebuild ]; - inputsFrom = [config.treefmt.build.devShell]; + inputsFrom = [ config.treefmt.build.devShell ]; + }; }; - }; } diff --git a/parts/templates/c/default.nix b/parts/templates/c/default.nix index f0198681e..9dbbbc898 100644 --- a/parts/templates/c/default.nix +++ b/parts/templates/c/default.nix @@ -1,9 +1,9 @@ -{clangStdenv}: +{ clangStdenv }: clangStdenv.mkDerivation { pname = "sample-c-cpp"; version = "0.0.1"; src = ./.; - makeFlags = ["PREFIX=$(out)"]; + makeFlags = [ "PREFIX=$(out)" ]; } diff --git a/parts/templates/c/flake.nix b/parts/templates/c/flake.nix index efad41c88..44f8c5b5c 100644 --- a/parts/templates/c/flake.nix +++ b/parts/templates/c/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/c/shell.nix b/parts/templates/c/shell.nix index 4e2628958..e7f2c2642 100644 --- a/parts/templates/c/shell.nix +++ b/parts/templates/c/shell.nix @@ -4,16 +4,15 @@ cppcheck, clang-tools, callPackage, -}: let - mainPkg = callPackage ./default.nix {}; +}: +let + mainPkg = callPackage ./default.nix { }; in - mainPkg.overrideAttrs (oa: { - nativeBuildInputs = - [ - libcxx # stdlib for cpp - gnumake # builder - cppcheck # static analysis - clang-tools # fix headers not found - ] - ++ (oa.nativeBuildInputs or []); - }) +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + libcxx # stdlib for cpp + gnumake # builder + cppcheck # static analysis + clang-tools # fix headers not found + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/parts/templates/default.nix b/parts/templates/default.nix index 2217b66e4..fd5801623 100644 --- a/parts/templates/default.nix +++ b/parts/templates/default.nix @@ -1,10 +1,13 @@ -{lib, ...}: { +{ lib, ... }: +{ flake.templates = lib.pipe ./. [ builtins.readDir (lib.filterAttrs (_: type: type == "directory")) - (builtins.mapAttrs (name: _: { - description = name; - path = ./${name}; - })) + (builtins.mapAttrs ( + name: _: { + description = name; + path = ./${name}; + } + )) ]; } diff --git a/parts/templates/go/default.nix b/parts/templates/go/default.nix index 69843783c..cee8301a8 100644 --- a/parts/templates/go/default.nix +++ b/parts/templates/go/default.nix @@ -1,4 +1,4 @@ -{buildGoModule}: +{ buildGoModule }: buildGoModule { pname = "sample-go"; version = "0.0.1"; @@ -7,5 +7,8 @@ buildGoModule { vendorHash = null; - ldflags = ["-s" "-w"]; + ldflags = [ + "-s" + "-w" + ]; } diff --git a/parts/templates/go/flake.nix b/parts/templates/go/flake.nix index 5308d12e4..888f3db64 100644 --- a/parts/templates/go/flake.nix +++ b/parts/templates/go/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/go/shell.nix b/parts/templates/go/shell.nix index 85dc6059b..f0af32f48 100644 --- a/parts/templates/go/shell.nix +++ b/parts/templates/go/shell.nix @@ -3,15 +3,14 @@ gopls, goreleaser, callPackage, -}: let - mainPkg = callPackage ./default.nix {}; +}: +let + mainPkg = callPackage ./default.nix { }; in - mainPkg.overrideAttrs (oa: { - nativeBuildInputs = - [ - go - gopls - goreleaser - ] - ++ (oa.nativeBuildInputs or []); - }) +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + go + gopls + goreleaser + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/parts/templates/latex/default.nix b/parts/templates/latex/default.nix index 8445b4c99..b1ef14e91 100644 --- a/parts/templates/latex/default.nix +++ b/parts/templates/latex/default.nix @@ -10,8 +10,7 @@ stdenvNoCC.mkDerivation { just (texlive.combine { - inherit - (texlive) + inherit (texlive) scheme-medium biblatex biber diff --git a/parts/templates/latex/flake.nix b/parts/templates/latex/flake.nix index 7e30e9bd2..0a277d69f 100644 --- a/parts/templates/latex/flake.nix +++ b/parts/templates/latex/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/latex/shell.nix b/parts/templates/latex/shell.nix index 416c01ef0..9f71f25c9 100644 --- a/parts/templates/latex/shell.nix +++ b/parts/templates/latex/shell.nix @@ -3,26 +3,24 @@ texlive, callPackage, ... -}: let - mainPkg = callPackage ./default.nix {}; +}: +let + mainPkg = callPackage ./default.nix { }; in - mainPkg.overrideAttrs (oa: { - buildInputs = - [ - just +mainPkg.overrideAttrs (oa: { + buildInputs = [ + just - (texlive.combine { - inherit - (texlive) - schme-medium - biblatex - biber - pdfpages - ; - }) - ] - ++ (oa.nativeBuildInputs or []); + (texlive.combine { + inherit (texlive) + scheme-medium + biblatex + biber + pdfpages + ; + }) + ] ++ (oa.nativeBuildInputs or [ ]); - TEXMFHOME = "./cache"; - TEXMFVAR = "./cache/var"; - }) + TEXMFHOME = "./cache"; + TEXMFVAR = "./cache/var"; +}) diff --git a/parts/templates/node/default.nix b/parts/templates/node/default.nix index 5bb53bcb9..e5e30de93 100644 --- a/parts/templates/node/default.nix +++ b/parts/templates/node/default.nix @@ -1,7 +1,4 @@ -{ - lib, - buildNpmPackage, -}: +{ lib, buildNpmPackage }: buildNpmPackage { pname = "foo-bar"; version = "0.1.0"; diff --git a/parts/templates/node/flake.nix b/parts/templates/node/flake.nix index 6f720f317..60677266f 100644 --- a/parts/templates/node/flake.nix +++ b/parts/templates/node/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/node/shell.nix b/parts/templates/node/shell.nix index 82f638384..944e0dc8c 100644 --- a/parts/templates/node/shell.nix +++ b/parts/templates/node/shell.nix @@ -3,22 +3,21 @@ prettierd, callPackage, writeShellScriptBin, -}: let - mainPkg = callPackage ./default.nix {}; +}: +let + mainPkg = callPackage ./default.nix { }; mkNpxAlias = name: writeShellScriptBin name "npx ${name} \"$@\""; in - mainPkg.overrideAttrs (oa: { - nativeBuildInputs = - [ - eslint_d - prettierd - (mkNpxAlias "tsc") - (mkNpxAlias "tsserver") - ] - ++ (oa.nativeBuildInputs or []); +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + eslint_d + prettierd + (mkNpxAlias "tsc") + (mkNpxAlias "tsserver") + ] ++ (oa.nativeBuildInputs or [ ]); - shellHook = '' - eslint_d start # start eslint daemon - eslint_d status # inform user about eslint daemon status - ''; - }) + shellHook = '' + eslint_d start # start eslint daemon + eslint_d status # inform user about eslint daemon status + ''; +}) diff --git a/parts/templates/python/default.nix b/parts/templates/python/default.nix index b7c031325..aa26488a2 100644 --- a/parts/templates/python/default.nix +++ b/parts/templates/python/default.nix @@ -10,11 +10,9 @@ python3Packages.buildPythonApplication { src = ./.; - propagatedBuildInputs = with python3Packages; []; + propagatedBuildInputs = with python3Packages; [ ]; - nativeCheckInputs = [ - python3Packages.pytest - ]; + nativeCheckInputs = [ python3Packages.pytest ]; checkPhase = lib.optionals doCheck '' runHook preCheck diff --git a/parts/templates/python/flake.nix b/parts/templates/python/flake.nix index 7f28eb0cf..b7eddd453 100644 --- a/parts/templates/python/flake.nix +++ b/parts/templates/python/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in rec { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + rec { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/python/shell.nix b/parts/templates/python/shell.nix index a92a4a6ee..09dbf6672 100644 --- a/parts/templates/python/shell.nix +++ b/parts/templates/python/shell.nix @@ -3,11 +3,8 @@ callPackage, mkShellNoCC, ... -}: let +}: +let defaultPackage = callPackage ./default.nix; in - mkShellNoCC { - packages = [ - (python3.withPackages defaultPackage.propagatedBuildInputs) - ]; - } +mkShellNoCC { packages = [ (python3.withPackages defaultPackage.propagatedBuildInputs) ]; } diff --git a/parts/templates/rust/default.nix b/parts/templates/rust/default.nix index 58798a6cc..d95e7199d 100644 --- a/parts/templates/rust/default.nix +++ b/parts/templates/rust/default.nix @@ -1,4 +1,4 @@ -{rustPlatform}: +{ rustPlatform }: rustPlatform.buildRustPackage { pname = "sample-rust"; version = "0.0.1"; diff --git a/parts/templates/rust/flake.nix b/parts/templates/rust/flake.nix index 9486dbbd5..8426411e5 100644 --- a/parts/templates/rust/flake.nix +++ b/parts/templates/rust/flake.nix @@ -5,18 +5,26 @@ nixpkgs.url = "github:NixOS/nixpkgs"; }; - outputs = {nixpkgs, ...}: let - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forEachSystem = nixpkgs.lib.genAttrs systems; + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; - in { - packages = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./default.nix {}; - }); + pkgsForEach = nixpkgs.legacyPackages; + in + { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./default.nix { }; + }); - devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./shell.nix {}; - }); - }; + devShells = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./shell.nix { }; + }); + }; } diff --git a/parts/templates/rust/shell.nix b/parts/templates/rust/shell.nix index a20cff7f4..5f95e7110 100644 --- a/parts/templates/rust/shell.nix +++ b/parts/templates/rust/shell.nix @@ -3,16 +3,15 @@ rustfmt, callPackage, rust-analyzer, -}: let - mainPkg = callPackage ./default.nix {}; +}: +let + mainPkg = callPackage ./default.nix { }; in - mainPkg.overrideAttrs (oa: { - nativeBuildInputs = - [ - # Additional rust tooling - clippy - rustfmt - rust-analyzer - ] - ++ (oa.nativeBuildInputs or []); - }) +mainPkg.overrideAttrs (oa: { + nativeBuildInputs = [ + # Additional rust tooling + clippy + rustfmt + rust-analyzer + ] ++ (oa.nativeBuildInputs or [ ]); +}) diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 4fd02426e..fb6b52c23 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -9,13 +9,17 @@ let }; types = with hosts; { - servers = [luz]; - workstations = [tatsumaki valkyrie]; - hybrid = [hydra]; + servers = [ luz ]; + workstations = [ + tatsumaki + valkyrie + ]; + hybrid = [ hydra ]; }; - defAccess = list: list ++ [users.isabel] ++ types.hybrid; -in { + defAccess = list: list ++ [ users.isabel ] ++ types.hybrid; +in +{ "wakatime.age".publicKeys = defAccess (types.workstations ++ types.servers); # git ssh keys