From 7b51a603c434e472b56977dada54b44363995b8c Mon Sep 17 00:00:00 2001 From: Cookiez Date: Thu, 11 Dec 2025 16:20:20 +0100 Subject: [PATCH] Set project name as a varible in flake so it can be changed easier. --- flake.nix | 2 ++ modules/configuration.nix | 4 ++-- modules/desktop-entries.nix | 8 ++++---- modules/home.nix | 4 ++-- modules/hyprpaper/home.nix | 18 +++++++++--------- modules/ncli.nix | 3 ++- modules/zsh.nix | 10 ++++++++-- plasma/autostart.nix | 6 +++--- plasma/plasma.nix | 6 +++--- 9 files changed, 35 insertions(+), 26 deletions(-) diff --git a/flake.nix b/flake.nix index 51659d4..e87553f 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ let username = "cookiez"; hostname = "nixos"; + project = "NixOS"; version = "26.05"; #DO NOT change to "unstable" as it is not a valid option for all cascading uses of this variable system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; @@ -56,6 +57,7 @@ inherit username; inherit version; inherit system; + inherit project; host = hostname; }; modules = [ diff --git a/modules/configuration.nix b/modules/configuration.nix index 206e834..a55cf0e 100644 --- a/modules/configuration.nix +++ b/modules/configuration.nix @@ -10,7 +10,7 @@ #Nix flake file limit: ulimit -n 500000 -{ inputs, config, pkgs, lib, username, host, version, system, ... }: +{ inputs, config, pkgs, lib, username, project, host, version, system, ... }: { # in configuration.nix #Assign Swap to the PC @@ -87,7 +87,7 @@ useUserPackages = true; users.${username} = ./home.nix; backupFileExtension = "backup"; # Automatically backs up conflicting files during activation - extraSpecialArgs = { inherit inputs username version system host; }; + extraSpecialArgs = { inherit inputs username project version system host; }; sharedModules = [ inputs.plasma-manager.homeModules.plasma-manager ]; }; diff --git a/modules/desktop-entries.nix b/modules/desktop-entries.nix index da081a1..574efeb 100644 --- a/modules/desktop-entries.nix +++ b/modules/desktop-entries.nix @@ -1,4 +1,4 @@ -{ pkgs, username, ...}: +{ pkgs, username, project, ...}: { xdg = { desktopEntries.youtube = { @@ -19,7 +19,7 @@ categories = [ "Network" "InstantMessaging" "Chat" ]; exec = "vesktop %U"; genericName = "Internet Messenger"; - icon = "/home/${username}/NixOS/other/discord.app.png"; + icon = "/home/${username}/${project}/other/discord.app.png"; name = "Discord"; type = "Application"; }; @@ -41,7 +41,7 @@ terminal = false; categories = [ "System" "TerminalEmulator" ]; - icon = "/home/${username}/NixOS/other/kitty.app.png"; + icon = "/home/${username}/${project}/other/kitty.app.png"; }; desktopEntries."org.kde.kinfocenter" = { @@ -80,7 +80,7 @@ }; desktopEntries."nixos-manual" = { - name = "NixOS Manual"; + name = "${project} Manual"; noDisplay = true; }; diff --git a/modules/home.nix b/modules/home.nix index a231aae..83f86b1 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -1,11 +1,11 @@ -{ lib, inputs, config, pkgs, username, host, version, ... }: +{ lib, inputs, config, pkgs, username, project, host, version, ... }: { # Home Manager needs a bit of information about you and the # paths it should manage. home.username = username; home.homeDirectory = "/home/${username}"; home.packages = [ - (import ./ncli.nix { inherit pkgs host; backupFiles = [ + (import ./ncli.nix { inherit pkgs host project; backupFiles = [ ".gtkrc-2.0.backup" ".config/gtk-3.0/gtk.css.backup" ".config/gtk-3.0/settings.ini.backup" diff --git a/modules/hyprpaper/home.nix b/modules/hyprpaper/home.nix index e023019..ec724ab 100644 --- a/modules/hyprpaper/home.nix +++ b/modules/hyprpaper/home.nix @@ -1,4 +1,4 @@ -{pkgs, inputs, username, ...}: +{pkgs, inputs, username, project, ...}: { imports = [ @@ -10,17 +10,17 @@ settings = { preload = [ - "/home/${username}/NixOS/other/wallpaper1.png" - #"/home/${username}/NixOS/other/wallpaper2.png" - #"/home/${username}/NixOS/other/wallpaper3.png" - #"/home/${username}/NixOS/other/wallpaper4.png" + "/home/${username}/${project}/other/wallpaper1.png" + #"/home/${username}/${project}/other/wallpaper2.png" + #"/home/${username}/${project}/other/wallpaper3.png" + #"/home/${username}/${project}/other/wallpaper4.png" ]; wallpaper = [ - "eDP-1,/home/${username}/NixOS/other/wallpaper1.png" - #"eDP-1,/home/${username}/NixOS/other/wallpaper2.png" - #"eDP-1,/home/${username}/NixOS/other/wallpaper3.png" - #"eDP-1,/home/${username}/NixOS/other/wallpaper4.png" + "eDP-1,/home/${username}/${project}/other/wallpaper1.png" + #"eDP-1,/home/${username}/${project}/other/wallpaper2.png" + #"eDP-1,/home/${username}/${project}/other/wallpaper3.png" + #"eDP-1,/home/${username}/${project}/other/wallpaper4.png" ]; }; }; diff --git a/modules/ncli.nix b/modules/ncli.nix index 8ab7f24..cb07d53 100644 --- a/modules/ncli.nix +++ b/modules/ncli.nix @@ -2,6 +2,7 @@ pkgs, host, backupFiles ? [ ".config/mimeapps.list.backup" ], + project, ... }: let backupFilesString = pkgs.lib.strings.concatStringsSep " " backupFiles; @@ -11,7 +12,7 @@ in set -euo pipefail # --- Configuration --- - PROJECT="NixOS" + PROJECT="${project}" HOST="${host}" BACKUP_FILES_STR="${backupFilesString}" VERSION="2.0.0" diff --git a/modules/zsh.nix b/modules/zsh.nix index 51ff160..cea9375 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,6 +1,11 @@ -{ config, pkgs, username, ... }: { +{ config, pkgs, username, project, ... }: { programs.zsh = { enable = true; + enableCompletion = true; + autosuggestions = { + enable = true; + highlightStyle = "fg=242"; # Lighter gray shadow (0-255 scale) + }; ohMyZsh = { enable = true; @@ -8,7 +13,7 @@ }; shellInit = '' - source /home/${username}/NixOS/other/aliases + source /home/${username}/${project}/other/aliases eval "$(${pkgs.zoxide}/bin/zoxide init zsh --cmd cd)" ''; @@ -26,5 +31,6 @@ pkgs.zsh-powerlevel10k pkgs.zsh-syntax-highlighting pkgs.zsh-autocomplete + pkgs.zsh-autosuggestions ]; } diff --git a/plasma/autostart.nix b/plasma/autostart.nix index 3bdef6b..c3de6a7 100644 --- a/plasma/autostart.nix +++ b/plasma/autostart.nix @@ -1,4 +1,4 @@ -{ config, pkgs, username, ... }: +{ config, pkgs, username, project, ... }: { #To show logs of services run: journalctl --user-unit={service-name} --user @@ -9,7 +9,7 @@ #after = [ "plasma-desktop.service" ]; wantedBy = [ "graphical-session.target" ]; serviceConfig = { - ExecStart = [ "/run/current-system/sw/bin/plasma-apply-wallpaperimage /home/${username}/NixOS/other/wallpaper2.png" ]; + ExecStart = [ "/run/current-system/sw/bin/plasma-apply-wallpaperimage /home/${username}/${project}/other/wallpaper2.png" ]; Type = "oneshot"; Restart = "on-failure"; @@ -34,7 +34,7 @@ systemd.user.services.theme-set-reminder = { enable = true; - description = "Remind the user to apply the custom Plasma Theme shipped with this NixOS"; + description = "Remind the user to apply the custom Plasma Theme shipped with this install"; after = [ "graphical-session.target" ]; wantedBy = [ "graphical-session.target" ]; serviceConfig = { diff --git a/plasma/plasma.nix b/plasma/plasma.nix index 2088521..1904902 100644 --- a/plasma/plasma.nix +++ b/plasma/plasma.nix @@ -1,4 +1,4 @@ -{config, pkgs, username, ...}: +{config, pkgs, username, project, ...}: let # Define the custom background package with the correct relative path background-package = pkgs.stdenvNoCC.mkDerivation { @@ -71,8 +71,8 @@ in #}; system.activationScripts.script.text = '' - source /home/cookiez/NixOS/other/colors.sh - source /home/cookiez/NixOS/other/pfp.sh + source /home/${username}/${project}/other/colors.sh + source /home/${username}/${project}/other/pfp.sh ''; #services.displayManager.sddm = {