diff --git a/helpers.nix b/helpers.nix index be8aa40..73616be 100644 --- a/helpers.nix +++ b/helpers.nix @@ -11,31 +11,104 @@ with inputs.nixpkgs.lib; { user ? "fern", extraModules ? [], }: let + system = platform; + secrets = builtins.toString inputs.secrets; + + pull-requests = { + fluffychat = import nixpkgs-pr-fluffychat { + inherit system; + overlays = [ + (final: prev: { + fluffychat = prev.fluffychat.overrideAttrs (prevAttrs: rec { + desktopItems = [ + ((builtins.elemAt prevAttrs.desktopItems 0).override {startupWMClass = "fluffychat";}) + ]; + }); + }) + ]; + }; + + feishin = import nixpkgs-pr-feishin { + inherit system; + overlays = [ + (final: prev: { + feishin = prev.feishin.overrideAttrs (prevAttrs: rec { + pname = "feishin"; + version = "0.18.0"; + + src = prev.fetchFromGitHub { + owner = "jeffvli"; + repo = "feishin"; + rev = "v${version}"; + hash = "sha256-4gcS7Vd7LSpEByO2Hlk6nb8V2adBPh5XwWGCu2lwOA4="; + }; + + pnpmDeps = prev.pnpm_10.fetchDeps { + inherit pname version src; + hash = "sha256-1MGxrUcfvazxAubaYAsQuulUKm05opWOIC7oaLzjr7o="; + }; + }); + }) + ]; + }; + }; + + userPackages = final: prev: { + # WebOne HTTP proxy. + webone = prev.pkgs.callPackage ./packages/webone {}; + # Yazi Gruvbox theme. + yazi-flavour-gruvbox-dark = prev.pkgs.callPackage ./packages/yazi-flavour-gruvbox {}; + # Latest FluffyChat. + fluffychat = pull-requests.fluffychat.fluffychat; + # Latest Feishin. + feishin = pull-requests.feishin.feishin; + # PrismLauncher with Temurin JRE. + prismlauncher = prev.prismlauncher.override { + jdks = [ + prev.pkgs.temurin-jre-bin + ]; + }; + }; + + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "dotnet-sdk-6.0.428" + "dotnet-runtime-6.0.36" + ]; + }; + overlays = [ + userPackages + ]; + }; + + deployPkgs = import nixpkgs { + inherit system; + overlays = [ + deploy-rs.overlays.default + (self: super: { + deploy-rs = { + inherit (pkgs) deploy-rs; + lib = super.deploy-rs.lib; + }; + }) + ]; + }; in { nixosConfigurations.${hostname} = nixosSystem { - system = platform; - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "dotnet-sdk-6.0.428" - "dotnet-runtime-6.0.36" - ]; - }; - overlays = [(import ./overlay.nix inputs)]; - }; + inherit system pkgs; specialArgs = { inherit - nixpkgs hostname platform suite user + secrets ; # Inherit variables. - secrets = builtins.toString inputs.secrets; }; modules = @@ -49,13 +122,15 @@ with inputs.nixpkgs.lib; { ++ extraModules; }; } - // optionalAttrs (suite != "desktop") { + // optionalAttrs ((suite == "server") + || (suite == "vm") + || (suite == "lxc")) { deploy.nodes.${hostname} = { hostname = "${hostname}.local"; profiles.system = { user = "root"; sshUser = user; - path = pkgs.deploy-rs.deploy-rs.lib.activate.nixos self.nixosConfigurations.${hostname}; + path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.${hostname}; }; }; }; diff --git a/modules/webone.nix b/modules/webone.nix index 701374a..dc8169d 100644 --- a/modules/webone.nix +++ b/modules/webone.nix @@ -1,7 +1,7 @@ { config, lib, - userPackages, + pkgs, ... }: with lib; let @@ -47,13 +47,13 @@ in { startLimitIntervalSec = 5; startLimitBurst = 3; environment = { - OPENSSL_CONF = "${userPackages.webone}/lib/webone/openssl_webone.cnf"; + OPENSSL_CONF = "${pkgs.webone}/lib/webone/openssl_webone.cnf"; }; serviceConfig = { Type = "simple"; User = "webone"; Group = "webone"; - ExecStart = "${userPackages.webone}/bin/webone"; + ExecStart = "${pkgs.webone}/bin/webone"; TimeoutStopSec = "10"; Restart = "on-failure"; RestartSec = "5"; diff --git a/suites/common.nix b/suites/common.nix index f724de2..0f3a929 100644 --- a/suites/common.nix +++ b/suites/common.nix @@ -1,6 +1,4 @@ { - nixpkgs, - userPackages, pkgs, lib, hostname, @@ -20,9 +18,6 @@ with lib; { # Add @wheel to trusted-users for remote deployments. nix.settings.trusted-users = ["root" "@wheel"]; - # Set $NIX_PATH to flake input. - nix.nixPath = ["nixpkgs=${nixpkgs}"]; - # Enable redistributable firmware. hardware.enableRedistributableFirmware = true; @@ -77,7 +72,7 @@ with lib; { # yazi cd on quit. function y set tmp (mktemp -t "yazi-cwd.XXXXXX") - ${pkgs.yazi}/bin/yazi $argv --cwd-file="$tmp" + yazi $argv --cwd-file="$tmp" if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] builtin cd -- "$cwd" end @@ -89,10 +84,10 @@ with lib; { # https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell programs.bash = { interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] then shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + exec fish $LOGIN_OPTION fi ''; }; @@ -107,9 +102,12 @@ with lib; { nixvim = { enable = true; + defaultEditor = true; + # For telescope. dependencies.ripgrep.enable = true; + # Space as leader. globals.mapleader = " "; keymaps = [ @@ -226,7 +224,7 @@ with lib; { programs.yazi = { enable = true; - flavors."gruvbox-dark.yazi" = userPackages.yazi-flavour-gruvbox-dark; + flavors."gruvbox-dark.yazi" = pkgs.yazi-flavour-gruvbox-dark; settings.theme = { flavor.dark = "gruvbox-dark"; }; diff --git a/suites/desktop.nix b/suites/desktop.nix index 813f2d5..2c7942d 100755 --- a/suites/desktop.nix +++ b/suites/desktop.nix @@ -1,6 +1,5 @@ { pkgs, - userPackages, lib, ... }: @@ -48,8 +47,8 @@ with lib; { services.xserver = { enable = true; - excludePackages = with pkgs; [ - xterm # Don't install xterm. + excludePackages = [ + pkgs.xterm # Don't install xterm. ]; displayManager.gdm.enable = true; @@ -105,6 +104,8 @@ with lib; { celluloid deploy-rs discord + feishin + fluffychat ghostty gimp3 glabels-qt @@ -118,27 +119,12 @@ with lib; { merriweather-sans nerd-fonts.fira-code obsidian + prismlauncher + prismlauncher protonmail-desktop signal-desktop smile - userPackages.feishin yubioath-flutter - - # PrismLauncher with temurin jre. - (prismlauncher.override { - jdks = [ - temurin-jre-bin - ]; - }) - - # FluffyChat 2.0.0 with fixed desktop item. - (userPackages.fluffychat.overrideAttrs ( - finalAttrs: previousAttrs: { - desktopItems = [ - ((builtins.elemAt previousAttrs.desktopItems 0).override {startupWMClass = "fluffychat";}) - ]; - } - )) ]; # Allow opening terminal applications from gnome app launcher.