mirror of
https://github.com/Alexandre1a/NixOSDots.git
synced 2026-03-09 15:59:46 +01:00
Added a import registry to have a centralised path
This commit is contained in:
parent
1afa1d9a11
commit
df843602be
45
gen-regist.sh
Normal file
45
gen-regist.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY="modules/default.nix"
|
||||
|
||||
echo "Generating $REGISTRY …"
|
||||
|
||||
{
|
||||
echo "{"
|
||||
|
||||
echo " common = {"
|
||||
find modules/common -name "*.nix" -maxdepth 1 | sort | while read -r f; do
|
||||
name=$(basename "$f" .nix)
|
||||
echo " $name = ./${f#modules/};"
|
||||
done
|
||||
echo " };"
|
||||
|
||||
echo ""
|
||||
echo " hm = {"
|
||||
find modules/home-manager -name "*.nix" | sort | while read -r f; do
|
||||
name=$(basename "$f" .nix)
|
||||
echo " $name = ./${f#modules/};"
|
||||
done
|
||||
echo " };"
|
||||
|
||||
echo ""
|
||||
echo " nixos = {"
|
||||
find modules/nixos -name "*.nix" | sort | while read -r f; do
|
||||
name=$(basename "$f" .nix)
|
||||
echo " $name = ./${f#modules/};"
|
||||
done
|
||||
echo " };"
|
||||
|
||||
echo ""
|
||||
echo " macos = {"
|
||||
find modules/macos -name "*.nix" | sort | while read -r f; do
|
||||
name=$(basename "$f" .nix)
|
||||
echo " $name = ./${f#modules/};"
|
||||
done
|
||||
echo " };"
|
||||
|
||||
echo "}"
|
||||
} > "$REGISTRY"
|
||||
|
||||
echo "✓ Registry generated at $REGISTRY"
|
||||
@ -1,9 +1,12 @@
|
||||
{config, pkgs, inputs, ...}:
|
||||
|
||||
let
|
||||
modules = import ../../modules;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../common/home.nix
|
||||
../../modules/home-manager/hyprland.nix
|
||||
modules.hm.hyprland.nix
|
||||
];
|
||||
|
||||
home = {
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
modules = import ../../modules;
|
||||
in
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
modules = import ../../modules;
|
||||
in
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
imports = [
|
||||
../common/home.nix
|
||||
../../modules/home-manager/hyprland.nix
|
||||
modules.hm.hyprland.nix
|
||||
];
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
|
||||
30
migrate-regist.sh
Normal file
30
migrate-regist.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
FILES=$(rg "modules/.+\.nix" -l hosts)
|
||||
|
||||
for file in $FILES; do
|
||||
echo "Migrating $file"
|
||||
|
||||
# Skip files that already import registry
|
||||
if rg "import .*modules" "$file" >/dev/null; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Insert let modules = import …
|
||||
sed -i '' '
|
||||
1s|^|let\n modules = import ../../modules;\nin\n|
|
||||
' "$file"
|
||||
|
||||
# Replace common patterns
|
||||
sed -i '' \
|
||||
-e 's|../../modules/common/\([^/]*\)\.nix|modules.common.\1|g' \
|
||||
-e 's|../../modules/home-manager/Hyprland/\([^/]*\)\.nix|modules.hm.\1|g' \
|
||||
-e 's|../../modules/home-manager/\([^/]*\)\.nix|modules.hm.\1|g' \
|
||||
-e 's|../../modules/nixos/\([^/]*\)\.nix|modules.nixos.\1|g' \
|
||||
"$file"
|
||||
|
||||
done
|
||||
|
||||
echo "✓ Migration pass complete"
|
||||
echo "⚠️ Please review files manually and fix edge cases."
|
||||
39
modules/default.nix
Normal file
39
modules/default.nix
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
common = {
|
||||
home = ../hosts/common/home.nix;
|
||||
module = ../../hosts/common/modules.nix;
|
||||
ai = ./common/ai.nix;
|
||||
direnv = ./common/direnv.nix;
|
||||
environment = ./common/environment.nix;
|
||||
nix = ./common/nix.nix;
|
||||
spotify = ./common/spotify.nix;
|
||||
ssh = ./common/ssh.nix;
|
||||
zed2 = ./common/zed2.nix;
|
||||
zed = ./common/zed.nix;
|
||||
};
|
||||
|
||||
hm = {
|
||||
hyprland = ./home-manager/Hyprland/hyprland.nix;
|
||||
scripts = ./home-manager/Hyprland/scripts.nix;
|
||||
shell = ./home-manager/shell.nix;
|
||||
spicetify = ./home-manager/spicetify.nix;
|
||||
zed = ./home-manager/zed.nix;
|
||||
};
|
||||
|
||||
nixos = {
|
||||
bootloader = ./nixos/bootloader.nix;
|
||||
nvidia = ./nixos/gaming/nvidia.nix;
|
||||
starCitizen = ./nixos/gaming/starCitizen.nix;
|
||||
steam = ./nixos/gaming/steam.nix;
|
||||
locale = ./nixos/locale.nix;
|
||||
secrets = ./nixos/secrets.nix;
|
||||
swap = ./nixos/swap.nix;
|
||||
wireless = ./nixos/wireless.nix;
|
||||
xfce = ./nixos/xfce.nix;
|
||||
};
|
||||
|
||||
macos = {
|
||||
ollama = ./macos/ollama.nix;
|
||||
vesktop = ./macos/vesktop.nix;
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user