refactor: centralise all modules
This commit is contained in:
parent
1989535535
commit
6c60cd8e8b
70 changed files with 151 additions and 188 deletions
|
@ -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
|
||||
])
|
||||
];
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/e5005ea6-6c5a-4ab3-9767-ce7772582024";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/6BBE-0E70";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
loader = {
|
||||
timeout = 5;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
initrd.availableKernelModules = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
systemd-boot.configurationLimit = 5;
|
||||
};
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
extraConfig = { };
|
||||
jack.enable = true;
|
||||
pulse.enable = true;
|
||||
alsa = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# Accept the license by default; needed for some packages.
|
||||
nixpkgs.config.nvidia.acceptLicense = true;
|
||||
nix.settings = {
|
||||
substituters = [ "https://cuda-maintainers.cachix.org" ];
|
||||
trusted-public-keys = [
|
||||
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
|
||||
];
|
||||
};
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
environment.variables = {
|
||||
GBM_BACKEND = "nvidia-drm";
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
};
|
||||
hardware = {
|
||||
enableRedistributableFirmware = true;
|
||||
nvidia-container-toolkit.enable = true;
|
||||
graphics = {
|
||||
enable = true;
|
||||
package = inputs.hyprland.inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.mesa;
|
||||
extraPackages = with pkgs; [
|
||||
nvidia-vaapi-driver # hardware acceleration
|
||||
];
|
||||
};
|
||||
nvidia = {
|
||||
modesetting.enable = true;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
nvidiaPersistenced = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||
};
|
||||
};
|
||||
boot.initrd.availableKernelModules = [
|
||||
"nvidia"
|
||||
"nvidia_modeset"
|
||||
"nvidia_uvm"
|
||||
"nvidia_drm"
|
||||
];
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
device ? throw "Set this to your disk device",
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
];
|
||||
# Disk Partitioning
|
||||
disko.devices.disk.main = {
|
||||
# device = "/dev/disk/by-id/nvme-eui.01000000000000008ce38e04019a68ab";
|
||||
inherit device;
|
||||
type = "disk";
|
||||
content.type = "gpt";
|
||||
content.partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
type = "EF02";
|
||||
size = "1M";
|
||||
priority = 1;
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
type = "EF00";
|
||||
size = "500M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "4G";
|
||||
content = {
|
||||
type = "swap";
|
||||
resumeDevice = true;
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "lvm_pv";
|
||||
vg = "root_vg";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Logical Volume Set up
|
||||
disko.devices.lvm_vg.root_vg = {
|
||||
type = "lvm_vg";
|
||||
lvs.root = {
|
||||
size = "100%FREE";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root".mountpoint = "/";
|
||||
"/persist".mountpoint = "/persist";
|
||||
"/persist".mountOptions = [
|
||||
"subvol=persist"
|
||||
"noatime"
|
||||
];
|
||||
"/nix".mountpoint = "/nix";
|
||||
"/nix".mountOptions = [
|
||||
"subvol=nix"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Back up old roots and delete older ones
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/root_vg/root /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%M-%D_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
|
||||
# Directories to persist between boots
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
};
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
{ hostname, lib, ... }:
|
||||
{
|
||||
networking = {
|
||||
hostName = hostname;
|
||||
useDHCP = lib.mkDefault true;
|
||||
networkmanager.enable = true;
|
||||
networkmanager.wifi.backend = "iwd";
|
||||
|
||||
# Configures a simple stateful firewall.
|
||||
# By default, it doesn't allow any incoming connections.
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
22 # SSH
|
||||
];
|
||||
allowedUDPPorts = [ ];
|
||||
};
|
||||
|
||||
interfaces.enp12s0.wakeOnLan.policy = [
|
||||
"phy"
|
||||
"unicast"
|
||||
"multicast"
|
||||
"broadcast"
|
||||
"arp"
|
||||
"magic"
|
||||
"secureon"
|
||||
];
|
||||
interfaces.enp12s0.wakeOnLan.enable = true;
|
||||
};
|
||||
services.openssh.enable = true;
|
||||
services.tailscale.enable = true;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
system.stateVersion = "24.11";
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
"pipe-operators"
|
||||
];
|
||||
|
||||
# Add binary caches to avoid having to compile them
|
||||
substituters = [
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://nvf.cachix.org"
|
||||
"https://yazi.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"nvf.cachix.org-1:GMQWiUhZ6ux9D5CvFFMwnc2nFrUHTeGaXRlVBXo+naI="
|
||||
"yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
services.getty = {
|
||||
autologinUser = "rafiq";
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
hostname,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg =
|
||||
if hostname == "nemesis" then
|
||||
{
|
||||
mainMonitor = "HDMI-A-1";
|
||||
}
|
||||
else
|
||||
{
|
||||
mainMonitor = "";
|
||||
};
|
||||
in
|
||||
{
|
||||
security.pam.services.hyprlock = { };
|
||||
home-manager.users.rafiq = {
|
||||
programs.hyprlock = {
|
||||
enable = true;
|
||||
package = inputs.hyprlock.packages.${pkgs.stdenv.hostPlatform.system}.hyprlock;
|
||||
|
||||
settings = {
|
||||
general = {
|
||||
hide_cursor = true;
|
||||
ignore_empty_input = true;
|
||||
};
|
||||
|
||||
background = {
|
||||
blur_passes = 5;
|
||||
blur_size = 5;
|
||||
};
|
||||
|
||||
label = {
|
||||
monitor = cfg.mainMonitor;
|
||||
text = ''hi, $USER.'';
|
||||
font_size = 32;
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
position = "0, 0";
|
||||
zindex = 1;
|
||||
shadow_passes = 5;
|
||||
shadow_size = 5;
|
||||
};
|
||||
|
||||
input-field = {
|
||||
fade_on_empty = true;
|
||||
size = "200, 45";
|
||||
halign = "center";
|
||||
valign = "center";
|
||||
position = "0, -5%";
|
||||
placeholder_text = "";
|
||||
zindex = 1;
|
||||
shadow_passes = 5;
|
||||
shadow_size = 5;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
};
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
environment.pathsToLink = ["/share/zsh"]; # enables completion
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
sops = {
|
||||
defaultSopsFile = ../../secrets/secrets.yaml;
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
secrets.password.neededForUsers = true;
|
||||
};
|
||||
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{ inputs, ... }:
|
||||
let
|
||||
opacity = 0.8;
|
||||
toImport = [
|
||||
./themes/cursors/banana-cursor.nix
|
||||
./themes/colourschemes/darkviolet.nix
|
||||
./themes/fonts/sauce-code-pro.nix
|
||||
{
|
||||
# Put options that exist in both NixOS and home-manager modules here.
|
||||
stylix = {
|
||||
enable = true;
|
||||
image = ../../media/wallpaper.jpg;
|
||||
opacity = {
|
||||
applications = opacity;
|
||||
desktop = opacity;
|
||||
popups = opacity;
|
||||
terminal = opacity;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
# Enable basic fonts for reasonable Unicode coverage
|
||||
fonts.enableDefaultPackages = true;
|
||||
|
||||
imports = [ inputs.stylix.nixosModules.stylix ] ++ toImport;
|
||||
home-manager.users.rafiq.imports = [ inputs.stylix.homeManagerModules.stylix ] ++ toImport;
|
||||
|
||||
# Put options that only exist in the NixOS module here.
|
||||
stylix.homeManagerIntegration.autoImport = false;
|
||||
stylix.homeManagerIntegration.followSystem = false;
|
||||
|
||||
# Put options that only exist in the home-manager module here.
|
||||
# home-manager.users.rafiq.stylix = {};
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/3024.yaml";
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/black-metal.yaml";
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/bright.yaml";
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml";
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/darkviolet.yaml";
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.cursor = {
|
||||
name = "Banana";
|
||||
package = pkgs.banana-cursor;
|
||||
size = 22;
|
||||
};
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
stylix.cursor = {
|
||||
name = "wii-cursor";
|
||||
# package = inputs.wii-cursor.packages.${pkgs.stdenv.hostPlatform.system}.wii-cursor;
|
||||
package = builtins.trace (inputs.wii-cursor.packages.${pkgs.stdenv.hostPlatform.system}.wii-cursor
|
||||
) (inputs.wii-cursor.packages.${pkgs.stdenv.hostPlatform.system}.wii-cursor);
|
||||
size = 20;
|
||||
};
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts._0xproto
|
||||
];
|
||||
stylix.fonts = {
|
||||
serif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "0xProto Nerd Font";
|
||||
};
|
||||
sansSerif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "0xProto Nerd Font";
|
||||
};
|
||||
emoji = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "0xProto Nerd Font";
|
||||
};
|
||||
monospace = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "0xProto Nerd Font Mono";
|
||||
};
|
||||
sizes = {
|
||||
applications = 16;
|
||||
desktop = 12;
|
||||
popups = 12;
|
||||
terminal = 16;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts._3270
|
||||
];
|
||||
stylix.fonts = {
|
||||
serif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "3270 Nerd Font";
|
||||
};
|
||||
sansSerif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "3270 Nerd Font";
|
||||
};
|
||||
emoji = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "3270 Nerd Font";
|
||||
};
|
||||
monospace = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "3270 Nerd Font Mono";
|
||||
};
|
||||
sizes = {
|
||||
applications = 16;
|
||||
desktop = 12;
|
||||
popups = 12;
|
||||
terminal = 16;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
stylix.fonts = {
|
||||
# packages = [ pkgs.nerd-fonts.sauce-code-pro ];
|
||||
emoji.name = "SauceCodePro Nerd Font";
|
||||
emoji.package = pkgs.nerd-fonts.sauce-code-pro;
|
||||
monospace.name = "SauceCodePro Nerd Font Mono";
|
||||
monospace.package = pkgs.nerd-fonts.sauce-code-pro;
|
||||
sansSerif.name = "SauceCodePro Nerd Font";
|
||||
sansSerif.package = pkgs.nerd-fonts.sauce-code-pro;
|
||||
serif.name = "SauceCodePro Nerd Font";
|
||||
serif.package = pkgs.nerd-fonts.sauce-code-pro;
|
||||
|
||||
sizes = {
|
||||
applications = 16;
|
||||
desktop = 12;
|
||||
popups = 12;
|
||||
terminal = 16;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts.terminess-ttf
|
||||
];
|
||||
stylix.fonts = {
|
||||
serif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "Terminess Nerd Font";
|
||||
};
|
||||
sansSerif = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "Terminess Nerd Font";
|
||||
};
|
||||
emoji = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "Terminess Nerd Font";
|
||||
};
|
||||
monospace = {
|
||||
package = pkgs.nerd-fonts.terminess-ttf;
|
||||
name = "Terminess Nerd Font Mono";
|
||||
};
|
||||
sizes = {
|
||||
applications = 16;
|
||||
desktop = 12;
|
||||
popups = 12;
|
||||
terminal = 16;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue