Merge remote-tracking branch 'origin/main' into separate-big-files
This commit is contained in:
@ -18,15 +18,24 @@
|
||||
...
|
||||
}: {
|
||||
#Assign Swap to the PC
|
||||
#swapDevices = [{
|
||||
# device = "/swapfile";
|
||||
# size = 16 * 1024; # 16GB
|
||||
#}];
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/swapfile";
|
||||
size = 34 * 1024; # 34GB
|
||||
#randomEncryption.enable = true; #Doesnt work with hybernation
|
||||
}
|
||||
];
|
||||
nix = {
|
||||
settings.nix-path = config.nix.nixPath;
|
||||
nixPath = ["nixpkgs=${inputs.nixpkgs}"];
|
||||
};
|
||||
|
||||
imports = [
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.grub2-themes.nixosModules.default
|
||||
inputs.nix-flatpak.nixosModules.nix-flatpak
|
||||
inputs.aagl.nixosModules.default
|
||||
./hardware-configuration.nix
|
||||
|
||||
./firefox
|
||||
@ -38,8 +47,10 @@
|
||||
|
||||
# Bootloader.
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelParams = ["quiet" "splash"];
|
||||
initrd = {
|
||||
systemd.enable = true; #For swap to automatically work
|
||||
verbose = false;
|
||||
kernelModules = ["amdgpu"];
|
||||
};
|
||||
@ -124,22 +135,6 @@
|
||||
|
||||
# List services that you want to enable:
|
||||
services = {
|
||||
ollama = {
|
||||
enable = false;
|
||||
# Optional: load models on startup
|
||||
#loadModels = [ ... ];
|
||||
};
|
||||
|
||||
open-webui = {
|
||||
enable = true;
|
||||
package = pkgs.open-webui;
|
||||
#environment = {
|
||||
# DATA_DIR = "/var/lib/open-webui"; # System-wide writable dir
|
||||
# OLLAMA_API_BASE_URL = "http://127.0.0.1:11434";
|
||||
#};
|
||||
#openFirewall = true;
|
||||
};
|
||||
|
||||
fprintd.enable = true;
|
||||
fprintd.tod.enable = true;
|
||||
fprintd.tod.driver = pkgs.libfprint-2-tod1-goodix;
|
||||
@ -198,6 +193,8 @@
|
||||
};
|
||||
|
||||
fonts = {
|
||||
fontDir.enable = true;
|
||||
|
||||
packages = with pkgs; [
|
||||
font-awesome
|
||||
nerd-fonts.jetbrains-mono
|
||||
@ -222,10 +219,42 @@
|
||||
programs = {
|
||||
steam.enable = true;
|
||||
|
||||
gamemode.enable = true;
|
||||
|
||||
gamescope.enable = true;
|
||||
|
||||
nix-index-database.comma.enable = true;
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
silent = true; # Suppresses direnv's output in the terminal
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
ssh.askPassword = lib.mkForce "${pkgs.kdePackages.ksshaskpass}/bin/ksshaskpass";
|
||||
|
||||
sleepy-launcher.enable = true; #Zenless zone zero launcher
|
||||
|
||||
#In order for dynamically linked executables to work
|
||||
nix-ld.enable = true;
|
||||
nix-ld = {
|
||||
enable = true;
|
||||
#To ensure that the neccesary libraries are included in the wrapper
|
||||
libraries = with pkgs; [
|
||||
wayland
|
||||
libadwaita
|
||||
gtk4
|
||||
gtk3
|
||||
glib
|
||||
gdk-pixbuf
|
||||
pango
|
||||
cairo
|
||||
libGL
|
||||
openssl
|
||||
dbus
|
||||
fontconfig
|
||||
freetype
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Configure console keymap
|
||||
@ -276,7 +305,7 @@
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
description = "Cookiez";
|
||||
extraGroups = ["networkmanager" "wheel" "docker"];
|
||||
extraGroups = ["networkmanager" "wheel" "docker" "gamemode"];
|
||||
packages = with pkgs; [
|
||||
#User Packages Here
|
||||
];
|
||||
@ -290,7 +319,7 @@
|
||||
# dockerCompat = true;
|
||||
#};
|
||||
|
||||
waydroid.enable = true;
|
||||
waydroid.enable = false;
|
||||
};
|
||||
|
||||
environment = {
|
||||
@ -341,7 +370,16 @@
|
||||
};
|
||||
|
||||
#Allow Nix Commands
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
nix.settings = {
|
||||
experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
max-substitution-jobs = 32;
|
||||
http-connections = 50;
|
||||
|
||||
#Both needed for sleepy-launcher to work
|
||||
extra-substituters = ["https://ezkea.cachix.org" "https://nix-community.cachix.org"];
|
||||
extra-trusted-public-keys = ["ezkea.cachix.org-1:ioBmUbJTZIKsHmWWXPe1FSFbeVe+afhfgqgTSNd34eI=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="];
|
||||
};
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@ -59,11 +59,6 @@
|
||||
noDisplay = true;
|
||||
};
|
||||
|
||||
desktopEntries."org.kde.kmenuedit" = {
|
||||
name = "Menu Editor";
|
||||
noDisplay = true;
|
||||
};
|
||||
|
||||
desktopEntries."micro" = {
|
||||
name = "Micro";
|
||||
noDisplay = true;
|
||||
@ -107,10 +102,5 @@
|
||||
name = "KWrite";
|
||||
noDisplay = true;
|
||||
};
|
||||
|
||||
desktopEntries."org.kde.discover" = {
|
||||
name = "Discover";
|
||||
noDisplay = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
enable = true;
|
||||
profiles = {
|
||||
"${username}" = {
|
||||
isDefault = true;
|
||||
extensions.force = true;
|
||||
|
||||
#Create multiple containers, like "work" "social media" ..., for cookies to reside in so they dont cross leak
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
".config/gtk-4.0/settings.ini.backup"
|
||||
".config/niri/config.kdl"
|
||||
];
|
||||
devTemplate = ../other/dev-template.nix;
|
||||
})
|
||||
];
|
||||
|
||||
@ -55,6 +56,12 @@
|
||||
#];
|
||||
};
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
kitty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
433
modules/ncli.nix
433
modules/ncli.nix
@ -15,7 +15,7 @@ in
|
||||
PROJECT="${project}"
|
||||
HOST="${host}"
|
||||
BACKUP_FILES_STR="${backupFilesString}"
|
||||
VERSION="2.0.0"
|
||||
VERSION="2.1.3"
|
||||
FLAKE_NIX_PATH="$HOME/$PROJECT/flake.nix"
|
||||
|
||||
read -r -a BACKUP_FILES <<< "$BACKUP_FILES_STR"
|
||||
@ -45,6 +45,11 @@ in
|
||||
echo " pull - Pull latest changes from origin."
|
||||
echo " status - Show git status."
|
||||
echo ""
|
||||
echo "Development Commands:"
|
||||
echo " dev - Initialize a Nix development environment (flake.nix + direnv)."
|
||||
echo " dev track - Remove assume-unchanged flag from flake files."
|
||||
echo " dev untrack - Mark flake files as assume-unchanged in a directory."
|
||||
echo ""
|
||||
echo " help - Show this help message."
|
||||
echo ""
|
||||
}
|
||||
@ -65,7 +70,53 @@ in
|
||||
done
|
||||
}
|
||||
|
||||
# --- Main Logic ---
|
||||
# --- Dev Init Helper Functions ---
|
||||
print_header() {
|
||||
echo ""
|
||||
echo -e "''${BLUE}==============================================''${NOCOLOR}"
|
||||
echo -e "''${BLUE} Nix Flake Development Environment Initializer''${NOCOLOR}"
|
||||
echo -e "''${BLUE}==============================================''${NOCOLOR}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "''${GREEN}[OK]''${NOCOLOR} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "''${RED}[ERR]''${NOCOLOR} $1"
|
||||
}
|
||||
|
||||
print_info() {
|
||||
echo -e "''${YELLOW}[->]''${NOCOLOR} $1"
|
||||
}
|
||||
|
||||
handle_build_error() {
|
||||
local exit_code=$?
|
||||
# Exit code 137 = 128+9 = SIGKILL, almost always OOM killer
|
||||
if [ "$exit_code" -eq 137 ]; then
|
||||
echo ""
|
||||
echo -e "''${RED}╔══════════════════════════════════════════════════════════╗''${NOCOLOR}"
|
||||
echo -e "''${RED}║ BUILD KILLED — Signal 9 (SIGKILL) detected ║''${NOCOLOR}"
|
||||
echo -e "''${RED}╚══════════════════════════════════════════════════════════╝''${NOCOLOR}"
|
||||
echo ""
|
||||
echo -e "''${YELLOW}What happened:''${NOCOLOR}"
|
||||
echo " The build process was forcefully terminated by the OS."
|
||||
echo " This is almost always the Linux kernel OOM killer running out"
|
||||
echo " of RAM + swap during Nix evaluation or compilation."
|
||||
echo ""
|
||||
echo -e "''${YELLOW}Suggested fixes (try in order):''${NOCOLOR}"
|
||||
echo ""
|
||||
echo -e " ''${GREEN}1. Reduce parallel jobs''${NOCOLOR} (lowest RAM usage):"
|
||||
echo " sudo nixos-rebuild switch --flake . --max-jobs 1 --cores 1"
|
||||
echo ""
|
||||
echo -e " ''${GREEN}2. Confirm OOM killer fired:''${NOCOLOR}"
|
||||
echo " journalctl -k --since '5 minutes ago' | grep -i oom"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Main Logic ---
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Error: No command provided." >&2
|
||||
print_help
|
||||
@ -138,7 +189,8 @@ in
|
||||
current=$(cat /etc/nixos-tags)
|
||||
fi
|
||||
|
||||
if sudo nixos-rebuild switch --flake .; then
|
||||
sudo nixos-rebuild switch --flake . ; _rebuild_exit=$?
|
||||
if [ "$_rebuild_exit" -eq 0 ]; then
|
||||
echo "✓ Rebuild finished successfully for $HOST"
|
||||
|
||||
if [ -n "$current" ]; then
|
||||
@ -151,6 +203,7 @@ in
|
||||
echo -e "Running on new generation: $YELLOW $geno $NOCOLOR-> $GREEN$genn$NOCOLOR"
|
||||
|
||||
else
|
||||
( exit "$_rebuild_exit" ); handle_build_error
|
||||
echo "✗ Rebuild failed for $HOST" >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -232,7 +285,8 @@ in
|
||||
echo "Rebuilding system... Staying on current specialization"
|
||||
fi
|
||||
|
||||
if sudo nixos-rebuild switch --flake .; then
|
||||
sudo nixos-rebuild switch --flake . ; _rebuild_exit=$?
|
||||
if [ "$_rebuild_exit" -eq 0 ]; then
|
||||
echo "✓ Update and rebuild finished successfully for $HOST"
|
||||
|
||||
if [ -n "$current" ]; then
|
||||
@ -245,6 +299,7 @@ in
|
||||
echo -e "Running on new generation: $YELLOW $geno $NOCOLOR-> $GREEN$genn$NOCOLOR"
|
||||
|
||||
else
|
||||
( exit "$_rebuild_exit" ); handle_build_error
|
||||
echo "✗ Update and rebuild failed for $HOST" >&2
|
||||
exit 1
|
||||
fi
|
||||
@ -327,6 +382,376 @@ in
|
||||
echo "Trim operation cancelled."
|
||||
fi
|
||||
;;
|
||||
dev)
|
||||
# Only flake files need assume-unchanged (Nix requires them in the index).
|
||||
# .envrc and .direnv are handled via .git/info/exclude instead.
|
||||
DEV_FILES=(flake.nix flake.lock)
|
||||
DIRENV_LOCAL_FILES=(.envrc .direnv)
|
||||
|
||||
_dev_resolve_dir() {
|
||||
read -rp " Enter target directory [./]: " TARGET_DIR
|
||||
TARGET_DIR="''${TARGET_DIR:-./}"
|
||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||
print_error "Directory '$TARGET_DIR' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
TARGET_ABS="$(cd "$TARGET_DIR" && pwd)"
|
||||
if ! git -C "$TARGET_ABS" rev-parse --git-dir > /dev/null 2>&1; then
|
||||
print_error "No Git repository found at '$TARGET_ABS'."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Add .envrc and .direnv to .git/info/exclude (local-only, never committed).
|
||||
_add_local_excludes() {
|
||||
local repo_abs="$1"
|
||||
local git_dir exclude_file
|
||||
git_dir="$(git -C "$repo_abs" rev-parse --git-dir)"
|
||||
exclude_file="$git_dir/info/exclude"
|
||||
mkdir -p "$(dirname "$exclude_file")"
|
||||
touch "$exclude_file"
|
||||
|
||||
for entry in "''${DIRENV_LOCAL_FILES[@]}"; do
|
||||
if ! grep -qxF "$entry" "$exclude_file" 2>/dev/null; then
|
||||
echo "$entry" >> "$exclude_file"
|
||||
print_success "$entry → ignored via .git/info/exclude (local only)"
|
||||
else
|
||||
print_info "$entry already in .git/info/exclude, skipping."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_remove_local_excludes() {
|
||||
local repo_abs="$1"
|
||||
local git_dir exclude_file tmp_file
|
||||
git_dir="$(git -C "$repo_abs" rev-parse --git-dir)"
|
||||
exclude_file="$git_dir/info/exclude"
|
||||
|
||||
[[ -f "$exclude_file" ]] || return 0
|
||||
|
||||
tmp_file="$(mktemp)"
|
||||
cp "$exclude_file" "$tmp_file"
|
||||
|
||||
for entry in "''${DIRENV_LOCAL_FILES[@]}"; do
|
||||
if grep -qxF "$entry" "$tmp_file" 2>/dev/null; then
|
||||
grep -vxF "$entry" "$tmp_file" > "''${tmp_file}.new" || true
|
||||
mv "''${tmp_file}.new" "$tmp_file"
|
||||
print_success "$entry → removed from .git/info/exclude"
|
||||
else
|
||||
print_info "$entry not present in .git/info/exclude, skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
mv "$tmp_file" "$exclude_file"
|
||||
}
|
||||
|
||||
case "''${2:-init}" in
|
||||
|
||||
untrack)
|
||||
echo ""
|
||||
echo -e "''${BLUE}--- Dev: Track Files (assume-unchanged) ---''${NOCOLOR}"
|
||||
echo ""
|
||||
_dev_resolve_dir
|
||||
|
||||
acted=false
|
||||
for f in "''${DEV_FILES[@]}"; do
|
||||
full="$TARGET_ABS/$f"
|
||||
if [[ ! -f "$full" ]]; then
|
||||
print_info "$f not found in $TARGET_ABS — skipping."
|
||||
continue
|
||||
fi
|
||||
if ! git -C "$TARGET_ABS" ls-files --error-unmatch "$f" > /dev/null 2>&1; then
|
||||
git -C "$TARGET_ABS" add --intent-to-add "$f"
|
||||
fi
|
||||
git -C "$TARGET_ABS" update-index --assume-unchanged "$f"
|
||||
print_success "$f → untracked (assume-unchanged)"
|
||||
acted=true
|
||||
done
|
||||
|
||||
_add_local_excludes "$TARGET_ABS"
|
||||
|
||||
if ! $acted; then
|
||||
print_info "No dev files found in '$TARGET_ABS' to track."
|
||||
fi
|
||||
;;
|
||||
|
||||
track)
|
||||
echo ""
|
||||
echo -e "''${BLUE}--- Dev: Untrack Files (remove assume-unchanged) ---''${NOCOLOR}"
|
||||
echo ""
|
||||
_dev_resolve_dir
|
||||
|
||||
acted=false
|
||||
for f in "''${DEV_FILES[@]}"; do
|
||||
if git -C "$TARGET_ABS" ls-files -v "$f" 2>/dev/null | grep -q "^h "; then
|
||||
git -C "$TARGET_ABS" update-index --no-assume-unchanged "$f"
|
||||
print_success "$f → tracked (assume-unchanged removed)"
|
||||
acted=true
|
||||
else
|
||||
print_info "$f is not marked assume-unchanged — skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
_remove_local_excludes "$TARGET_ABS"
|
||||
|
||||
if ! $acted; then
|
||||
print_info "No files in '$TARGET_ABS' had the assume-unchanged bit set."
|
||||
fi
|
||||
;;
|
||||
|
||||
init|*)
|
||||
# ---- Defaults -----
|
||||
SOURCE_FLAKE="$HOME/$PROJECT/other/dev-template.nix"
|
||||
|
||||
# ---- Check source flake exists ------------------------------
|
||||
if [[ ! -f "$SOURCE_FLAKE" ]]; then
|
||||
print_error "Source flake template not found: $SOURCE_FLAKE"
|
||||
echo "Please ensure dev-template.nix exists in $HOME/$PROJECT/other/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_header
|
||||
|
||||
# ---- Step 1: Target Directory -----------------------------------
|
||||
echo -e "''${YELLOW}Step 1/5: Target Directory''${NOCOLOR}"
|
||||
echo ""
|
||||
read -p " Enter target directory [./]: " TARGET_DIR
|
||||
|
||||
if [[ -z "$TARGET_DIR" ]]; then
|
||||
TARGET_DIR="./"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||
print_error "Directory '$TARGET_DIR' does not exist. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_success "Target directory: $TARGET_DIR"
|
||||
echo ""
|
||||
|
||||
# ---- Check for existing flake ----------------------------------
|
||||
if [[ -f "$TARGET_DIR/flake.nix" ]]; then
|
||||
echo ""
|
||||
print_error "A flake.nix already exists in '$TARGET_DIR'!"
|
||||
echo ""
|
||||
read -p " Would you like to just place the .envrc instead? [y/N]: " ENVRC_ONLY
|
||||
ENVRC_ONLY="''${ENVRC_ONLY:-N}"
|
||||
|
||||
if [[ "$ENVRC_ONLY" =~ ^[Yy]$ ]]; then
|
||||
TARGET_ABS="$(cd "$TARGET_DIR" && pwd)"
|
||||
echo ""
|
||||
print_info "Placing .envrc only..."
|
||||
if ! grep -qxF "use flake" "$TARGET_ABS/.envrc" 2>/dev/null; then
|
||||
echo "use flake" >> "$TARGET_ABS/.envrc"
|
||||
print_success ".envrc created at $TARGET_ABS/"
|
||||
else
|
||||
print_info ".envrc already contains 'use flake', nothing to do."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
print_info "Next steps:"
|
||||
echo " cd $TARGET_DIR"
|
||||
echo " direnv allow"
|
||||
echo ""
|
||||
exit 0
|
||||
else
|
||||
print_info "Aborting. No files were changed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---- Step 2: Project Name ---------------------------------------
|
||||
echo -e "''${YELLOW}Step 2/5: Project Name''${NOCOLOR}"
|
||||
echo ""
|
||||
read -p " Enter development environment name [devShell]: " PROJECT_NAME
|
||||
|
||||
if [[ -z "$PROJECT_NAME" ]]; then
|
||||
PROJECT_NAME="devShell"
|
||||
fi
|
||||
|
||||
print_success "Project name: $PROJECT_NAME"
|
||||
echo ""
|
||||
|
||||
# ---- Step 3: Select template ----------------------------------------
|
||||
echo -e "''${YELLOW}Step 3/5: Select Template''${NOCOLOR}"
|
||||
echo ""
|
||||
echo " 1) Empty - Basic shell, add packages yourself"
|
||||
echo " 2) Python - Python 3, pip, venv setup"
|
||||
echo " 3) Node.js - Node.js, npm"
|
||||
echo " 4) Rust - Rustc, cargo, rust-analyzer"
|
||||
echo " 5) Go - Go, gopls, golangci-lint"
|
||||
echo " 6) C/C++ - GCC, CMake, GDB, pkg-config"
|
||||
echo " 7) Java - JDK 21, Maven"
|
||||
echo ""
|
||||
|
||||
read -p " Select template [1-7] (default: 1): " TEMPLATE_CHOICE
|
||||
|
||||
case "$TEMPLATE_CHOICE" in
|
||||
2)
|
||||
TEMPLATE="python3"
|
||||
PACKAGES="python3 python3Packages.pip python3Packages.virtualenv"
|
||||
BUILD_INPUTS=""
|
||||
SHELL_HOOK_EXTRA="
|
||||
# Create venv if it doesn't exist
|
||||
if [ ! -d .venv ]; then
|
||||
echo 'Creating Python virtual environment...'
|
||||
python3 -m venv .venv
|
||||
fi
|
||||
|
||||
# Activate venv
|
||||
source .venv/bin/activate
|
||||
|
||||
echo 'Python venv activated.'
|
||||
"
|
||||
;;
|
||||
3)
|
||||
TEMPLATE="node"
|
||||
PACKAGES="nodejs_22"
|
||||
BUILD_INPUTS=""
|
||||
SHELL_HOOK_EXTRA='echo "Node.js $(node --version) ready."'
|
||||
;;
|
||||
4)
|
||||
TEMPLATE="rust"
|
||||
PACKAGES="rustc cargo rust-analyzer"
|
||||
BUILD_INPUTS="openssl pkg-config"
|
||||
SHELL_HOOK_EXTRA='echo "Rust $(rustc --version) ready."'
|
||||
;;
|
||||
5)
|
||||
TEMPLATE="go"
|
||||
PACKAGES="go gopls golangci-lint"
|
||||
BUILD_INPUTS=""
|
||||
SHELL_HOOK_EXTRA='
|
||||
export GOPATH="$PWD/.gopath"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
mkdir -p "$GOPATH"
|
||||
echo "Go $(go version) ready. GOPATH: $GOPATH"
|
||||
'
|
||||
;;
|
||||
6)
|
||||
TEMPLATE="cpp"
|
||||
PACKAGES="gcc gdb cmake gnumake"
|
||||
BUILD_INPUTS="pkg-config"
|
||||
SHELL_HOOK_EXTRA='echo "GCC $(gcc --version | head -1) ready."'
|
||||
;;
|
||||
7)
|
||||
TEMPLATE="java"
|
||||
PACKAGES="jdk21 maven"
|
||||
BUILD_INPUTS=""
|
||||
SHELL_HOOK_EXTRA='echo "Java $(java --version | head -1) ready."'
|
||||
;;
|
||||
*)
|
||||
TEMPLATE="empty"
|
||||
PACKAGES=""
|
||||
BUILD_INPUTS=""
|
||||
SHELL_HOOK_EXTRA=""
|
||||
;;
|
||||
esac
|
||||
|
||||
print_success "Selected template: $TEMPLATE"
|
||||
echo ""
|
||||
|
||||
# ---- Step 4: Copy and modify flake ----------------------------------
|
||||
echo -e "''${YELLOW}Step 4/5: Generating flake.nix''${NOCOLOR}"
|
||||
echo ""
|
||||
|
||||
cp "$SOURCE_FLAKE" "$TARGET_DIR/flake.nix"
|
||||
print_success "Copied flake.nix to $TARGET_DIR/"
|
||||
|
||||
sed -i "s|name = \"replaceNameHere\";|name = \"''${PROJECT_NAME}\";|" "$TARGET_DIR/flake.nix"
|
||||
print_success "Set project name: $PROJECT_NAME"
|
||||
|
||||
if [[ -n "$PACKAGES" ]]; then
|
||||
sed -i "s|# replacePackagesHere|$PACKAGES|" "$TARGET_DIR/flake.nix"
|
||||
print_success "Added packages: $PACKAGES"
|
||||
fi
|
||||
|
||||
if [[ -n "$BUILD_INPUTS" ]]; then
|
||||
BUILD_INPUTS_LINE="buildInputs = with pkgs; [ $BUILD_INPUTS ];"
|
||||
sed -i "s|# replaceBuildInputsHere|$BUILD_INPUTS_LINE|" "$TARGET_DIR/flake.nix"
|
||||
print_success "Added build inputs: $BUILD_INPUTS"
|
||||
fi
|
||||
|
||||
if [[ -n "$SHELL_HOOK_EXTRA" ]]; then
|
||||
awk -v hook="$SHELL_HOOK_EXTRA" '/# replaceShellHookHere/ { print hook; next } { print }' \
|
||||
"$TARGET_DIR/flake.nix" > "$TARGET_DIR/flake.nix.tmp" \
|
||||
&& mv "$TARGET_DIR/flake.nix.tmp" "$TARGET_DIR/flake.nix"
|
||||
print_success "Added template-specific shell hook"
|
||||
fi
|
||||
|
||||
# ---- Step 5: Git Integration & .envrc --------------------------------
|
||||
echo -e "''${YELLOW}Step 5/5: Git Integration''${NOCOLOR}"
|
||||
echo ""
|
||||
|
||||
TARGET_ABS="$(cd "$TARGET_DIR" && pwd)"
|
||||
|
||||
echo "Creating .envrc for direnv to automatically work!"
|
||||
if ! grep -qxF "use flake" "$TARGET_ABS/.envrc" 2>/dev/null; then
|
||||
echo "use flake" >> "$TARGET_ABS/.envrc"
|
||||
print_success ".envrc created at $TARGET_ABS/"
|
||||
else
|
||||
print_info ".envrc already contains 'use flake', skipping."
|
||||
fi
|
||||
|
||||
if git -C "$TARGET_ABS" rev-parse --git-dir > /dev/null 2>&1; then
|
||||
echo " A Git repository was detected at:"
|
||||
echo " $(git -C "$TARGET_ABS" rev-parse --show-toplevel)"
|
||||
echo ""
|
||||
|
||||
# Always add .envrc and .direnv to local exclude — no prompt needed,
|
||||
# these should never be committed regardless.
|
||||
_add_local_excludes "$TARGET_ABS"
|
||||
echo ""
|
||||
|
||||
echo " Nix flakes require flake.nix (and flake.lock) to be Git-tracked."
|
||||
echo " This script can stage them as 'assume-unchanged' so Nix sees them,"
|
||||
echo " but they will NEVER be committed or show up in git status."
|
||||
echo ""
|
||||
read -p " Set up flake files as tracked-but-invisible to Git? [y/N]: " GIT_CHOICE
|
||||
|
||||
GIT_CHOICE="''${GIT_CHOICE:-N}"
|
||||
|
||||
if [[ "$GIT_CHOICE" =~ ^[Yy]$ ]]; then
|
||||
cat > "$TARGET_ABS/flake.lock" << 'EOF'
|
||||
{
|
||||
"nodes": {
|
||||
"root": {}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
EOF
|
||||
print_success "flake.lock ready (Nix will populate it on first run if empty)"
|
||||
|
||||
git -C "$TARGET_ABS" add --intent-to-add flake.nix flake.lock
|
||||
git -C "$TARGET_ABS" update-index --assume-unchanged flake.nix flake.lock
|
||||
print_success "flake.nix + flake.lock → tracked (assume-unchanged)"
|
||||
else
|
||||
print_info "Skipped. You can do this manually later:"
|
||||
echo ""
|
||||
echo " git -C \"$TARGET_ABS\" add --intent-to-add flake.nix flake.lock"
|
||||
echo " git -C \"$TARGET_ABS\" update-index --assume-unchanged flake.nix flake.lock"
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
print_info "No Git repository detected — skipping Git integration."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# ---- Done ---------------------------------------------------
|
||||
echo -e "''${GREEN}==============================================''${NOCOLOR}"
|
||||
echo -e "''${GREEN} Done! Your flake is ready at:''${NOCOLOR}"
|
||||
echo -e "''${GREEN} $TARGET_DIR/flake.nix''${NOCOLOR}"
|
||||
echo -e "''${GREEN}==============================================''${NOCOLOR}"
|
||||
echo ""
|
||||
print_info "Next steps:"
|
||||
echo " cd $TARGET_DIR"
|
||||
echo " direnv allow # Trust the .envrc so direnv auto-activates"
|
||||
echo " nix develop # Or just: cd out and back in"
|
||||
echo ""
|
||||
;;
|
||||
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Error: Invalid command '$1'" >&2
|
||||
print_help
|
||||
|
||||
@ -7,21 +7,21 @@
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
#CLI tools
|
||||
pdftk #PDF toolkit
|
||||
yt-dlp #YouTube and others video downloader
|
||||
imagemagick #Used as a dependency for Zenless Zone Zero
|
||||
#pdftk #PDF toolkit
|
||||
#yt-dlp #YouTube and others video downloader
|
||||
tailscale #VPN
|
||||
speedtest-cli #Internet speed tester
|
||||
#speedtest-cli #Internet speed tester
|
||||
#duplicati
|
||||
ollama-rocm
|
||||
open-webui
|
||||
cloudflare-warp
|
||||
ddrescue
|
||||
texliveFull #LaTeX PDF maker
|
||||
#open-webui
|
||||
#cloudflare-warp
|
||||
#ddrescue
|
||||
#texliveFull #LaTeX PDF maker
|
||||
lazygit #Git CLI tool with TUI
|
||||
gtypist #Typing tutor
|
||||
powertop #Power consumption monitor and optimizer
|
||||
file #File type identifier
|
||||
hashcat #Password recovery/cracking tool
|
||||
packwiz #A Minecraft modpack editor
|
||||
#gtypist #Typing tutor
|
||||
#powertop #Power consumption monitor and optimizer
|
||||
#file #File type identifier
|
||||
#hashcat #Password recovery/cracking tool
|
||||
#packwiz #A Minecraft modpack editor
|
||||
];
|
||||
}
|
||||
|
||||
@ -4,5 +4,6 @@
|
||||
./cli.nix
|
||||
./essentials.nix
|
||||
./flatpak.nix
|
||||
./overlays.nix
|
||||
];
|
||||
}
|
||||
|
||||
@ -7,58 +7,60 @@
|
||||
}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
#Programming
|
||||
jetbrains.pycharm #The PyCharm IDE to edit Python code
|
||||
jetbrains.idea #The IntelliJ IDE to edit Java code
|
||||
jetbrains.clion #The CLion IDE to edit and compile c/c++ code
|
||||
#jetbrains.pycharm #The PyCharm IDE to edit Python code
|
||||
#jetbrains.idea #The IntelliJ IDE to edit Java code
|
||||
#jetbrains.clion #The CLion IDE to edit and compile c/c++ code
|
||||
jetbrains.datagrip #The DataGrip IDE to manage Databases
|
||||
#jetbrains-toolbox
|
||||
#racket #The racket Programming language, with DrRacket IDE, for University (*Not* because it's my favourite)
|
||||
rustup #Rust Programming Toolchain
|
||||
#rustup #Rust Programming Toolchain
|
||||
#go #Go Programming Language
|
||||
gcc #C/C++ Compiler
|
||||
pkg-config
|
||||
#gcc #C/C++ Compiler
|
||||
#pkg-config
|
||||
vscode #Editor for all kinds of programms
|
||||
nodejs_22 #NodeJS for JavaScript programming
|
||||
#nodejs_22 #NodeJS for JavaScript programming
|
||||
|
||||
#Hochschule
|
||||
postgresql #Database system
|
||||
dbeaver-bin #Database Management Tool
|
||||
sqlite #Lightweight Database system
|
||||
#postgresql #Database system
|
||||
#dbeaver-bin #Database Management Tool
|
||||
#sqlite #Lightweight Database system
|
||||
|
||||
#Desktop Applications
|
||||
mangohud
|
||||
protonup-qt #For managing proton versions
|
||||
drawio
|
||||
ryubing #Nintendo Switch Emulator
|
||||
vlc #VLC Media Player
|
||||
lutris #Gaming Platform
|
||||
mission-center #For a Task Manager like GUI
|
||||
trayscale #Tailscale unofficial GUI
|
||||
spotify #Spotify Music Client
|
||||
rpi-imager #Raspberry Pi Imager
|
||||
#spotify #Spotify Music Client
|
||||
#rpi-imager #Raspberry Pi Imager
|
||||
atlauncher #Minecraft Launcher
|
||||
#discord
|
||||
vesktop #Aternative for discord on Wayland
|
||||
wineWow64Packages.stagingFull
|
||||
winetricks
|
||||
wasistlos #Whatsapp
|
||||
losslesscut-bin #Lossless cut for quckly cutting videos
|
||||
#karere #Whatsapp
|
||||
#losslesscut-bin #Lossless cut for quckly cutting videos
|
||||
#obs-studio #Screen Recorder
|
||||
gparted #Disk partition Manager
|
||||
#rustdesk #Remote Desktop Client
|
||||
realvnc-vnc-viewer #VNC Remote Desktop Client
|
||||
#realvnc-vnc-viewer #VNC Remote Desktop Client
|
||||
eddie #AirVPN desktop client
|
||||
chromium #Chromium browser for Youtube app to work
|
||||
moonlight-qt #Game Streaming Client
|
||||
#moonlight-qt #Game Streaming Client
|
||||
kitty #Kitty Terminal Emulator
|
||||
wmctrl #To Force windows into fullscreen
|
||||
kdePackages.dolphin #KDE File Browser
|
||||
libreoffice-still #Office Suite
|
||||
#libreoffice-still #Office Suite
|
||||
kdePackages.kservice
|
||||
qbittorrent #Torrent Client
|
||||
waydroid #Android emulator on Linux
|
||||
gimp2-with-plugins #Image Editor
|
||||
kdePackages.filelight #Disk Usage Analyzer
|
||||
filezilla
|
||||
audacity
|
||||
freecad
|
||||
#qbittorrent #Torrent Client
|
||||
#waydroid #Android emulator on Linux
|
||||
#gimp2-with-plugins #Image Editor
|
||||
#kdePackages.filelight #Disk Usage Analyzer
|
||||
#filezilla
|
||||
#audacity
|
||||
#freecad
|
||||
];
|
||||
}
|
||||
|
||||
@ -10,22 +10,23 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
#Essentials (CLI Only)
|
||||
wget #A tool for quickly downloading things from the Web
|
||||
javaPackages.compiler.openjdk25 #Java Development Kit 25
|
||||
python314 #Python
|
||||
python314Packages.pip #Pip for Python 3.12
|
||||
python314Packages.cmake #The CMake tool to manage project build configurations
|
||||
#javaPackages.compiler.openjdk25 #Java Development Kit 25
|
||||
#python314 #Python
|
||||
#python314Packages.pip #Pip for Python 3.12
|
||||
#python314Packages.cmake #The CMake tool to manage project build configurations
|
||||
fastfetch #A utility to see information about your machine
|
||||
btop #A replacement for htop to see your machines resources
|
||||
git #Git ... no need to explain
|
||||
efibootmgr #A tool to manage UEFI boot entries
|
||||
#efibootmgr #A tool to manage UEFI boot entries
|
||||
zip #A utility for ZIP archives
|
||||
unzip #A utility for ZIP archives
|
||||
p7zip
|
||||
rar #A utility for RAR archives
|
||||
gnutar #A utility for .tar archives
|
||||
cron #A tool to set up commands to run scheduled
|
||||
tmux #A tool to let command windows contiune to run in the background
|
||||
home-manager #A package to also edit the user Configuration, like with nix
|
||||
konsave #A package to transfer the look and feel of KDE Plasma to other machines
|
||||
#konsave #A package to transfer the look and feel of KDE Plasma to other machines
|
||||
openssh #SSH
|
||||
zoxide #Alternatice to cd, browse files
|
||||
zsh #Search for file names
|
||||
@ -47,7 +48,7 @@
|
||||
pipewire #Multimedia handling
|
||||
fzf #Needed for nix-selective update tool
|
||||
jq #Needed for nix-selective update tool
|
||||
distrobox
|
||||
#distrobox
|
||||
dbus
|
||||
cifs-utils
|
||||
samba
|
||||
|
||||
10
modules/packages/overlays.nix
Normal file
10
modules/packages/overlays.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{...}: {
|
||||
nixpkgs.overlays = [
|
||||
#Skip checks of openldap (dependency for Lutris) as it is already tested enough upstream and is not needed directly
|
||||
(final: prev: {
|
||||
openldap = prev.openldap.overrideAttrs (old: {
|
||||
doCheck = false;
|
||||
});
|
||||
})
|
||||
];
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
# colorTheme.enable = true;
|
||||
# profileNames = [ "${username}" ];
|
||||
#};
|
||||
qt.enable = true;
|
||||
qt.enable = false;
|
||||
qt.platform = "kde";
|
||||
#kde.enable = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user