Structural changes

This commit is contained in:
BalrajSinghGidda
2026-03-19 19:29:13 +05:30
parent d5d03a360f
commit c35ea37806
20 changed files with 349 additions and 534 deletions

View File

@@ -1,97 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $(basename "$0") <project-name>
Creates a folder <project-name> with a flake exposing a C++ devshell.
Includes gcc, clang, cmake, ninja, gdb, ccache, pkg-config, boost.
Example:
make-cpp-devshell mycppproj
EOF
exit 1
}
if [ $# -lt 1 ]; then usage; fi
proj="$1"
if [ -d "$proj" ]; then
echo "error: directory '$proj' already exists" >&2
exit 1
fi
mkdir -p "$proj"
cd "$proj"
# write .envrc (direnv + hide diff + use flake)
cat > .envrc <<'EOF'
export DIRENV_HIDE_ENV_DIFF=1
use flake
EOF
# write README
cat > README.md <<EOF
# $proj (C++ devshell)
Enter the shell with:
\`\`\`
nix develop .#cpp
\`\`\`
Typical build steps:
\`\`\`
cmake -S . -B build -G Ninja
cmake --build build
\`\`\`
EOF
# generate flake.nix
cat > flake.nix <<'EOF'
{
description = "Dev shell: C++ (cmake, ninja, gcc/clang)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
devShells.default = pkgs.mkShell {
name = "cpp-devshell";
buildInputs = [
pkgs.gcc
pkgs.clang
pkgs.cmake
pkgs.ninja
pkgs.gdb
pkgs.ccache
pkgs.pkg-config
pkgs.boost
];
nativeBuildInputs = [ pkgs.stdenv.cc ];
shellHook = ''
export CC=gcc
export CXX=g++
clear
echo "🔧 C++ devshell ready — gcc/clang, cmake, ninja, gdb, ccache"
'';
};
});
}
EOF
git init -q
git add -A
git commit -qm "init: cpp devshell" || true
echo "Created C++ devshell project '$proj'."
echo "cd $proj && direnv allow && nix develop .#cpp"

View File

@@ -1,127 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $(basename "$0") <project-name> [py-ver] [extra-pkgs...]
Creates a folder <project-name> with a flake exposing a Python devshell.
Arguments:
project-name directory to create
py-ver python version, e.g. 3.11 (default: 3.11)
extra-pkgs extra python packages from nixpkgs pythonPackages (space-separated)
Example:
make-py-devshell myproj 3.11 numpy pandas
EOF
exit 1
}
if [ $# -lt 1 ]; then usage; fi
proj="$1"
shift || true
py_ver="${1:-3.11}"
if [ $# -ge 1 ]; then
# if user supplied py_ver explicitly (pos 2), shift it out
if [[ "$1" =~ ^[0-9]+\.[0-9]+$ ]]; then
py_ver="$1"
shift
fi
fi
extra_py_pkgs=( "$@" )
if [ -d "$proj" ]; then
echo "error: directory '$proj' already exists" >&2
exit 1
fi
mkdir -p "$proj"
cd "$proj"
# write .envrc (direnv + hide diff + use flake)
cat > .envrc <<'EOF'
export DIRENV_HIDE_ENV_DIFF=1
use flake
EOF
# write README
cat > README.md <<EOF
# $proj (Python devshell)
Enter the shell with:
\`\`\`
nix develop .#python
\`\`\`
Enable flakes if needed: add to /etc/nix/nix.conf
\`experimental-features = nix-command flakes\`
EOF
# compute python attr name like python311 from 3.11
py_attr="python${py_ver//./}"
# make python package list for withPackages: ps.<pkg>
py_list=""
for p in "${extra_py_pkgs[@]}"; do
safe="$(echo "$p" | sed 's/[^a-zA-Z0-9_.-]/_/g')"
py_list="$py_list
ps.$safe"
done
# generate flake.nix
cat > flake.nix <<EOF
{
description = "Dev shell: python (${py_ver})";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
pythonAttr = pkgs.${py_attr};
pythonEnv = pythonAttr.withPackages (ps: with ps; [
pytest
black
euporie
mypy
pip
setuptools
wheel
$py_list
]);
in {
devShells.default = pkgs.mkShell {
name = "python-devshell";
buildInputs = [
pythonEnv
pkgs.poetry
pkgs.git
pkgs.ripgrep
pkgs.gdb
];
shellHook = ''
export VIRTUAL_ENV_DISABLE_PROMPT=1
clear
echo "📦 Python devshell active — python ${py_ver}"
echo "Use: python, pip, pytest, black, euporie, mypy, poetry"
'';
};
});
}
EOF
git init -q
git add -A
git commit -qm "init: python devshell (${py_ver})" || true
echo "Created Python devshell project '$proj'."
echo "cd $proj && direnv allow && nix develop .#python"

View File

@@ -1,165 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos-btw";
networking.networkmanager.enable = true;
time.timeZone = "Asia/Kolkata";
services.xserver = {
enable = true;
autoRepeatDelay = 200;
autoRepeatInterval = 35;
windowManager.qtile.enable = true;
displayManager.sessionCommands = ''
xwallpaper --zoom /etc/walls/nix.png'';
};
services.displayManager.ly = {
enable = true;
settings = {
animation = "matrix";
bigclock = true;
};
};
nixpkgs.config.allowUnfree = true;
services.printing.enable = true;
services.printing.drivers = [ pkgs.cnijfilter2 ];
programs.bash.completion.enable = true;
programs.bash.blesh.enable = true;
services.pipewire = {
enable = true;
pulse.enable = true;
};
services.libinput.enable = true;
xdg.portal = {
enable = true;
config.common.default = [ "*" ];
};
services.flatpak.enable = true;
services.tailscale.enable = true;
users.users.balraj = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
tree
];
};
programs.firefox.enable = true;
boot.kernelModules = [
"dell-wmi"
"dell-wmi-sysman"
"dell-smbios"
"dell-wmi-descriptor"
"video"
"sparse-keymap"
];
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
environment.systemPackages = with pkgs; [
vim
wget
nitch
git
lazygit
gh
kitty
unzip
neovim
zellij
tmux
picom
rofi
redis
xwallpaper
oh-my-posh
brightnessctl
pamixer
udisks2
eject
direnv
libnotify
dunst
maim
slop
xbindkeys
alsa-utils
libinput
blueman
bluez
xclip
xcb-util-cursor
libreoffice
feh
];
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
corefonts
vista-fonts
nerd-fonts.lilex
nerd-fonts.ubuntu
];
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
hardware.bluetooth.settings = {
General = {
Experimental = true;
};
};
services.blueman.enable = true;
services.picom = {
enable = true;
backend = "glx";
vSync = true;
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.openssh.enable = true;
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;
system.stateVersion = "25.11";
}

View File

@@ -1,28 +1,29 @@
{
description = "NixOS on Dell Latitude 7490";
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.11";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, ... } : {
nixosConfigurations.nixos-btw = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.balraj = import ./home.nix;
backupFileExtension = "backup";
};
}
];
};
};
}
description = "NixOS on Dell Latitude 7490";
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.11";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, ... }: {
nixosConfigurations.nixos-btw = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/nixos-btw
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.balraj = import ./hosts/nixos-btw/home.nix;
backupFileExtension = "backup";
};
}
];
};
};
}

118
home.nix
View File

@@ -1,118 +0,0 @@
{ config, pkgs, ... }:
let
dotfiles = "${config.home.homeDirectory}/nixos-dotfiles/config";
bin = "${config.home.homeDirectory}/nixos-dotfiles/bin";
create_symlink = path: config.lib.file.mkOutOfStoreSymlink path;
configs = {
nvim = "nvim";
qtile = "qtile";
rofi = "rofi";
picom = "picom";
kitty = "kitty";
};
in
{
home.username = "balraj";
home.homeDirectory = "/home/balraj";
home.stateVersion = "25.05";
programs.bash = {
enable = true;
# bashmount.enable = true;
enableCompletion = true;
shellAliases = {
nc = "nvim ~/nixos-dotfiles/.";
btw = "echo I use NixOS, btw";
nrs = "sudo nixos-rebuild switch --flake ~/nixos-dotfiles/#nixos-btw";
edit-config = "nvim ~/nixos-dotfiles/configuration.nix";
edit-home-config = "nvim ~/nixos-dotfiles/home.nix";
make-py-devshell = "bash ${bin}/make-py-devshell";
make-cpp-devshell = "bash ${bin}/make-cpp-devshell";
ls = "eza --long -ahF --no-user --no-permissions --git --icons=always --color=always --grid";
cd = "z";
bm = "bashmount";
};
historyIgnore = [
"ls"
"exit"
];
bashrcExtra = ''
export PS1="\[\e[38;5;75m\]\u@\h \[\e[38;5;113m\]\w \[\e[38;5;189m\]\$ \[\e[0m\]"
export MANPAGER="nvim +Man!"
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow'
eval "$(direnv hook bash)"
eval "$(zoxide init bash)"
nitch
'';
};
programs.git = {
enable = true;
settings.user.name = "BalrajSinghGidda";
settings.user.email = "anonystargamerz@gmail.com";
};
programs.gh = {
enable = true;
gitCredentialHelper = {
enable = true;
hosts = [
"https://github.com"
"https://gist.github.com"
];
};
settings = {
git_protocol = "https";
prompt = "enable";
editor = "nvim";
};
};
programs.gemini-cli = {
enable = true;
settings = {
"theme" = "Default";
"preferredEditor" = "nvim";
"autoAccept" = true;
};
defaultModel = "gemini-2.5-pro";
};
xdg.configFile = builtins.mapAttrs
(name: subpath: {
source = create_symlink "${dotfiles}/${subpath}";
recursive = true;
})
configs;
# xdg.configFile."qtile" = {
# source = create_symlink "${dotfiles}/qtile";
# recursive = true;
#
# (pkgs.writeShellApplication {
# name = "ns";
# runtimeInputs = with pkgs; [
# fzf
# nix-search-tv
# ];
# text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh";
# })
#
# VV
home.packages = with pkgs; [
ripgrep
nil
nixpkgs-fmt
nodejs
gcc
yazi
flatpak
eza
zoxide
python313Packages.euporie
];
}

View File

@@ -0,0 +1,6 @@
{
imports = [
./hardware-configuration.nix
../../modules/nixos
];
}

View File

@@ -0,0 +1,14 @@
{ pkgs, ... }:
let
wallpapers = pkgs.callPackage ../../pkgs/wallpapers.nix {};
in
{
imports = [
./configuration.nix
./hardware-configuration.nix
../../modules/nixos
];
environment.systemPackages = [ wallpapers ];
}

19
hosts/nixos-btw/home.nix Normal file
View File

@@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
imports = [
../../modules/home-manager
];
home.username = "balraj";
home.homeDirectory = "/home/balraj";
home.stateVersion = "25.05";
# This is the idiomatic way to manage dotfiles in Home Manager.
# It will copy the files to the Nix store and then link them to the correct location in ~/.config.
xdg.configFile."nvim".source = ../../config/nvim;
xdg.configFile."qtile".source = ../../config/qtile;
xdg.configFile."rofi".source = ../../config/rofi;
xdg.configFile."picom".source = ../../config/picom;
xdg.configFile."kitty".source = ../../config/kitty;
}

View File

@@ -0,0 +1,30 @@
{ pkgs, ... }:
let
custom-scripts = pkgs.callPackage ../../pkgs/custom-scripts.nix {};
in
{
programs.gemini-cli = {
enable = true;
settings = {
"theme" = "Default";
"preferredEditor" = "nvim";
"autoAccept" = true;
};
defaultModel = "gemini-2.5-pro";
};
home.packages = with pkgs; [
ripgrep
nil
nixpkgs-fmt
nodejs
gcc
yazi
flatpak
eza
zoxide
python313Packages.euporie
custom-scripts
];
}

View File

@@ -0,0 +1,7 @@
{
imports = [
./apps.nix
./git.nix
./shell.nix
];
}

View File

@@ -0,0 +1,19 @@
{ pkgs, ... }:
{
programs.git = {
enable = true;
userName = "BalrajSinghGidda";
userEmail = "anonystargamerz@gmail.com";
};
programs.gh = {
enable = true;
gitCredentialHelper.enable = true;
settings = {
git_protocol = "https";
prompt = "enable";
editor = "nvim";
};
};
}

View File

@@ -0,0 +1,30 @@
{ pkgs, ... }:
{
programs.bash = {
enable = true;
enableCompletion = true;
shellAliases = {
nc = "nvim ~/nixos-dotfiles/.";
btw = "echo I use NixOS, btw";
nrs = "sudo nixos-rebuild switch --flake ~/nixos-dotfiles/#nixos-btw";
edit-config = "nvim ~/nixos-dotfiles/configuration.nix";
edit-home-config = "nvim ~/nixos-dotfiles/home.nix";
ls = "eza --long -ahF --no-user --no-permissions --git --icons=always --color=always --grid";
cd = "z";
bm = "bashmount";
};
historyIgnore = [
"ls"
"exit"
];
bashrcExtra = ''
export PS1="\[\e[38;5;75m\]\u@\h \[\e[38;5;113m\]\w \[\e[38;5;189m\]\$ \[\e[0m\]"
export MANPAGER="nvim +Man!"
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow'
eval "$(direnv hook bash)"
eval "$(zoxide init bash)"
nitch
'';
};
}

39
modules/nixos/core.nix Normal file
View File

@@ -0,0 +1,39 @@
{ pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos-btw";
networking.networkmanager.enable = true;
time.timeZone = "Asia/Kolkata";
nixpkgs.config.allowUnfree = true;
programs.bash.completion.enable = true;
programs.bash.blesh.enable = true;
programs.firefox.enable = true;
boot.kernelModules = [
"dell-wmi"
"dell-wmi-sysman"
"dell-smbios"
"dell-wmi-descriptor"
"video"
"sparse-keymap"
];
users.users.balraj = {
isNormalUser = true;
extraGroups = [ "wheel" "networking" ];
packages = with pkgs; [
tree
];
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
system.stateVersion = "25.11";
}

View File

@@ -0,0 +1,7 @@
{
imports = [
./core.nix
./packages.nix
./services.nix
];
}

View File

@@ -0,0 +1,54 @@
{ pkgs, ... }:
let
wallpapers = (pkgs.callPackage ../../pkgs/wallpapers.nix {});
in
{
environment.systemPackages = with pkgs; [
vim
wget
nitch
git
lazygit
gh
kitty
unzip
neovim
zellij
tmux
picom
rofi
redis
xwallpaper
oh-my-posh
brightnessctl
pamixer
udisks2
eject
direnv
libnotify
dunst
maim
slop
xbindkeys
alsa-utils
libinput
blueman
bluez
xclip
xcb-util-cursor
libreoffice
feh
wallpapers
];
fonts.fontDir.enable = true;
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
corefonts
vista-fonts
nerd-fonts.lilex
nerd-fonts.ubuntu
];
}

View File

@@ -0,0 +1,75 @@
{ pkgs, ... }:
{
services.xserver = {
enable = true;
autoRepeatDelay = 200;
autoRepeatInterval = 35;
windowManager.qtile.enable = true;
displayManager.sessionCommands = ''
xwallpaper --zoom /run/current-system/sw/share/wallpapers/nix.png'';
};
services.displayManager.ly = {
enable = true;
settings = {
animation = "matrix";
bigclock = true;
};
};
services.printing.enable = true;
services.printing.drivers = [ pkgs.cnijfilter2 ];
services.pipewire = {
enable = true;
pulse.enable = true;
};
services.libinput.enable = true;
xdg.portal = {
enable = true;
config.common.default = [ "*" ];
};
services.flatpak.enable = true;
services.tailscale.enable = true;
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
hardware.bluetooth.settings = {
General = {
Experimental = true;
};
};
services.blueman.enable = true;
services.picom = {
enable = true;
backend = "glx";
vSync = true;
};
services.openssh.enable = true;
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;
}

11
pkgs/custom-scripts.nix Normal file
View File

@@ -0,0 +1,11 @@
{ stdenv }:
stdenv.mkDerivation {
name = "custom-scripts";
src = ../bin;
installPhase = ''
mkdir -p $out/bin
cp -r $src/* $out/bin/
chmod +x $out/bin/*
'';
}

0
pkgs/default.nix Normal file
View File

10
pkgs/wallpapers.nix Normal file
View File

@@ -0,0 +1,10 @@
{ stdenv }:
stdenv.mkDerivation {
name = "wallpapers";
src = ../extras/Pictures;
installPhase = ''
mkdir -p $out/share/wallpapers
cp -r $src/* $out/share/wallpapers/
'';
}