diff --git a/flake.nix b/flake.nix index af521d2..95d6f6f 100644 --- a/flake.nix +++ b/flake.nix @@ -88,10 +88,9 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { inherit inputs outputs; - home-conf = "minimal"; }; modules = [ - ./users/phundrak/alys.nix + ./users/phundrak/host/alys.nix inputs.sops-nix.homeManagerModules.sops ]; }; @@ -99,10 +98,9 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { inherit inputs outputs; - home-conf = "fullHome"; }; modules = [ - ./users/phundrak/marpa.nix + ./users/phundrak/host/marpa.nix inputs.sops-nix.homeManagerModules.sops ]; }; @@ -110,10 +108,9 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { inherit inputs outputs; - home-conf = "fullHome"; }; modules = [ - ./users/phundrak/gampo.nix + ./users/phundrak/host/gampo.nix inputs.sops-nix.homeManagerModules.sops ]; }; @@ -121,10 +118,9 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { inherit inputs outputs; - home-conf = "minimal"; }; modules = [ - ./users/phundrak/tilo.nix + ./users/phundrak/host/tilo.nix inputs.sops-nix.homeManagerModules.sops ]; }; diff --git a/system/users/keys/id_alys.pub b/keys/id_alys.pub similarity index 100% rename from system/users/keys/id_alys.pub rename to keys/id_alys.pub diff --git a/system/users/keys/id_gampo.pub b/keys/id_gampo.pub similarity index 100% rename from system/users/keys/id_gampo.pub rename to keys/id_gampo.pub diff --git a/system/users/keys/id_marpa.pub b/keys/id_marpa.pub similarity index 100% rename from system/users/keys/id_marpa.pub rename to keys/id_marpa.pub diff --git a/system/users/keys/id_opn4.pub b/keys/id_opn4.pub similarity index 100% rename from system/users/keys/id_opn4.pub rename to keys/id_opn4.pub diff --git a/system/users/keys/id_tilo.pub b/keys/id_tilo.pub similarity index 100% rename from system/users/keys/id_tilo.pub rename to keys/id_tilo.pub diff --git a/system/users/phundrak.nix b/system/users/phundrak.nix index 8d33dca..aaa70a2 100644 --- a/system/users/phundrak.nix +++ b/system/users/phundrak.nix @@ -23,7 +23,7 @@ in { description = "Lucien Cartier-Tilet"; extraGroups = ["networkmanager" "wheel" "docker" "dialout" "podman"]; shell = pkgs.zsh; - openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ./keys; + openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../../keys; }; }; programs.zsh.enable = true; diff --git a/users/modules/bat.nix b/users/modules/cli/bat.nix similarity index 74% rename from users/modules/bat.nix rename to users/modules/cli/bat.nix index b51c0fb..2f074cf 100644 --- a/users/modules/bat.nix +++ b/users/modules/cli/bat.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.bat; + cfg = config.home.cli.bat; in { - options.modules.bat.extras = mkEnableOption "Enables extra packages for bat."; + options.home.cli.bat.extras = mkEnableOption "Enables extra packages for bat."; config.programs.bat = { enable = true; config = { diff --git a/users/modules/btop.nix b/users/modules/cli/btop.nix similarity index 100% rename from users/modules/btop.nix rename to users/modules/cli/btop.nix diff --git a/users/modules/cli/default.nix b/users/modules/cli/default.nix new file mode 100644 index 0000000..716ebac --- /dev/null +++ b/users/modules/cli/default.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.cli; +in { + imports = [ + ./bat.nix + ./btop.nix + ./direnv.nix + ./eza.nix + ./mu.nix + ./nh.nix + ./nix-index.nix + ./scripts + ./tealdeer.nix + ./yt-dlp.nix + ]; + + options.home.cli.fullDesktop = mkEnableOption "Enable all optional modules and options"; + config.home.cli = { + bat.extras = mkDefault cfg.fullDesktop; + mu.enable = mkDefault cfg.fullDesktop; + scripts.enable = mkDefault cfg.fullDesktop; + yt-dlp.enable = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/direnv.nix b/users/modules/cli/direnv.nix similarity index 100% rename from users/modules/direnv.nix rename to users/modules/cli/direnv.nix diff --git a/users/modules/eza.nix b/users/modules/cli/eza.nix similarity index 100% rename from users/modules/eza.nix rename to users/modules/cli/eza.nix diff --git a/users/modules/cli/mu.nix b/users/modules/cli/mu.nix new file mode 100644 index 0000000..bdfc11b --- /dev/null +++ b/users/modules/cli/mu.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.cli.mu; +in { + options.home.cli.mu.enable = mkEnableOption "Enable mu"; + config.programs.mu.enable = cfg.enable; +} diff --git a/users/modules/nh.nix b/users/modules/cli/nh.nix similarity index 81% rename from users/modules/nh.nix rename to users/modules/cli/nh.nix index e67d699..bd6e843 100644 --- a/users/modules/nh.nix +++ b/users/modules/cli/nh.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.nh; + cfg = config.home.cli.nh; in { - options.modules.nh.flake = mkOption { + options.home.cli.nh.flake = mkOption { type = types.path; default = "/home/phundrak/.dotfiles"; example = "/etc/nixos"; diff --git a/users/modules/cli/nix-index.nix b/users/modules/cli/nix-index.nix new file mode 100644 index 0000000..adff6a8 --- /dev/null +++ b/users/modules/cli/nix-index.nix @@ -0,0 +1,10 @@ +{inputs, ...}: { + imports = [ + inputs.nix-index-database.homeModules.nix-index + ]; + + programs = { + nix-index.enable = true; + nix-index-database.comma.enable = true; + }; +} diff --git a/users/scripts/askpass.nix b/users/modules/cli/scripts/askpass.nix similarity index 100% rename from users/scripts/askpass.nix rename to users/modules/cli/scripts/askpass.nix diff --git a/users/scripts/backup.nix b/users/modules/cli/scripts/backup.nix similarity index 100% rename from users/scripts/backup.nix rename to users/modules/cli/scripts/backup.nix diff --git a/users/modules/cli/scripts/default.nix b/users/modules/cli/scripts/default.nix new file mode 100644 index 0000000..11974b4 --- /dev/null +++ b/users/modules/cli/scripts/default.nix @@ -0,0 +1,15 @@ +{ + pkgs, + lib, + config, + ... +}: +with lib; let + cfg = config.home.cli.scripts; + files = filesystem.listFilesRecursive ./.; + scriptFiles = builtins.filter (path: baseNameOf path != "default.nix") files; + scripts = map (file: (import file {inherit pkgs config;})) scriptFiles; +in { + options.home.cli.scripts.enable = mkEnableOption "Add custom scripts to PATH"; + config.home.packages = mkIf cfg.enable scripts; +} diff --git a/users/scripts/keygen.nix b/users/modules/cli/scripts/keygen.nix similarity index 100% rename from users/scripts/keygen.nix rename to users/modules/cli/scripts/keygen.nix diff --git a/users/scripts/launch-with-emacsclient.nix b/users/modules/cli/scripts/launch-with-emacsclient.nix similarity index 53% rename from users/scripts/launch-with-emacsclient.nix rename to users/modules/cli/scripts/launch-with-emacsclient.nix index ed48acd..41a56df 100644 --- a/users/scripts/launch-with-emacsclient.nix +++ b/users/modules/cli/scripts/launch-with-emacsclient.nix @@ -1,10 +1,10 @@ { pkgs, - emacsPackage, + config, ... }: pkgs.writeShellScriptBin "launch-with-emacsclient" '' filename="$1" line="$2" column="$3" - ${emacsPackage}/bin/emacsclient +$line:$column "$filename"'' + ${config.home.dev.editors.emacs.package}/bin/emacsclient +$line:$column "$filename"'' diff --git a/users/scripts/mp42webm.nix b/users/modules/cli/scripts/mp42webm.nix similarity index 100% rename from users/scripts/mp42webm.nix rename to users/modules/cli/scripts/mp42webm.nix diff --git a/users/scripts/plock.nix b/users/modules/cli/scripts/plock.nix similarity index 100% rename from users/scripts/plock.nix rename to users/modules/cli/scripts/plock.nix diff --git a/users/scripts/rofi-emoji.nix b/users/modules/cli/scripts/rofi-emoji.nix similarity index 100% rename from users/scripts/rofi-emoji.nix rename to users/modules/cli/scripts/rofi-emoji.nix diff --git a/users/scripts/screenshot.nix b/users/modules/cli/scripts/screenshot.nix similarity index 100% rename from users/scripts/screenshot.nix rename to users/modules/cli/scripts/screenshot.nix diff --git a/users/scripts/sshbind.nix b/users/modules/cli/scripts/sshbind.nix similarity index 100% rename from users/scripts/sshbind.nix rename to users/modules/cli/scripts/sshbind.nix diff --git a/users/scripts/ytplay.nix b/users/modules/cli/scripts/ytplay.nix similarity index 100% rename from users/scripts/ytplay.nix rename to users/modules/cli/scripts/ytplay.nix diff --git a/users/modules/tealdeer.nix b/users/modules/cli/tealdeer.nix similarity index 100% rename from users/modules/tealdeer.nix rename to users/modules/cli/tealdeer.nix diff --git a/users/modules/cli/yt-dlp.nix b/users/modules/cli/yt-dlp.nix new file mode 100644 index 0000000..3185810 --- /dev/null +++ b/users/modules/cli/yt-dlp.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.cli.yt-dlp; +in { + options.home.cli.yt-dlp.enable = mkEnableOption "Enable yt-dlp"; + config.programs.yt-dlp = mkIf cfg.enable { + inherit (cfg) enable; + settings = { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + }; + }; +} diff --git a/users/modules/default.nix b/users/modules/default.nix index 985a5ed..69b7e78 100644 --- a/users/modules/default.nix +++ b/users/modules/default.nix @@ -1,17 +1,29 @@ { + config, + lib, + ... +}: +with lib; let + cfg = config.home; +in { imports = [ ./basics.nix - ./bat.nix - ./btop.nix - ./direnv.nix - ./eza.nix - ./gpg.nix - ./mopidy.nix - ./nh.nix - ./nix-index.nix + ./cli + ./desktop + ./dev + ./media + ./services + ./security ./shell - ./ssh.nix - ./tealdeer.nix - ./vcs ]; + + options.home.fullDesktop = mkEnableOption "Enable most modules"; + config.home = { + cli.fullDesktop = mkDefault cfg.fullDesktop; + desktop.fullDesktop = mkDefault cfg.fullDesktop; + dev.fullDesktop = mkDefault cfg.fullDesktop; + media.fullDesktop = mkDefault cfg.fullDesktop; + security.fullDesktop = mkDefault cfg.fullDesktop; + services.fullDesktop = mkDefault cfg.fullDesktop; + }; } diff --git a/users/modules/desktop/default.nix b/users/modules/desktop/default.nix new file mode 100644 index 0000000..74861cb --- /dev/null +++ b/users/modules/desktop/default.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.desktop; +in { + imports = [ + ./emoji.nix + ./eww.nix + ./hyprland.nix + ./kdeconnect.nix + ./kitty.nix + ./obs.nix + ./qt.nix + ./swaync.nix + ./waybar.nix + ./wlsunset.nix + ./wofi.nix + ]; + + options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments"; + config.home.desktop = { + eww.enable = mkDefault cfg.fullDesktop; + hyprland.enable = mkDefault cfg.fullDesktop; + kdeconnect.enable = mkDefault cfg.fullDesktop; + kitty.enable = mkDefault cfg.fullDesktop; + obs.enable = mkDefault cfg.fullDesktop; + qt.enable = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/emoji.nix b/users/modules/desktop/emoji.nix similarity index 100% rename from users/modules/emoji.nix rename to users/modules/desktop/emoji.nix diff --git a/users/modules/eww-config/eww.scss b/users/modules/desktop/eww-config/eww.scss similarity index 100% rename from users/modules/eww-config/eww.scss rename to users/modules/desktop/eww-config/eww.scss diff --git a/users/modules/eww-config/eww.yuck b/users/modules/desktop/eww-config/eww.yuck similarity index 100% rename from users/modules/eww-config/eww.yuck rename to users/modules/desktop/eww-config/eww.yuck diff --git a/users/modules/eww-config/test b/users/modules/desktop/eww-config/test similarity index 100% rename from users/modules/eww-config/test rename to users/modules/desktop/eww-config/test diff --git a/users/modules/desktop/eww.nix b/users/modules/desktop/eww.nix new file mode 100644 index 0000000..89c6471 --- /dev/null +++ b/users/modules/desktop/eww.nix @@ -0,0 +1,14 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.desktop.eww; +in { + options.home.desktop.eww.enable = mkEnableOption "Enable eww support"; + config.programs.eww = mkIf cfg.enable { + inherit (cfg) enable; + configDir = ./eww-config; + }; +} diff --git a/users/modules/hyprland.nix b/users/modules/desktop/hyprland.nix similarity index 92% rename from users/modules/hyprland.nix rename to users/modules/desktop/hyprland.nix index 38d225b..e12bc75 100644 --- a/users/modules/hyprland.nix +++ b/users/modules/desktop/hyprland.nix @@ -5,8 +5,9 @@ ... }: with lib; let - cfg = config.modules.hyprland; - rofi-emoji = import ../scripts/rofi-emoji.nix {inherit pkgs;}; + cfg = config.home.desktop.hyprland; + rofi-emoji = import ../cli/scripts/rofi-emoji.nix {inherit pkgs;}; + laptops = ["gampo"]; in { imports = [ ./swaync.nix @@ -14,33 +15,34 @@ in { ./wlsunset.nix ]; - options.modules.hyprland = { + options.home.desktop.hyprland = { enable = mkEnableOption "Enables Hyprland"; - swaync = mkEnableOption "Enables swaync"; emacsPkg = mkOption { type = types.package; - default = pkgs.emacs; + default = config.home.dev.editors.emacs.package or pkgs.emacs; + # default = pkgs.emacs; + example = pkgs.emacs; }; host = mkOption { - type = types.enum ["tilo" "gampo"]; - default = "tilo"; + type = types.enum ["gampo" "marpa"]; description = '' Which host is Hyprland running on. - This helps determine the monitors layout. + This helps determine the monitors layout and enable battery support in waybar. ''; }; - waybar = { - enable = mkEnableOption "Enables waybar."; - battery = mkEnableOption "Enables battery support."; - style = mkOption { - type = types.path; - example = ./style.css; - }; - }; }; config = mkIf cfg.enable { + home.desktop = { + swaync.enable = mkDefault true; + waybar = { + enable = mkDefault true; + battery = mkDefault (builtins.elem cfg.host laptops); + }; + wlsunset.enable = mkDefault true; + wofi.enable = mkDefault true; + }; wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; @@ -58,7 +60,7 @@ in { }; monitor = { - "tilo" = [ + "marpa" = [ "DP-1, 3440x1440@144, 1080x550, 1" "DP-2, 2560x1080@60, 0x0, 1, transform, 1" ]; @@ -286,12 +288,5 @@ in { }; }; }; - modules = { - swaync.enable = cfg.swaync; - waybar = mkIf cfg.waybar.enable { - inherit (cfg.waybar) enable battery style; - }; - wlsunset.enable = true; - }; }; } diff --git a/users/modules/desktop/kdeconnect.nix b/users/modules/desktop/kdeconnect.nix new file mode 100644 index 0000000..adda4a7 --- /dev/null +++ b/users/modules/desktop/kdeconnect.nix @@ -0,0 +1,14 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.desktop.kdeconnect; +in { + options.home.desktop.kdeconnect.enable = mkEnableOption "Enable KDE Connect"; + config.services.kdeconnect = mkIf cfg.enable { + enable = true; + indicator = true; + }; +} diff --git a/users/modules/kitty.nix b/users/modules/desktop/kitty.nix similarity index 94% rename from users/modules/kitty.nix rename to users/modules/desktop/kitty.nix index 90f6723..59f7167 100644 --- a/users/modules/kitty.nix +++ b/users/modules/desktop/kitty.nix @@ -1,6 +1,15 @@ -{pkgs, ...}: { - programs.kitty = { - enable = true; +{ + pkgs, + config, + lib, + ... +}: +with lib; let + cfg = config.home.desktop.kitty; +in { + options.home.desktop.kitty.enable = mkEnableOption "Enable kitty terminal"; + config.programs.kitty = mkIf cfg.enable { + inherit (cfg) enable; themeFile = "Nord"; font = { package = pkgs.cascadia-code; diff --git a/users/modules/desktop/obs.nix b/users/modules/desktop/obs.nix new file mode 100644 index 0000000..43b6b6b --- /dev/null +++ b/users/modules/desktop/obs.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.home.desktop.obs; +in { + options.home.desktop.obs.enable = mkEnableOption "Enables OBS Studio"; + config.programs.obs-studio = mkIf cfg.enable { + inherit (cfg) enable; + plugins = with pkgs.obs-studio-plugins; [ + input-overlay + obs-backgroundremoval + obs-mute-filter + obs-pipewire-audio-capture + obs-source-clone + obs-source-record + obs-tuna + ]; + }; +} diff --git a/users/modules/desktop/qt.nix b/users/modules/desktop/qt.nix new file mode 100644 index 0000000..16ec39a --- /dev/null +++ b/users/modules/desktop/qt.nix @@ -0,0 +1,11 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.desktop.qt; +in { + options.home.desktop.qt.enable = mkEnableOption "Enable Qt support"; + config.qt.enable = cfg.enable; +} diff --git a/users/modules/swaync.nix b/users/modules/desktop/swaync.nix similarity index 61% rename from users/modules/swaync.nix rename to users/modules/desktop/swaync.nix index 7fa5ac6..37af829 100644 --- a/users/modules/swaync.nix +++ b/users/modules/desktop/swaync.nix @@ -5,12 +5,9 @@ ... }: with lib; let - cfg = config.modules.swaync; + cfg = config.home.desktop.swaync; in { - options.modules.swaync = { - enable = mkEnableOption "Enables swaync"; - }; - + options.home.desktop.swaync.enable = mkEnableOption "Enables swaync"; config = mkIf cfg.enable { services.swaync.enable = true; home.packages = [pkgs.swaynotificationcenter]; diff --git a/users/modules/waybar.nix b/users/modules/desktop/waybar.nix similarity index 98% rename from users/modules/waybar.nix rename to users/modules/desktop/waybar.nix index 0a1793e..e90f74e 100644 --- a/users/modules/waybar.nix +++ b/users/modules/desktop/waybar.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.waybar; + cfg = config.home.desktop.waybar; in { - options.modules.waybar = { + options.home.desktop.waybar = { enable = mkEnableOption "Enables waybar."; battery = mkEnableOption "Enables battery support."; style = mkOption { diff --git a/users/modules/wlsunset.nix b/users/modules/desktop/wlsunset.nix similarity index 85% rename from users/modules/wlsunset.nix rename to users/modules/desktop/wlsunset.nix index 09bbb95..b94c8d0 100644 --- a/users/modules/wlsunset.nix +++ b/users/modules/desktop/wlsunset.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.wlsunset; + cfg = config.home.desktop.wlsunset; in { - options.modules.wlsunset = { + options.home.desktop.wlsunset = { enable = mkEnableOption "Enables wlsunset"; latitude = mkOption { type = with types; nullOr (oneOf [str ints.unsigned float]); diff --git a/users/modules/wofi.nix b/users/modules/desktop/wofi.nix similarity index 82% rename from users/modules/wofi.nix rename to users/modules/desktop/wofi.nix index d89dff6..93d8f24 100644 --- a/users/modules/wofi.nix +++ b/users/modules/desktop/wofi.nix @@ -1,10 +1,18 @@ { - programs.wofi = { - enable = true; + lib, + config, + ... +}: +with lib; let + cfg = config.home.desktop.wofi; +in { + options.home.desktop.wofi.enable = mkEnableOption "Enable wofi support"; + config.programs.wofi = mkIf cfg.enable { + inherit (cfg) enable; settings = { modi = "ssh,drun,combi"; sidebar-mode = false; - width = 30; + width = 50; line-margin = 10; lines = 6; columns = 2; diff --git a/users/modules/dev/default.nix b/users/modules/dev/default.nix new file mode 100644 index 0000000..56a595a --- /dev/null +++ b/users/modules/dev/default.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.dev; +in { + imports = [ + ./editors + ./ollama.nix + ./vcs + ]; + + options.home.dev.fullDesktop = mkEnableOption "Enables everything except AI"; + config.home.dev = { + vcs.fullDesktop = mkDefault cfg.fullDesktop; + editors.fullDesktop = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/dev/editors/default.nix b/users/modules/dev/editors/default.nix new file mode 100644 index 0000000..06023db --- /dev/null +++ b/users/modules/dev/editors/default.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.dev.editors; +in { + imports = [ + ./emacs.nix + ]; + + options.home.dev.editors.fullDesktop = mkEnableOption "Enable all editors"; + config.home.dev.editors.emacs = { + enable = mkDefault cfg.fullDesktop; + service = mkDefault cfg.fullDesktop; + mu4eMime = mkDefault cfg.fullDesktop; + org-protocol = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/emacs.nix b/users/modules/dev/editors/emacs.nix similarity index 92% rename from users/modules/emacs.nix rename to users/modules/dev/editors/emacs.nix index b9cfcbf..3333399 100644 --- a/users/modules/emacs.nix +++ b/users/modules/dev/editors/emacs.nix @@ -11,9 +11,9 @@ with lib; let epkgs.pdf-tools ] )); - cfg = config.modules.emacs; + cfg = config.home.dev.editors.emacs; in { - options.modules.emacs = { + options.home.dev.editors.emacs = { enable = mkEnableOption "enables Emacs"; package = mkOption { type = types.package; @@ -25,6 +25,7 @@ in { }; config = { + home.packages = [pkgs.emacs-all-the-icons-fonts]; programs.emacs = mkIf cfg.enable { enable = true; inherit (cfg) package; diff --git a/users/modules/ollama.nix b/users/modules/dev/ollama.nix similarity index 88% rename from users/modules/ollama.nix rename to users/modules/dev/ollama.nix index 3e6d4f7..602c27f 100644 --- a/users/modules/ollama.nix +++ b/users/modules/dev/ollama.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.ollama; + cfg = config.home.dev.ollama; in { - options.modules.ollama = { + options.home.dev.ollama = { enable = mkEnableOption "Enables Ollama"; gpu = mkOption { type = types.nullOr types.enum ["none" "amd" "nvidia"]; diff --git a/users/modules/dev/vcs/default.nix b/users/modules/dev/vcs/default.nix new file mode 100644 index 0000000..03e48bb --- /dev/null +++ b/users/modules/dev/vcs/default.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.home.dev.vcs; +in { + imports = [./git.nix ./jujutsu.nix]; + + options.home.dev.vcs = { + fullDesktop = mkEnableOption "Enable all optional values"; + name = mkOption { + type = types.str; + default = "Lucien Cartier-Tilet"; + }; + email = mkOption { + type = types.str; + default = "lucien@phundrak.com"; + }; + editor = mkOption { + type = types.str; + default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; + }; + publicKey = { + content = mkOption { + type = types.nullOr types.str; + example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h"; + default = null; + }; + file = mkOption { + type = with types; nullOr path; + default = "/home/phundrak/.ssh/id_ed25519.pub"; + }; + }; + }; + + config.home.dev.vcs = { + git = { + enable = mkDefault true; + inherit (cfg) name email editor; + publicKeyFile = cfg.publicKey.file; + cliff = mkDefault cfg.fullDesktop; + completeConfig = mkDefault cfg.fullDesktop; + }; + jj = { + enable = mkDefault true; + inherit (cfg) name email editor; + signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content); + }; + }; +} diff --git a/users/modules/vcs/git.nix b/users/modules/dev/vcs/git.nix similarity index 96% rename from users/modules/vcs/git.nix rename to users/modules/dev/vcs/git.nix index 437fe31..f6b6850 100644 --- a/users/modules/vcs/git.nix +++ b/users/modules/dev/vcs/git.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.git; + cfg = config.home.dev.vcs.git; in { - options.modules.git = { + options.home.dev.vcs.git = { enable = mkEnableOption "enables git"; email = mkOption { type = types.str; @@ -57,7 +57,11 @@ in { }; completeConfig = mkEnableOption "Complete configuration for workstations"; emacs = { - integration = mkEnableOption "enables Emacs integration"; + integration = mkOption { + description = "enables Emacs integration"; + type = types.bool; + default = config.home.dev.editors.emacs.enable; + }; pkg = mkOption { type = types.package; default = pkgs.emacs; @@ -111,7 +115,7 @@ in { }; commit.gpgsign = cfg.publicKeyFile != null; gpg.format = "ssh"; - gpg.ssh.allowedSignersFile = (mkIf (cfg.publicKeyFile != null)) "~/.ssh/allowed_signers"; + gpg.ssh.allowedSignersFile = "${config.home.homeDirectory}/.ssh/allowed_signers"; init.defaultBranch = "main"; pull.rebase = true; push = { diff --git a/users/modules/vcs/jujutsu.nix b/users/modules/dev/vcs/jujutsu.nix similarity index 86% rename from users/modules/vcs/jujutsu.nix rename to users/modules/dev/vcs/jujutsu.nix index 66dd986..f5ba1f7 100644 --- a/users/modules/vcs/jujutsu.nix +++ b/users/modules/dev/vcs/jujutsu.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.jj; + cfg = config.home.dev.vcs.jj; in { - options.modules.jj = { + options.home.dev.vcs.jj = { enable = mkEnableOption "enables jj"; name = mkOption { type = types.str; @@ -19,7 +19,10 @@ in { }; editor = mkOption { type = types.str; - default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; + default = + if config.home.dev.editors.emacs.enable + then "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs" + else "${pkgs.nano}/bin/nano"; }; signing = { enable = mkEnableOption "enables signing jj commits"; diff --git a/users/modules/eww.nix b/users/modules/eww.nix deleted file mode 100644 index 7ee4937..0000000 --- a/users/modules/eww.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - programs.eww = { - enable = true; - configDir = ./eww-config; - }; -} diff --git a/users/modules/flatpak.nix b/users/modules/flatpak.nix deleted file mode 100644 index 1ff0c53..0000000 --- a/users/modules/flatpak.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - services.flatpak.enable = true; -} diff --git a/users/modules/gpg.nix b/users/modules/gpg.nix deleted file mode 100644 index 48a7015..0000000 --- a/users/modules/gpg.nix +++ /dev/null @@ -1,12 +0,0 @@ -{pkgs, ...}: { - programs.gpg = { - enable = true; - mutableKeys = true; - mutableTrust = true; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = true; - pinentry.package = pkgs.pinentry-emacs; - }; -} diff --git a/users/modules/kdeconnect.nix b/users/modules/kdeconnect.nix deleted file mode 100644 index 544c162..0000000 --- a/users/modules/kdeconnect.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - services.kdeconnect = { - enable = true; - indicator = true; - }; -} diff --git a/users/modules/media/default.nix b/users/modules/media/default.nix new file mode 100644 index 0000000..925ad58 --- /dev/null +++ b/users/modules/media/default.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.media; +in { + imports = [ + ./mopidy.nix + ./mpd.nix + ./mpd-mpris.nix + ./mpv.nix + ]; + + options.home.media.fullDesktop = mkEnableOption "Enables everything"; + config.home.media = { + mopidy.enable = mkDefault cfg.fullDesktop; + mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable); + mpv.enable = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/mopidy.nix b/users/modules/media/mopidy.nix similarity index 92% rename from users/modules/mopidy.nix rename to users/modules/media/mopidy.nix index 187e16b..8da37a7 100644 --- a/users/modules/mopidy.nix +++ b/users/modules/media/mopidy.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.mopidy; + cfg = config.home.media.mopidy; in { - options.modules.mopidy = { + options.home.media.mopidy = { enable = mkEnableOption "Enables Mopidy."; }; diff --git a/users/modules/media/mpd-mpris.nix b/users/modules/media/mpd-mpris.nix new file mode 100644 index 0000000..475adcd --- /dev/null +++ b/users/modules/media/mpd-mpris.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.media.mpd-mpris; + cfgMpd = config.home.media.mpd; +in { + options.home.media.mpd-mpris.enable = mkOption { + type = types.bool; + default = cfgMpd.enable; + example = false; + }; + config.services.mpd-mpris.enable = cfg.enable; +} diff --git a/users/modules/media/mpd.nix b/users/modules/media/mpd.nix new file mode 100644 index 0000000..26f0a08 --- /dev/null +++ b/users/modules/media/mpd.nix @@ -0,0 +1,30 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.media.mpd; +in { + options.home.media.mpd.enable = mkEnableOption "Enables MPD"; + config.services.mpd = mkIf cfg.enable { + inherit (cfg) enable; + musicDirectory = "${config.home.homeDirectory}/Music"; + playlistDirectory = "${config.home.homeDirectory}/Music/playlists"; + network.startWhenNeeded = true; + extraConfig = '' + follow_outside_symlinks "yes" + follow_inside_symlinks "yes" + + bind_to_address "localhost" + auto_update "yes" + + audio_output { + type "fifo" + name "my_fifo" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; +} diff --git a/users/modules/mpv.nix b/users/modules/media/mpv.nix similarity index 79% rename from users/modules/mpv.nix rename to users/modules/media/mpv.nix index 2706190..bbc4a1c 100644 --- a/users/modules/mpv.nix +++ b/users/modules/media/mpv.nix @@ -1,6 +1,15 @@ -{pkgs, ...}: { - programs.mpv = { - enable = true; +{ + pkgs, + lib, + config, + ... +}: +with lib; let + cfg = config.home.media.mpv; +in { + options.home.media.mpv.enable = mkEnableOption "Enable MPV"; + config.programs.mpv = mkIf cfg.enable { + inherit (cfg) enable; config = { force-window = "immediate"; force-seekable = true; # force streams to be seekable @@ -16,7 +25,7 @@ screenshot-format = "png"; screenshot-high-bit-depth = true; screenshot-png-compression = 6; - screenshot-directory = "~/Pictures/Screenshots/mpv"; + screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv"; deband = true; deband-iterations = 2; diff --git a/users/modules/mpd.nix b/users/modules/mpd.nix deleted file mode 100644 index eb44017..0000000 --- a/users/modules/mpd.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - services.mpd = { - enable = true; - musicDirectory = "/home/phundrak/Music"; - playlistDirectory = "/home/phundrak/Music/playlists"; - extraConfig = '' - follow_outside_symlinks "yes" - follow_inside_symlinks "yes" - - bind_to_address "localhost" - auto_update "yes" - - audio_output { - type "fifo" - name "my_fifo" - path "/tmp/mpd.fifo" - format "44100:16:2" - } - ''; - }; -} diff --git a/users/modules/nix-index.nix b/users/modules/nix-index.nix deleted file mode 100644 index 6be1996..0000000 --- a/users/modules/nix-index.nix +++ /dev/null @@ -1,8 +0,0 @@ -{inputs, ...}: { - imports = [ - inputs.nix-index-database.homeModules.nix-index - ]; - - programs.nix-index.enable = true; - programs.nix-index-database.comma.enable = true; -} diff --git a/users/modules/qt.nix b/users/modules/qt.nix deleted file mode 100644 index d8ac7b7..0000000 --- a/users/modules/qt.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - qt.enable = true; -} diff --git a/users/modules/security/default.nix b/users/modules/security/default.nix new file mode 100644 index 0000000..bed6ea1 --- /dev/null +++ b/users/modules/security/default.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.security; +in { + imports = [ + ./gpg.nix + ./ssh.nix + ]; + options.home.security.fullDesktop = mkEnableOption "Enable all modules"; + config.home.security = { + gpg.enable = mkDefault cfg.fullDesktop; + ssh.enable = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/security/gpg.nix b/users/modules/security/gpg.nix new file mode 100644 index 0000000..0448bfa --- /dev/null +++ b/users/modules/security/gpg.nix @@ -0,0 +1,32 @@ +{ + pkgs, + lib, + config, + ... +}: +with lib; let + cfg = config.home.security.gpg; +in { + options.home.security.gpg = { + enable = mkEnableOption "Enable GPG"; + pinentry.package = mkOption { + type = types.package; + default = + if config.home.dev.editors.emacs.enable + then pkgs.pinentry-emacs + else pkgs.pinentry-gtk2; + }; + }; + config = mkIf cfg.enable { + programs.gpg = { + inherit (cfg) enable; + mutableKeys = true; + mutableTrust = true; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + pinentry.package = cfg.pinentry.package; + }; + }; +} diff --git a/users/modules/ssh.nix b/users/modules/security/ssh.nix similarity index 67% rename from users/modules/ssh.nix rename to users/modules/security/ssh.nix index 59ce48f..96a8229 100644 --- a/users/modules/ssh.nix +++ b/users/modules/security/ssh.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.ssh; + cfg = config.home.security.ssh; in { - options.modules.ssh = { + options.home.security.ssh = { enable = mkEnableOption "enables SSH"; hosts = mkOption { type = types.nullOr types.path; @@ -17,7 +17,7 @@ in { config = { programs.ssh = mkIf cfg.enable { enable = true; - includes = mkIf (cfg.hosts != null) [cfg.hosts]; + includes = lists.optional (cfg.hosts != null) cfg.hosts; }; }; } diff --git a/users/modules/services/blanket.nix b/users/modules/services/blanket.nix new file mode 100644 index 0000000..929f9cb --- /dev/null +++ b/users/modules/services/blanket.nix @@ -0,0 +1,11 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.services.blanket; +in { + options.home.services.blanket.enable = mkEnableOption "Enable blanket"; + config.services.blanket.enable = cfg.enable; +} diff --git a/users/modules/services/default.nix b/users/modules/services/default.nix new file mode 100644 index 0000000..cb8ecc1 --- /dev/null +++ b/users/modules/services/default.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.services; +in { + imports = [ + ./blanket.nix + ./mbsync.nix + ./mpris-proxy.nix + ./playerctld.nix + ]; + options.home.services.fullDesktop = mkEnableOption "Enable all modules"; + config.home.services = { + blanket.enable = mkDefault cfg.fullDesktop; + mbsync.enable = mkDefault cfg.fullDesktop; + mpris-proxy.enable = mkDefault cfg.fullDesktop; + playerctld.enable = mkDefault cfg.fullDesktop; + }; +} diff --git a/users/modules/mbsync.nix b/users/modules/services/mbsync.nix similarity index 52% rename from users/modules/mbsync.nix rename to users/modules/services/mbsync.nix index cc6588c..bb39eed 100644 --- a/users/modules/mbsync.nix +++ b/users/modules/services/mbsync.nix @@ -4,26 +4,14 @@ ... }: with lib; let - cfg = config.modules.mbsync; + cfg = config.home.services.mbsync; in { - options.modules.mbsync = { + options.home.services.mbsync = { enable = mkEnableOption "Enables mbsync"; - passwordFile = mkOption { - type = types.str; - example = "/var/email/password"; - }; service.enable = mkOption { type = types.bool; default = true; }; - host = mkOption { - type = types.str; - default = "mail.phundrak.com"; - }; - user = mkOption { - type = types.str; - default = "lucien@phundrak.com"; - }; }; config = mkIf cfg.enable { diff --git a/users/modules/services/mpris-proxy.nix b/users/modules/services/mpris-proxy.nix new file mode 100644 index 0000000..ee00fd4 --- /dev/null +++ b/users/modules/services/mpris-proxy.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.services.mpris-proxy; +in { + options.home.services.mpris-proxy.enable = mkEnableOption "Enable MPRIS forwarding towards bluetooth and MIDI"; + config.services.mpris-proxy.enable = cfg.enable; +} diff --git a/users/modules/services/playerctld.nix b/users/modules/services/playerctld.nix new file mode 100644 index 0000000..e757de1 --- /dev/null +++ b/users/modules/services/playerctld.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.services.playerctld; +in { + options.home.services.playerctld.enable = mkEnableOption "Enable playerctld daemon"; + config.services.playerctld.enable = cfg.enable; +} diff --git a/users/modules/shell/bash.nix b/users/modules/shell/bash.nix index f53b7ba..6448635 100644 --- a/users/modules/shell/bash.nix +++ b/users/modules/shell/bash.nix @@ -4,9 +4,9 @@ ... }: with lib; let - cfg = config.modules.bash; + cfg = config.home.shell.bash; in { - options.modules.bash = { + options.home.shell.bash = { enable = mkEnableOption "Enables bash"; aliases = mkOption { type = types.attrsOf types.str; diff --git a/users/modules/shell/default.nix b/users/modules/shell/default.nix index 951a46e..5cc5693 100644 --- a/users/modules/shell/default.nix +++ b/users/modules/shell/default.nix @@ -61,7 +61,7 @@ with lib; let please = "sudo -A"; wget = "wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\" -c"; }; - cfg = config.modules.shell; + cfg = config.home.shell; in { imports = [ ./bash.nix @@ -69,73 +69,22 @@ in { ./starship.nix ./tmux.nix ./zsh.nix + ./zoxide.nix ]; - - options.modules.shell = { - eatIntegration = mkEnableOption "Enable Emacs Eat integration in Bash or Zsh"; - enableBash = mkOption { - type = types.bool; - default = true; - description = "Enables bash"; + options.home.shell.fullDesktop = mkEnableOption "Enable all shells"; + config.home.shell = { + enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable; + bash = { + aliases = mkDefault aliases; + enable = mkDefault cfg.fullDesktop; }; - enableFish = mkOption { - type = types.bool; - default = true; - description = "Enables fish"; + fish = { + abbrs = mkDefault aliases; + enable = mkDefault cfg.fullDesktop; }; - enableZsh = mkOption { - type = types.bool; - default = true; - description = "Enables zsh"; - }; - starship = { - enable = mkEnableOption "Enables the starship prompt."; - jjIntegration = mkEnableOption "Enables Jujutsu integration in starship."; - }; - tmux.enable = mkEnableOption "Enables tmux"; - zoxide = { - enable = mkOption { - type = types.bool; - default = true; - description = "enables zoxide"; - }; - replaceCd = mkOption { - type = types.bool; - default = true; - description = "makes zoxide replace cd"; - }; - }; - }; - - config = { - home.shell = { - enableFishIntegration = mkDefault cfg.enableFish; - enableBashIntegration = mkDefault cfg.enableBash; - enableZshIntegration = mkDefault cfg.enableZsh; - }; - - modules = { - fish = { - enable = mkDefault cfg.enableFish; - abbrs = mkDefault aliases; - }; - bash = { - enable = mkDefault cfg.enableBash; - aliases = mkDefault aliases; - }; - zsh = { - enable = mkDefault cfg.enableZsh; - abbrs = mkDefault aliases; - }; - tmux.enable = cfg.tmux.enable; - inherit (cfg) starship; - }; - - programs.zoxide = mkIf cfg.zoxide.enable { - enable = true; - options = mkIf cfg.zoxide.replaceCd [ - "--cmd cd" - ]; + zsh = { + abbrs = mkDefault aliases; + enable = mkDefault cfg.fullDesktop; }; }; } diff --git a/users/modules/shell/fish.nix b/users/modules/shell/fish.nix index 21603a1..e04380d 100644 --- a/users/modules/shell/fish.nix +++ b/users/modules/shell/fish.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.fish; + cfg = config.home.shell.fish; in { - options.modules.fish = { + options.home.shell.fish = { enable = lib.mkEnableOption "enables fish"; abbrs = lib.mkOption { type = types.attrsOf types.str; diff --git a/users/modules/shell/starship.nix b/users/modules/shell/starship.nix index 062f8f7..ba61e84 100644 --- a/users/modules/shell/starship.nix +++ b/users/modules/shell/starship.nix @@ -4,17 +4,21 @@ ... }: with lib; let - cfg = config.modules.starship; + cfg = config.home.shell.starship; in { - options.modules.starship = { + options.home.shell.starship = { enable = mkEnableOption "Enables the starship prompt."; - jjIntegration = mkEnableOption "Enables Jujutsu integration in starship."; + jjIntegration = mkOption { + description = "Enable Jujutsu integration in starship"; + default = config.programs.jujutsu.enable; + type = types.bool; + }; }; config.programs.starship = mkIf cfg.enable { inherit (cfg) enable; enableTransience = true; - settings = { + settings = mkIf cfg.jjIntegration { custom.jj = { description = "The current jj status"; detect_folders = [".jj"]; diff --git a/users/modules/shell/tmux.nix b/users/modules/shell/tmux.nix index 0eea1d1..e01ab2b 100644 --- a/users/modules/shell/tmux.nix +++ b/users/modules/shell/tmux.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.tmux; + cfg = config.home.shell.tmux; in { - options.modules.tmux.enable = mkEnableOption "Enable tmux"; + options.home.shell.tmux.enable = mkEnableOption "Enable tmux"; config.programs.tmux = mkIf cfg.enable { inherit (cfg) enable; baseIndex = 1; diff --git a/users/modules/shell/zoxide.nix b/users/modules/shell/zoxide.nix new file mode 100644 index 0000000..a58ff97 --- /dev/null +++ b/users/modules/shell/zoxide.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: +with lib; let + cfg = config.home.shell.zoxide; +in { + options.home.shell.zoxide = { + enable = mkEnableOption "Enable zoxide"; + replaceCd = mkEnableOption "Replace cd with zoxide"; + }; + config.programs.zoxide = mkIf cfg.enable { + inherit (cfg) enable; + options = mkIf cfg.replaceCd [ + "--cmd cd" + ]; + }; +} diff --git a/users/modules/shell/zsh.nix b/users/modules/shell/zsh.nix index ac452fd..8e09c61 100644 --- a/users/modules/shell/zsh.nix +++ b/users/modules/shell/zsh.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.modules.zsh; + cfg = config.home.shell.zsh; in { - options.modules.zsh = { + options.home.shell.zsh = { enable = lib.mkEnableOption "Enables zsh"; abbrs = lib.mkOption { type = types.attrsOf types.str; @@ -24,70 +24,73 @@ in { }; }; - config.programs.zsh = lib.mkIf cfg.enable { - enable = true; - autocd = true; - autosuggestion = { + config = lib.mkIf cfg.enable { + programs.zsh = { enable = true; - strategy = ["match_prev_cmd" "completion"]; - }; - enableCompletion = true; - history = { - findNoDups = true; - ignoreAllDups = true; - ignoreDups = true; - ignoreSpace = true; - path = "${config.xdg.dataHome}/zsh/zsh_history"; - saveNoDups = true; - }; - historySubstringSearch.enable = true; - initContent = with lib; - concatLines [ - '' - bindkey -e - bindkey '^p' history-search-backward - bindkey '^n' history-search-forward + autocd = true; + autosuggestion = { + enable = true; + strategy = ["match_prev_cmd" "completion"]; + }; + enableCompletion = true; + enableVteIntegration = true; + history = { + findNoDups = true; + ignoreAllDups = true; + ignoreDups = true; + ignoreSpace = true; + path = "${config.xdg.dataHome}/zsh/zsh_history"; + saveNoDups = true; + }; + historySubstringSearch.enable = true; + initContent = with lib; + concatLines [ + '' + bindkey -e + bindkey '^p' history-search-backward + bindkey '^n' history-search-forward - # Completion styling - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' - zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" - zstyle ':completion:*' menu no - zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath' - '' - (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'') - cfg.zshrcExtra - ]; - oh-my-zsh = { - enable = true; + # Completion styling + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" + zstyle ':completion:*' menu no + zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath' + '' + (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'') + cfg.zshrcExtra + ]; + oh-my-zsh = { + enable = true; + plugins = [ + "dirhistory" + "sudo" + ]; + }; plugins = [ - "dirhistory" - "sudo" + { + name = "fzf-tab"; + src = pkgs.fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "v1.2.0"; + sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY="; + }; + } + { + name = "zsh-autopair"; + src = pkgs.fetchFromGitHub { + owner = "hlissner"; + repo = "zsh-autopair"; + rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d"; + sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ="; + }; + } ]; - }; - plugins = [ - { - name = "fzf-tab"; - src = pkgs.fetchFromGitHub { - owner = "Aloxaf"; - repo = "fzf-tab"; - rev = "v1.2.0"; - sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY="; - }; - } - { - name = "zsh-autopair"; - src = pkgs.fetchFromGitHub { - owner = "hlissner"; - repo = "zsh-autopair"; - rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d"; - sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ="; - }; - } - ]; - syntaxHighlighting.enable = true; - zsh-abbr = { - enable = true; - abbreviations = cfg.abbrs; + syntaxHighlighting.enable = true; + zsh-abbr = { + enable = true; + abbreviations = cfg.abbrs; + }; }; }; } diff --git a/users/modules/vcs/default.nix b/users/modules/vcs/default.nix deleted file mode 100644 index 64d52d0..0000000 --- a/users/modules/vcs/default.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.modules.vcs; -in { - imports = [./git.nix ./jujutsu.nix]; - - options.modules.vcs = { - git = { - enable = mkEnableOption "enables git"; - cliff = mkEnableOption "enables git-cliff support"; - sendmail = { - enable = mkOption { - type = types.bool; - default = true; - }; - server = mkOption { - type = types.nullOr types.str; - default = "mail.phundrak.com"; - }; - user = mkOption { - type = types.nullOr types.str; - default = null; - }; - encryption = mkOption { - type = types.enum ["tls" "ssl" "none"]; - default = "none"; - }; - port = mkOption { - type = types.nullOr types.int; - default = 587; - }; - passwordFile = mkOption { - type = types.nullOr types.path; - default = null; - description = '' - Path to a file containing the password necessary for authenticating - against the mailserver. - - This file should contain the password only, with no newline. - ''; - }; - }; - browser = mkOption { - type = types.nullOr types.str; - example = "${pkgs.firefox}/bin/firefox"; - default = null; - }; - completeConfig = mkEnableOption "Complete configuration for workstations"; - mergeTool = mkOption { - type = types.str; - default = "ediff"; - }; - emacs = { - integration = mkEnableOption "enables Emacs integration"; - pkg = mkOption { - type = types.package; - default = pkgs.emacs; - }; - }; - }; - jj.enable = mkEnableOption "enables jujutsu"; - name = mkOption { - type = types.str; - default = "Lucien Cartier-Tilet"; - }; - email = mkOption { - type = types.str; - default = "lucien@phundrak.com"; - }; - editor = mkOption { - type = types.str; - default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; - }; - publicKey = { - content = mkOption { - type = types.nullOr types.str; - example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h"; - default = null; - }; - file = mkOption { - type = with types; nullOr path; - default = "/home/phundrak/.ssh/id_ed25519.pub"; - }; - }; - }; - - config = lib.mkIf (cfg.git.enable || cfg.jj.enable) { - home.file.".ssh/allowed_signers".text = mkIf (cfg.publicKey.content != null) (mkDefault '' - ${cfg.email} namespaces="git" ${cfg.publicKey.content} - ''); - modules = { - git = mkIf cfg.git.enable { - inherit (cfg.git) enable cliff sendmail browser completeConfig emacs mergeTool; - inherit (cfg) email name editor; - publicKeyFile = cfg.publicKey.file; - }; - jj = mkIf cfg.jj.enable { - inherit (cfg.jj) enable; - inherit (cfg) name email editor; - signing.enable = cfg.publicKey.content != null; - signing.sshKey = - if (cfg.publicKey.file == null) - then cfg.publicKey.content - else cfg.publicKey.file; - }; - }; - }; -} diff --git a/users/modules/yt-dlp.nix b/users/modules/yt-dlp.nix deleted file mode 100644 index 9354546..0000000 --- a/users/modules/yt-dlp.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - programs.yt-dlp = { - enable = true; - settings = { - embed-thumbnail = true; - embed-subs = true; - sub-langs = "all"; - }; - }; -} diff --git a/users/phundrak/alys.nix b/users/phundrak/alys.nix deleted file mode 100644 index a022928..0000000 --- a/users/phundrak/alys.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [./light-home.nix]; - home.phundrak.sshKey = { - content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTv1lb6d99O84jeh6GdjPm8Gnt/HncSRhGhmoTq7BMK lucien@phundrak.com"; - file = "/home/phundrak/.ssh/id_ed25519.pub"; - }; - modules.nh.flake = "/home/phundrak/.dotfiles"; -} diff --git a/users/phundrak/email.nix b/users/phundrak/email.nix index 27c3c93..77f8d91 100644 --- a/users/phundrak/email.nix +++ b/users/phundrak/email.nix @@ -7,7 +7,7 @@ Sent from GNU/Emacs *** Sauvez un arbre, mangez un castor *** - *** Save a tree, eat a beaver *** + *** Save a tree, eat a beaver *** ''; in { home.file.".signature" = { diff --git a/users/phundrak/gampo.nix b/users/phundrak/gampo.nix deleted file mode 100644 index 3a9e9c9..0000000 --- a/users/phundrak/gampo.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [./home.nix]; - home.phundrak.sshKey = { - content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBPhP4p9KGk6jSOxJzBu+RzJPHI6baT0o+xrgPeNRwfq lucien@phundrak.com"; - file = "/home/phundrak/.ssh/id_ed25519.pub"; - }; -} diff --git a/users/phundrak/home.nix b/users/phundrak/home.nix index 377682f..3a81542 100644 --- a/users/phundrak/home.nix +++ b/users/phundrak/home.nix @@ -1,7 +1,6 @@ { pkgs, config, - inputs, ... }: { imports = [ @@ -18,10 +17,9 @@ epkgs.pdf-tools ] )); - askpass = import ../scripts/askpass.nix {inherit pkgs;}; - launchWithEmacsclient = import ../scripts/launch-with-emacsclient.nix { - inherit pkgs; - emacsPackage = emacsPkg; + askpass = import ../modules/cli/scripts/askpass.nix {inherit pkgs;}; + launchWithEmacsclient = import ../modules/cli/scripts/launch-with-emacsclient.nix { + inherit pkgs config; }; in { sops.secrets = { @@ -30,83 +28,21 @@ "mopidy/spotify" = {}; }; - home.sessionVariables = { - EDITOR = "${emacsPkg}/bin/emacsclient -c -a ${emacsPkg}/bin/emacs"; - LAUNCH_EDITOR = "${launchWithEmacsclient}/bin/launch-with-emacsclient"; - SUDO_ASKPASS = "${askpass}/bin/askpass"; - LSP_USE_PLISTS = "true"; - }; + home = { + sessionVariables = { + EDITOR = "${emacsPkg}/bin/emacsclient -c -a ${emacsPkg}/bin/emacs"; + LAUNCH_EDITOR = "${launchWithEmacsclient}/bin/launch-with-emacsclient"; + SUDO_ASKPASS = "${askpass}/bin/askpass"; + LSP_USE_PLISTS = "true"; + }; - modules = { - shell = { - eatIntegration = true; - starship.jjIntegration = true; - }; - bat.extras = true; - packages.emacsPackage = emacsPkg; - mopidy.enable = true; - ollama.enable = true; - - emacs = { + desktop.waybar.style = ./config/waybar/style.css; + dev.ollama = { enable = true; - service = true; - package = emacsPkg; - mu4eMime = true; - org-protocol = true; + gpu = "amd"; }; - hyprland = { - inherit emacsPkg; - enable = true; - swaync = true; - waybar = { - enable = true; - battery = true; - style = ./config/waybar/style.css; - }; - }; - mbsync = { - enable = true; - passwordFile = config.sops.secrets.emailPassword.path; - }; - ssh = { - enable = true; - hosts = config.sops.secrets."ssh/hosts".path; - }; - vcs.git = { - browser = "${inputs.zen-browser.packages.${pkgs.system}.default}/bin/zen"; - emacs = { - integration = true; - pkg = emacsPkg; - }; - cliff = true; - sendmail = { - enable = true; - passwordFile = config.sops.secrets.emailPassword.path; - }; - }; - }; - - programs = { - zsh.enableVteIntegration = true; - mu.enable = true; - obs-studio = { - enable = true; - plugins = with pkgs; [ - obs-studio-plugins.input-overlay - obs-studio-plugins.obs-backgroundremoval - obs-studio-plugins.obs-mute-filter - obs-studio-plugins.obs-pipewire-audio-capture - obs-studio-plugins.obs-source-clone - obs-studio-plugins.obs-source-record - obs-studio-plugins.obs-tuna - ]; - }; - }; - - services = { - blanket.enable = true; - mpris-proxy.enable = true; - playerctld.enable = true; + fullDesktop = true; + shell.fish.enable = true; }; manual.html.enable = true; diff --git a/users/phundrak/host/alys.nix b/users/phundrak/host/alys.nix new file mode 100644 index 0000000..affc142 --- /dev/null +++ b/users/phundrak/host/alys.nix @@ -0,0 +1,10 @@ +{config, ...}: { + imports = [../light-home.nix]; + home = { + cli.nh.flake = "${config.home.homeDirectory}/nixos"; + phundrak.sshKey = { + content = builtins.readFile ../../../keys/id_alys.pub; + # file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + }; + }; +} diff --git a/users/phundrak/host/gampo.nix b/users/phundrak/host/gampo.nix new file mode 100644 index 0000000..25e8a35 --- /dev/null +++ b/users/phundrak/host/gampo.nix @@ -0,0 +1,11 @@ +{config, ...}: { + imports = [../home.nix]; + home = { + cli.nh.flake = "${config.home.homeDirectory}/nixos"; + desktop.hyprland.host = "gampo"; + phundrak.sshKey = { + content = builtins.readFile ../../../keys/id_gampo.pub; + # file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + }; + }; +} diff --git a/users/phundrak/host/marpa.nix b/users/phundrak/host/marpa.nix new file mode 100644 index 0000000..ffca121 --- /dev/null +++ b/users/phundrak/host/marpa.nix @@ -0,0 +1,11 @@ +{config, ...}: { + imports = [../home.nix]; + home = { + cli.nh.flake = "${config.home.homeDirectory}/nixos"; + desktop.hyprland.host = "marpa"; + phundrak.sshKey = { + content = builtins.readFile ../../../keys/id_marpa.pub; + # file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + }; + }; +} diff --git a/users/phundrak/host/tilo.nix b/users/phundrak/host/tilo.nix new file mode 100644 index 0000000..f2c07e6 --- /dev/null +++ b/users/phundrak/host/tilo.nix @@ -0,0 +1,10 @@ +{config, ...}: { + imports = [../light-home.nix]; + home = { + cli.nh.flake = "${config.home.homeDirectory}/nixos"; + phundrak.sshKey = { + content = builtins.readFile ../../../keys/id_tilo.pub; + # file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + }; + }; +} diff --git a/users/phundrak/light-home.nix b/users/phundrak/light-home.nix index 8a6dff1..655f3fe 100644 --- a/users/phundrak/light-home.nix +++ b/users/phundrak/light-home.nix @@ -33,11 +33,10 @@ in { age = { # automatically import user SSH keys as age keys sshKeyPaths = [ - "/home/phundrak/.ssh/id_ed25519" + "${config.home.homeDirectory}/.ssh/id_ed25519" ]; # this will use an age key that is expected to already be in the filesystem - # keyFile = "/home/phundrak/.config/sops/age/keys.txt"; - keyFile = "/home/phundrak/.local/sops-nix/key.txt"; + keyFile = "${config.home.homeDirectory}/.local/sops-nix/key.txt"; # generate a new key if the key specified above does not exist generateKey = true; }; @@ -47,23 +46,35 @@ in { username = "phundrak"; homeDirectory = "/home/phundrak"; packages = [pkgs.tree pkgs.ncdu]; - stateVersion = "24.11"; # Please read the comment before changing. - }; - modules = { - shell = { - starship.enable = true; - tmux.enable = true; - }; - vcs = { - git.enable = true; + phundrak.sshKey.file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + + dev.vcs = { jj.enable = true; + git.enable = true; publicKey = cfg.sshKey; }; - ssh = { + + security.ssh = { enable = true; hosts = config.sops.secrets."ssh/hosts".path; }; + + shell = { + bash.enable = true; + zsh.enable = true; + starship = { + enable = true; + jjIntegration = true; + }; + tmux.enable = true; + zoxide = { + enable = true; + replaceCd = true; + }; + }; + + stateVersion = "24.11"; # Do not modify! }; manual.manpages.enable = true; diff --git a/users/phundrak/marpa.nix b/users/phundrak/marpa.nix deleted file mode 100644 index 3a9e9c9..0000000 --- a/users/phundrak/marpa.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [./home.nix]; - home.phundrak.sshKey = { - content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBPhP4p9KGk6jSOxJzBu+RzJPHI6baT0o+xrgPeNRwfq lucien@phundrak.com"; - file = "/home/phundrak/.ssh/id_ed25519.pub"; - }; -} diff --git a/users/phundrak/packages.nix b/users/phundrak/packages.nix index c02021c..941d36f 100644 --- a/users/phundrak/packages.nix +++ b/users/phundrak/packages.nix @@ -2,109 +2,90 @@ pkgs, inputs, lib, - config, ... }: -with lib; let - cfg = config.modules.packages; -in { - options.modules.packages.emacsPackage = mkOption { - type = types.package; - default = pkgs.emacs; - }; - config.home.packages = with pkgs; let - scripts = import ../scripts { - inherit pkgs; - config.emacsPkg = cfg.emacsPackage; - }; - in - [ - flatpak +with lib; { + home.packages = with pkgs; [ + # Terminal stuff + duf + ffmpeg + ripgrep-all + unzip - # LSP servers - bash-language-server - docker-language-server - kdePackages.qtdeclarative # For QML LSP - nil # Nix - python3 # for Emacs and LSP - yaml-language-server # Yaml (Docker, GitHub Actions, ...) + # Fonts + #nerdfonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + tibetan-machine - # Terminal stuff - duf - ffmpeg - ripgrep-all - unzip + # Browsers + amfora - # Fonts - #nerdfonts - noto-fonts-cjk-sans - noto-fonts-cjk-serif - tibetan-machine + # Media + ani-cli + audacity + plexamp + plex-desktop + spicetify-cli + spotify + pavucontrol # Volume control - # Browsers - amfora + # Social + vesktop # Discord alternative that works well with wayland + element-desktop + signal-desktop-bin - # Media - ani-cli - audacity - plexamp - plex-desktop - spicetify-cli - spotify - pavucontrol # Volume control + # Misc + bitwarden + gplates + libnotify + nextcloud-client + onlyoffice-bin + scrcpy + syncthing + watchmate + inputs.zen-browser.packages.${system}.default + inputs.pumo-system-info.packages.${system}.default + inputs.quickshell.packages.${system}.default - # Social - vesktop # Discord alternative that works well with wayland - element-desktop - signal-desktop-bin + # Games + atlauncher + heroic + modrinth-app + openmw + openttd-jgrpp + moonlight-qt - # Misc - bitwarden - gplates - libnotify - nextcloud-client - onlyoffice-bin - scrcpy - syncthing - watchmate - inputs.zen-browser.packages.${system}.default - inputs.pumo-system-info.packages.${system}.default - inputs.quickshell.packages.${system}.default + # Gnome stuff + gnome-tweaks + gnomeExtensions.docker + gnomeExtensions.syncthing-indicator + gnomeExtensions.tray-icons-reloaded + gthumb - # Games - atlauncher - heroic - modrinth-app - openmw - openttd-jgrpp - moonlight-qt + # Graphics + inkscape + gimp + gimpPlugins.fourier + gimpPlugins.farbfeld - # Emacs stuff - emacs-all-the-icons-fonts + # Dev + devenv + dive # A tool for exploring each layer in a docker image + grype # Vulnerability scanner for container images and filesystems + kicad # Working on my custom keyboard + podman-desktop + podman-compose + tectonic # better LaTeX engine + virt-manager + zeal - # Gnome stuff - gnome-tweaks - gnomeExtensions.docker - gnomeExtensions.syncthing-indicator - gnomeExtensions.tray-icons-reloaded - gthumb - - # Graphics - inkscape - gimp - gimpPlugins.fourier - gimpPlugins.farbfeld - - # Dev - devenv - dive # A tool for exploring each layer in a docker image - grype # Vulnerability scanner for container images and filesystems - kicad # Working on my custom keyboard - podman-desktop - podman-compose - tectonic # better LaTeX engine - virt-manager - zeal - ] - ++ scripts; + ## LSP servers + bash-language-server + docker-language-server + kdePackages.qtdeclarative # For QML LSP + nil # Nix + python3 # for Emacs and LSP + yaml-language-server # Yaml (Docker, GitHub Actions, ...) + ]; } diff --git a/users/phundrak/programs.nix b/users/phundrak/programs.nix deleted file mode 100644 index 0960f36..0000000 --- a/users/phundrak/programs.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - modules = { - emacs.enable = true; - kdeconnect.enable = true; - kitty.enable = true; - mbsync.enable = true; - mpd.enable = true; - mpv.enable = true; - wofi.enable = true; - yt-dlp.enable = true; - }; -} diff --git a/users/phundrak/tilo.nix b/users/phundrak/tilo.nix deleted file mode 100644 index 0c36943..0000000 --- a/users/phundrak/tilo.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [./light-home.nix]; - home.phundrak.sshKey = { - content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILw9oiK8tZ5Vpz82RaRLpITU8qeJrT2hjvudGEDQu2QW lucien@phundrak.com"; - file = "/home/phundrak/.ssh/id_ed25519.pub"; - }; - modules.nh.flake = "/tank/phundrak/nixos"; -} diff --git a/users/scripts/default.nix b/users/scripts/default.nix deleted file mode 100644 index d246077..0000000 --- a/users/scripts/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - pkgs, - ... -}: let - askpass = import ./askpass.nix {inherit pkgs;}; -in [ - askpass - (import ./backup.nix {inherit pkgs;}) - (import ./keygen.nix {inherit pkgs;}) - (import ./launch-with-emacsclient.nix { - inherit pkgs; - emacsPackage = config.emacsPkg; - }) - (import ./mp42webm.nix {inherit pkgs;}) - (import ./plock.nix {inherit pkgs;}) - (import ./screenshot.nix {inherit pkgs;}) - (import ./sshbind.nix {inherit pkgs;}) -]