refactor: clean up

This commit is contained in:
Mohammad Rafiq 2025-03-12 03:49:11 +08:00
parent 45c4e136c4
commit 630b3ce27b
25 changed files with 195 additions and 210 deletions

View file

@ -35,25 +35,7 @@
} }
{ {
name = "orpheus"; name = "orpheus";
value = nixpkgs.lib.nixosSystem { value = mkSystem "orpheus";
specialArgs = args;
modules = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${nixpkgs}/nixos/modules/profiles/minimal.nix"
./systems/orpheus.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = true;
extraSpecialArgs = args;
users.rafiq.imports = [
./users/rafiq.nix
];
};
}
];
};
} }
]; ];
}; };
@ -61,19 +43,14 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware"; nixos-hardware.url = "github:nixos/nixos-hardware";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
yazi.url = "github:sxyazi/yazi"; yazi.url = "github:sxyazi/yazi";
nvf.url = "github:notashelf/nvf"; nvf.url = "github:notashelf/nvf";
nixvim.url = "github:nix-community/nixvim"; nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.nixpkgs.follows = "nixpkgs"; nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixd.url = "github:nix-community/nixd"; nixd.url = "github:nix-community/nixd";
stylix.url = "github:danth/stylix"; stylix.url = "github:danth/stylix";
}; };
} }

View file

@ -1,30 +1,34 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") lib,
]; pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/e5005ea6-6c5a-4ab3-9767-ce7772582024"; device = "/dev/disk/by-uuid/e5005ea6-6c5a-4ab3-9767-ce7772582024";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/6BBE-0E70"; device = "/dev/disk/by-uuid/6BBE-0E70";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = ["fmask=0077" "dmask=0077"];
}; };
swapDevices = [ ]; swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -0,0 +1,6 @@
{
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
}

View file

@ -5,12 +5,11 @@
extraGroups = ["networkmanager" "wheel"]; extraGroups = ["networkmanager" "wheel"];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILv8HqazE294YdyGaXK6q2EniDlTpGaUL071kk9+W0GJ rafiq@nemesis" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILv8HqazE294YdyGaXK6q2EniDlTpGaUL071kk9+W0GJ rafiq@nemesis"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICbZfOYt6zydLyO4f9JAsxb1i6kHAjYzqa0SOqef6MKM rafiq@orpheus"
]; ];
}; };
security.sudo = { security.sudo.wheelNeedsPassword = false;
wheelNeedsPassword = false;
};
# Enable basic fonts for reasonable Unicode coverage # Enable basic fonts for reasonable Unicode coverage
fonts.enableDefaultPackages = true; fonts.enableDefaultPackages = true;

View file

@ -1,6 +1,10 @@
{ pkgs, config, ... }: { {
pkgs,
config,
...
}: {
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
nerd-fonts.terminess-ttf nerd-fonts.terminess-ttf
]; ];
stylix.fonts = { stylix.fonts = {
serif = config.stylix.fonts.monospace; serif = config.stylix.fonts.monospace;

View file

@ -1,5 +1,5 @@
{ pkgs, ... }: { {pkgs, ...}: {
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = ["nvidia"];
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [

View file

@ -6,17 +6,15 @@
imports = [ imports = [
./programs/tailscale.nix ./programs/tailscale.nix
]; ];
networking = { networking = {
# Enable networkManager
# TODO: Look into the networkManager options.
networkmanager.enable = true; networkmanager.enable = true;
# Configures a simple stateful firewall. # Configures a simple stateful firewall.
# By default, it doesn't allow any incoming connections. # By default, it doesn't allow any incoming connections.
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
22 # SSH 22 # SSH
]; ];
allowedUDPPorts = []; allowedUDPPorts = [];
@ -26,17 +24,16 @@
# Add binary caches to avoid having to compile them # Add binary caches to avoid having to compile them
nix.settings = { nix.settings = {
substituters = [ substituters = [
"https://hyprland.cachix.org" "https://hyprland.cachix.org"
"https://cuda-maintainers.cachix.org" "https://cuda-maintainers.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
]; ];
trusted-public-keys = [ trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
]; ];
}; };
# TODO: look into openssh and tailscale settings.
services.openssh.enable = true; services.openssh.enable = true;
} }

View file

@ -1,4 +1,8 @@
{ inputs, pkgs, ... }: { {
inputs,
pkgs,
...
}: {
programs.uwsm = { programs.uwsm = {
enable = false; enable = false;
}; };

View file

@ -1,5 +1,5 @@
{ inputs, ... }: { {inputs, ...}: {
imports = [ imports = [
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
./themes/catppuccin.nix ./themes/catppuccin.nix
./fonts/terminess.nix ./fonts/terminess.nix

View file

@ -1,3 +1,3 @@
{ pkgs, ... }: { {pkgs, ...}: {
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
} }

View file

@ -3,15 +3,13 @@
./hw-nemesis.nix ./hw-nemesis.nix
./modules/bootloaders/systemd-boot.nix ./modules/bootloaders/systemd-boot.nix
./modules/common.nix ./modules/common.nix
./modules/desktop.nix
./modules/hardware/nvidia.nix ./modules/hardware/nvidia.nix
./modules/networking.nix ./modules/networking.nix
./modules/desktop.nix
./modules/stylix.nix ./modules/stylix.nix
]; ];
networking.hostName = "nemesis"; networking.hostName = "nemesis";
boot.binfmt.emulatedSystems = ["wasm32-wasi" "x86_64-windows" "aarch64-linux"];
system.stateVersion = "24.11"; system.stateVersion = "24.11";
boot.binfmt.emulatedSystems = ["wasm32-wasi" "x86_64-windows" "aarch64-linux"];
} }

View file

@ -1,25 +1,14 @@
{ {inputs, ...}: {
config,
lib,
pkgs,
...
}: {
imports = [ imports = [
# Include the results of the hardware scan.
./hw-orpheus.nix ./hw-orpheus.nix
./modules/bootloaders/extlinux.nix
./modules/common.nix ./modules/common.nix
./modules/networking.nix
./modules/stylix.nix
inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${inputs.nixpkgs}/nixos/modules/profiles/minimal.nix"
]; ];
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default) networking.hostName = "orpheus";
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
networking.hostName = "orpheus"; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
services.openssh.enable = true;
networking.firewall.enable = false;
system.stateVersion = "25.05"; system.stateVersion = "25.05";
} }

View file

@ -1,9 +1,9 @@
{ {
# direnv lets us declare a .envrc in each project directory # direnv lets us declare a .envrc in each project directory
# and updates the shell with the packages specified. # and updates the shell with the packages specified.
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
} }

View file

@ -2,10 +2,10 @@
fonts = { fonts = {
fontconfig = { fontconfig = {
enable = true; enable = true;
defaultFonts.emoji = [ "Terminess Nerd Font" ]; defaultFonts.emoji = ["Terminess Nerd Font"];
defaultFonts.monospace = [ "Terminess Nerd Font Mono" ]; defaultFonts.monospace = ["Terminess Nerd Font Mono"];
defaultFonts.sansSerif = [ "Terminess Nerd Font" ]; defaultFonts.sansSerif = ["Terminess Nerd Font"];
defaultFonts.serif = [ "Terminess Nerd Font" ]; defaultFonts.serif = ["Terminess Nerd Font"];
}; };
}; };
} }

View file

@ -1,4 +1,8 @@
{ config, lib, ... }: { {
config,
lib,
...
}: {
home.sessionVariables.NIXOS_OZONE_WL = "1"; home.sessionVariables.NIXOS_OZONE_WL = "1";
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
@ -6,19 +10,19 @@
portalPackage = null; portalPackage = null;
settings = { settings = {
env = [ env = [
"XCURSOR_SIZE,32" "XCURSOR_SIZE,32"
# Nvidia Settings # Nvidia Settings
"LIBVA_DRIVER_NAME,nvidia" "LIBVA_DRIVER_NAME,nvidia"
"__GLX_VENDOR_LIBRARY_NAME,nvidia" "__GLX_VENDOR_LIBRARY_NAME,nvidia"
"NVD_BACKEND,direct # needed for running vaapi-driver on later drivers" "NVD_BACKEND,direct # needed for running vaapi-driver on later drivers"
]; ];
# Monitors # Monitors
monitor = [ monitor = [
"HDMI-A-2, 3840x2160@60, 0x0, 2.5" "HDMI-A-2, 3840x2160@60, 0x0, 2.5"
"DP-4, 1920x1080@60, -1280x0, 1.5" "DP-4, 1920x1080@60, -1280x0, 1.5"
", preferred, auto, 1" ", preferred, auto, 1"
]; ];
# Switching to the current workspace will switch to the previous # Switching to the current workspace will switch to the previous
@ -27,17 +31,17 @@
# Windows # Windows
general = { general = {
# Make there be no gaps in between windows or edges # Make there be no gaps in between windows or edges
border_size = 5; border_size = 5;
gaps_in = 0; gaps_in = 0;
gaps_out = 0; gaps_out = 0;
resize_on_border = true; resize_on_border = true;
}; };
# Programs # Programs
exec-once = [ exec-once = [
"waybar" "waybar"
]; ];
# Keybinds # Keybinds
@ -46,32 +50,32 @@
"$browser" = "firefox"; "$browser" = "firefox";
bind = [ bind = [
"$mainMod, Q, exec, $terminal" "$mainMod, Q, exec, $terminal"
"$mainMod, W, killactive" "$mainMod, W, killactive"
"$mainMod, E, exec, $browser" "$mainMod, E, exec, $browser"
"$mainMod, M, exit" "$mainMod, M, exit"
# HJKL to move between windows # HJKL to move between windows
"$mainMod, H, cyclenext, visible" "$mainMod, H, cyclenext, visible"
"$mainMod, L, cyclenext, visible prev" "$mainMod, L, cyclenext, visible prev"
# HJKL to move a window # HJKL to move a window
"$mainMod_ALT, H, movewindow, l" "$mainMod_ALT, H, movewindow, l"
"$mainMod_ALT, J, movewindow, d" "$mainMod_ALT, J, movewindow, d"
"$mainMod_ALT, K, movewindow, u" "$mainMod_ALT, K, movewindow, u"
"$mainMod_ALT, L, movewindow, r" "$mainMod_ALT, L, movewindow, r"
# HJKL to resize a window
"ALT_SHIFT, H, resizeactive, -10% 0"
"ALT_SHIFT, J, resizeactive, 0 -10%"
"ALT_SHIFT, K, resizeactive, 0 10%"
"ALT_SHIFT, L, resizeactive, 10% 0"
# H and L to move between workspaces on the current monitor including creation # HJKL to resize a window
"$mainMod_CTRL, H, workspace, r-1" "ALT_SHIFT, H, resizeactive, -10% 0"
"$mainMod_CTRL, L, workspace, r+1" "ALT_SHIFT, J, resizeactive, 0 -10%"
"ALT_SHIFT, K, resizeactive, 0 10%"
"ALT_SHIFT, L, resizeactive, 10% 0"
"$mainMod, V, togglefloating" # H and L to move between workspaces on the current monitor including creation
"$mainMod_CTRL, H, workspace, r-1"
"$mainMod_CTRL, L, workspace, r+1"
"$mainMod, V, togglefloating"
]; ];
bindm = [ bindm = [
@ -79,8 +83,8 @@
]; ];
input = { input = {
numlock_by_default = true; numlock_by_default = true;
follow_mouse = 2; # Click on a window to change focus follow_mouse = 2; # Click on a window to change focus
}; };
}; };
}; };

View file

@ -1,6 +1,6 @@
{ inputs, ... }: { {inputs, ...}: {
imports = [ imports = [
inputs.nixvim.homeManagerModules.nixvim inputs.nixvim.homeManagerModules.nixvim
./nixvim/conform-nvim.nix # formatter ./nixvim/conform-nvim.nix # formatter
./nixvim/lualine.nix # custom statusline ./nixvim/lualine.nix # custom statusline
./nixvim/noice.nix # custom CMDLINE ./nixvim/noice.nix # custom CMDLINE
@ -45,17 +45,16 @@
}; };
keymaps = [ keymaps = [
{ {
# make gf create the file if it doesnt exist # make gf create the file if it doesnt exist
# cd to the working directory to handle relative file paths # cd to the working directory to handle relative file paths
key = "gf"; key = "gf";
action = ":cd %:p:h<CR>:e <cfile><CR>"; action = ":cd %:p:h<CR>:e <cfile><CR>";
options = { options = {
silent = true; silent = true;
}; };
} }
]; ];
clipboard.providers.wl-copy.enable = true; clipboard.providers.wl-copy.enable = true;
}; };

View file

@ -2,28 +2,28 @@
programs.nixvim = { programs.nixvim = {
keymaps = [ keymaps = [
{ {
mode = "n"; mode = "n";
key = "t"; key = "t";
action = ":NvimTreeToggle<CR>"; action = ":NvimTreeToggle<CR>";
options = { options = {
silent = true; silent = true;
}; };
} }
]; ];
plugins = { plugins = {
web-devicons.enable = true; web-devicons.enable = true;
nvim-tree = { nvim-tree = {
enable = true; enable = true;
autoClose = true; autoClose = true;
disableNetrw = true; disableNetrw = true;
hijackNetrw = true; hijackNetrw = true;
hijackCursor = true; hijackCursor = true;
view = { view = {
cursorline = true; cursorline = true;
side = "right"; side = "right";
width = "25%"; width = "25%";
}; };
}; };
}; };
}; };

View file

@ -19,7 +19,10 @@
view = { view = {
cursorline = true; cursorline = true;
side = "right"; side = "right";
width = { min = "25%"; max = "25%"; }; width = {
min = "25%";
max = "25%";
};
}; };
}; };
}; };

View file

@ -1,7 +1,7 @@
{ {
# man page summaries (activate with tldr <command>) # man page summaries (activate with tldr <command>)
programs.tealdeer = { programs.tealdeer = {
enable = true; enable = true;
enableAutoUpdates = true; enableAutoUpdates = true;
}; };
} }

View file

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

View file

@ -3,7 +3,7 @@
enable = true; enable = true;
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";
}; };
}; };
style = '' style = ''

View file

@ -1,4 +1,8 @@
{ inputs, pkgs, ... }: { {
inputs,
pkgs,
...
}: {
programs.yazi = { programs.yazi = {
enable = true; enable = true;
package = inputs.yazi.packages.${pkgs.system}.default; package = inputs.yazi.packages.${pkgs.system}.default;

View file

@ -1,12 +1,10 @@
{ pkgs, ... }: { {pkgs, ...}: {
home.packages = [ home.packages = [
(pkgs.writers.writePython3Bin "git-extract" { (pkgs.writers.writePython3Bin "git-extract" {
libraries = with pkgs.python3Packages; [ libraries = with pkgs.python3Packages; [
magic magic
chardet chardet
]; ];
} (builtins.readFile ./git-extract.py)) } (builtins.readFile ./git-extract.py))
(pkgs.writeShellScriptBin "rebuild" (builtins.readFile ./rebuild.sh)) (pkgs.writeShellScriptBin "rebuild" (builtins.readFile ./rebuild.sh))

View file

@ -1,5 +1,4 @@
{pkgs, ...}: { {pkgs, ...}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
fastfetch # system info fastfetch # system info
wl-clipboard # provides cli copy and paste commands wl-clipboard # provides cli copy and paste commands

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
imports = [ imports = [
./modules/sh.nix ./modules/sh.nix
./modules/de.nix ./modules/de.nix