refactor: centralise all modules

This commit is contained in:
Mohammad Rafiq 2025-03-27 03:19:25 +08:00
parent 1989535535
commit 6c60cd8e8b
No known key found for this signature in database
70 changed files with 151 additions and 188 deletions

37
configs/default.nix Normal file
View file

@ -0,0 +1,37 @@
{
lib,
hostname,
type,
modulesPath,
...
}:
{
imports = builtins.concatLists [
# Common options for all machines.
[
(modulesPath + "/installer/scan/not-detected.nix")
./boot.nix
./networking.nix
./nix-config.nix
./programs/zsh.nix
./security.nix
./users.nix
]
# Options for graphical systems.
(lib.optionals (type == "desktop") [
./hardware/audio.nix
./hardware/bluetooth.nix
./programs/getty.nix
./programs/hyprland.nix
./programs/hyprlock.nix
./stylix.nix
])
# Options for specific hostnames.
(lib.optionals (hostname == "nemesis") [
./hw-nemesis.nix
./bootloaders/systemd-boot.nix
./hardware/cpu_amd.nix
./hardware/nvidia.nix
])
];
}

View file

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Before After
Before After

View file

@ -1,6 +1,6 @@
{ {
sops = { sops = {
defaultSopsFile = ../../secrets/secrets.yaml; defaultSopsFile = ./secrets/secrets.yaml;
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
secrets.password.neededForUsers = true; secrets.password.neededForUsers = true;
}; };

View file

@ -9,7 +9,7 @@ let
# Put options that exist in both NixOS and home-manager modules here. # Put options that exist in both NixOS and home-manager modules here.
stylix = { stylix = {
enable = true; enable = true;
image = ../../media/wallpaper.jpg; image = ./media/wallpaper.jpg;
opacity = { opacity = {
applications = opacity; applications = opacity;
desktop = opacity; desktop = opacity;

111
configs/users.nix Normal file
View file

@ -0,0 +1,111 @@
{
inputs,
config,
specialArgs,
pkgs,
...
}:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs;
};
users.mutableUsers = false; # Always reset users on system activation
time.timeZone = "Asia/Singapore";
i18n.defaultLocale = "en_SG.UTF-8";
home-manager.users.rafiq.imports = [
../programs_temp/ags.nix
../programs_temp/btop.nix
../programs_temp/clipse.nix
../programs_temp/comma.nix
../programs_temp/direnv.nix
../programs_temp/dunst.nix
../programs_temp/firefox.nix
../programs_temp/fuzzel.nix
../programs_temp/fzf.nix
../programs_temp/git.nix
../programs_temp/hyprland.nix
../programs_temp/hyprshade.nix
../programs_temp/kitty.nix
../programs_temp/nh.nix
../programs_temp/nvf.nix
../programs_temp/spicetify.nix
../programs_temp/starship.nix
../programs_temp/tealdeer.nix
../programs_temp/yazi.nix
../programs_temp/zellij.nix
../programs_temp/zoxide.nix
../programs_temp/zsh.nix
./scripts
{
# This enables using home-manager from the command line.
programs.home-manager.enable = true;
editorconfig = {
enable = true;
settings = {
"*" = {
end_of_line = "lf";
insert_final_newline = true;
trim_trailing_whitespace = true;
charset = "utf-8";
indent_style = "space";
indent_size = 2;
};
"package.json" = {
indent_style = "unset";
};
"*.lock" = {
indent_size = "unset";
};
};
};
home = {
username = "rafiq";
homeDirectory = "/home/rafiq";
# This defines the version home-manager
# was originally bulit against on this system.
# Do not change it.
stateVersion = "25.05";
shell.enableShellIntegration = true;
shellAliases = {
gs = "git status";
ai = "aichat -r %shell% -e";
cd = "z";
list-all-packages = "nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq";
};
packages = with pkgs; [
fastfetch # system info
wl-clipboard # provides cli copy and paste commands
aichat # duh
ripgrep
devenv
bat
ttyper
hyprpicker
inputs.hyprcloser.packages.${pkgs.stdenv.hostPlatform.system}.default
];
};
}
];
users.users.rafiq = {
isNormalUser = true;
description = "rafiq";
hashedPasswordFile = config.sops.secrets.password.path;
extraGroups = [
"networkmanager"
"wheel"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"
];
};
}

View file

@ -21,7 +21,7 @@
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
specialArgs = args; specialArgs = args;
modules = [ modules = [
./systems ./configs
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];

View file

@ -1,37 +0,0 @@
{
lib,
hostname,
type,
modulesPath,
...
}:
{
imports = builtins.concatLists [
# Common options for all machines.
[
(modulesPath + "/installer/scan/not-detected.nix")
./modules/boot.nix
./modules/networking.nix
./modules/nix.nix
./modules/programs/zsh.nix
./modules/security.nix
./modules/users.nix
]
# Options for graphical systems.
(lib.optionals (type == "desktop") [
./modules/hardware/audio.nix
./modules/hardware/bluetooth.nix
./modules/programs/getty.nix
./modules/programs/hyprland.nix
./modules/programs/hyprlock.nix
./modules/stylix.nix
])
# Options for specific hostnames.
(lib.optionals (hostname == "nemesis") [
./hw-nemesis.nix
./modules/bootloaders/systemd-boot.nix
./modules/hardware/cpu_amd.nix
./modules/hardware/nvidia.nix
])
];
}

View file

@ -1,27 +0,0 @@
{ config, specialArgs, ... }:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs;
};
users.mutableUsers = false; # Always reset users on system activation
time.timeZone = "Asia/Singapore";
i18n.defaultLocale = "en_SG.UTF-8";
home-manager.users.rafiq.imports = [ ../../users/rafiq.nix ];
users.users.rafiq = {
isNormalUser = true;
description = "rafiq";
hashedPasswordFile = config.sops.secrets.password.path;
extraGroups = [
"networkmanager"
"wheel"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n"
];
};
}

View file

@ -1,3 +0,0 @@
{
programs.thefuck.enable = true;
}

View file

@ -1,32 +0,0 @@
{pkgs, ...}: {
# Terminal Multiplexing
programs.tmux = {
enable = true;
plugins = with pkgs.tmuxPlugins; [
catppuccin
# Session Management between Reboots
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
'';
}
];
extraConfig = ''
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",tmux-256color:RGB"
set -as terminal-features ",tmux-256color:RGB"
# inherit environment variables from outside so that we can use wl-copy etc
setenv -g WAYLAND_DISPLAY "$WAYLAND_DISPLAY"
setenv -g XDG_RUNTIME_DIR "$XDG_RUNTIME_DIR"
'';
};
}

View file

@ -1,86 +0,0 @@
{
pkgs,
inputs,
...
}:
{
imports = [
./programs/ags.nix
./programs/btop.nix
./programs/clipse.nix
./programs/comma.nix
./programs/direnv.nix
./programs/dunst.nix
./programs/firefox.nix
./programs/fuzzel.nix
./programs/fzf.nix
./programs/git.nix
./programs/hyprland.nix
./programs/hyprshade.nix
./programs/kitty.nix
./programs/nh.nix
./programs/nvf.nix
./programs/spicetify.nix
./programs/starship.nix
./programs/tealdeer.nix
./programs/thefuck.nix
./programs/yazi.nix
./programs/zellij.nix
./programs/zoxide.nix
./programs/zsh.nix
./scripts
];
# This enables using home-manager from the command line.
programs.home-manager.enable = true;
editorconfig = {
enable = true;
settings = {
"*" = {
end_of_line = "lf";
insert_final_newline = true;
trim_trailing_whitespace = true;
charset = "utf-8";
indent_style = "space";
indent_size = 2;
};
"package.json" = {
indent_style = "unset";
};
"*.lock" = {
indent_size = "unset";
};
};
};
home = {
username = "rafiq";
homeDirectory = "/home/rafiq";
# This defines the version home-manager
# was originally bulit against on this system.
# Do not change it.
stateVersion = "25.05";
shell.enableShellIntegration = true;
shellAliases = {
gs = "git status";
ai = "aichat -r %shell% -e";
cd = "z";
list-all-packages = "nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq";
};
packages = with pkgs; [
fastfetch # system info
wl-clipboard # provides cli copy and paste commands
aichat # duh
ripgrep
devenv
bat
ttyper
hyprpicker
inputs.hyprcloser.packages.${pkgs.stdenv.hostPlatform.system}.default
];
};
}