refactor!: massively overhaul configuration and bring it to the modern

age
This commit is contained in:
Youwen Wu 2024-09-17 23:21:29 -07:00
parent 1310dd7b7a
commit 9a081df74a
Signed by untrusted user: youwen
GPG key ID: 865658ED1FE61EC3
16 changed files with 492 additions and 251 deletions

View file

@ -1,167 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{
config,
pkgs,
...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
boot.initrd.luks.fido2Support = true;
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
virtualisation.waydroid.enable = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Fingerprint Driver
services.fprintd.enable = true;
security.pam.services.login.fprintAuth = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.kaitotlex = {
isNormalUser = true;
description = "KaitoTLex";
extraGroups = [
"networkmanager"
"wheel"
];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
pkgs.fprintd
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
fonts = {
enableDefaultPackages = true;
fontconfig = {
defaultFonts = {
serif = [ "Noto Serif" ];
sansSerif = [ "Noto Sans" ];
};
};
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
(nerdfonts.override { fonts = [ "CascadiaCode" ]; })
];
};
programs.fish.enable = true;
users.users.kaitotlex.shell = pkgs.fish;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}

View file

@ -15,36 +15,30 @@
outputs =
{
self,
nixpkgs,
home-manager,
...
}@inputs:
{
formatter."x86_64-linux" = nixpkgs.legacyPackages.x86_64-linux.alejandra;
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
formatter."x86_64-linux" = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
nixosConfigurations.shiroko = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
system = "x86_64-linux";
modules = [
./configuration.nix
./hosts/shiroko
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = {
inherit inputs;
};
users.kaitotlex = {
imports = [
./home.nix
./spicetify.nix
# inputs.nixvim.homeManagerModules.nixvim
#./nixvim.nix
];
imports = [ ./users/kaitotlex ];
};
};
}

View file

@ -0,0 +1,67 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{
config,
pkgs,
...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
boot.initrd.luks.fido2Support = true;
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
virtualisation.waydroid.enable = true;
networking.hostName = "shiroko"; # Define your hostname.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# List services that you want to enable:
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}

View file

@ -0,0 +1,9 @@
{
imports = [
./configuration.nix
../../modules/core
../../modules/wm
../../modules/security
../../modules/audio
];
}

View file

@ -7,12 +7,18 @@
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
@ -27,7 +33,10 @@
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/C5E5-09F1";
fsType = "vfat";
options = ["fmask=0077" "dmask=0077"];
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = [ ];

11
modules/audio/default.nix Normal file
View file

@ -0,0 +1,11 @@
{
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
}

75
modules/core/default.nix Normal file
View file

@ -0,0 +1,75 @@
{ pkgs, inputs, ... }:
{
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = false;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nix = {
settings.experimental-features = [
"nix-command"
"flakes"
];
optimise.automatic = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
# Free up to 1GiB when there is less than 100MiB left
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
fonts = {
enableDefaultPackages = true;
fontconfig = {
defaultFonts = {
serif = [ "Noto Serif" ];
sansSerif = [ "Noto Sans" ];
};
};
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
(nerdfonts.override { fonts = [ "CascadiaCode" ]; })
];
};
environment.systemPackages = [
inputs.nixvim.packages.${pkgs.system}.default
];
# Define a user account. Don't forget to set a password with passwd.
users.users.kaitotlex = {
isNormalUser = true;
description = "KaitoTLex";
extraGroups = [
"networkmanager"
"wheel"
];
};
programs.fish.enable = true;
users.users.kaitotlex.shell = pkgs.fish;
}

View file

@ -0,0 +1,16 @@
{
security.rtkit.enable = true;
# Fingerprint Driver
services.fprintd.enable = true;
security.pam.services.login.fprintAuth = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
services.gnome.gnome-keyring.enable = true;
}

11
modules/wm/default.nix Normal file
View file

@ -0,0 +1,11 @@
{
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./sway
./waybar
];
}

View file

@ -0,0 +1,5 @@
{
wayland.windowManager.sway = {
enable = true;
};
}

View file

@ -0,0 +1,173 @@
{ pkgs, ... }:
{
programs.waybar = {
enable = true;
style = ./style.css;
systemd.enable = true;
settings = {
mainBar = {
name = "bar0";
layer = "top";
position = "top";
height = 28;
# "width" = 1920;
"margin" = "5px 10px 0px 10px";
"spacing" = 10;
"mode" = "top";
# "exclusive" = true;
# "output" = "eDP-1";
reload_style_on_change = true;
modules-left = [
"hyprland/workspaces"
"hyprland/window"
];
modules-right = [
"tray"
"idle_inhibitor"
"backlight"
"wireplumber"
"network"
"battery"
"disk"
"memory"
"cpu"
"temperature"
"clock"
];
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "󰛊 ";
deactivated = "󰾫 ";
};
};
network = {
format = "{ifname}";
format-wifi = "{icon}{essid}";
format-ethernet = " {essid}";
format-disconnected = "󰤯 Disconnected";
format-icons = [
"󰤟 "
"󰤢 "
"󰤨 "
];
tooltip-format = " {bandwidthUpBits} | {bandwidthDownBits}";
tooltip-format-wifi = " {bandwidthUpBits} | {bandwidthDownBits} | 󱄙 {signalStrength}";
};
backlight = {
interval = 2;
format = "󰖨 {percent}%";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set +4";
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set 4-";
};
wireplumber = {
format = "{icon} {volume}%";
format-muted = "󰝟 ";
on-click = "pamixer -t";
on-scroll-up = "${pkgs.pamixer}/bin/pamixer set 5%+";
on-scroll-down = "${pkgs.pamixer}/bin/pamixer set 5%-";
format-icons = [
""
""
""
""
""
];
};
battery = {
interval = 10;
format = "{icon} {capacity}%";
format-icons = [
"󰂎"
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
tooltip = true;
tooltip-format = "{timeTo}";
};
disk = {
intervel = 30;
format = "󰋊 {percentage_used}%";
tooltip-format = "{used} used out of {total} on \"{path}\" ({percentage_used}%)";
};
memory = {
interval = 10;
format = " {used}";
tooltip-format = "{used}GiB used of {total}GiB ({percentage}%)";
};
cpu = {
interval = 10;
format = " {usage}%";
};
temperature = {
interval = 10;
};
clock = {
interval = 1;
format = "{:%H:%M:%S}";
};
"hyprland/workspaces" = {
show-special = true;
persistent-workspaces = {
"*" = [
1
2
3
4
5
6
7
8
9
10
];
};
format = "{icon}";
format-icons = {
active = "";
empty = "";
default = "";
urgent = "";
special = "󰠱";
};
};
"hyprland/window" = {
icon = true;
icon-size = 20;
max-length = 50;
rewrite = {
"(.*) LibreWolf" = "$1";
"(.*) Zen Browser" = "$1";
"^$" = "👾";
};
};
};
};
};
}

View file

@ -0,0 +1,75 @@
window#waybar {
font-family: "CaskaydiaCove Nerd Font";
background-color: rgba(0,0,0,0);
font-size: 0.8rem;
border-radius: 0.5rem;
}
.modules-left {
opacity: 1;
background: linear-gradient(45deg, rgb(214, 39, 200), rgb(5, 83, 252));
border-radius: 0.5rem;
padding: 2px;
}
.modules-center {
opacity: 0;
}
.modules-right {
opacity: 1;
background-color: rgba(0,0,0,0.5);
border-radius: 0.5rem;
padding: 2px 2px 2px 10px
}
/* label.module {
margin-left: -1px;
} */
#workspaces {
background-color: rgba(0,0,0,0.5);
border-radius: 0.5rem;
padding: 0 2px;
}
#workspaces button {
font-size: 0.6rem;
padding: 0 0.3rem 0 0;
}
#window {
background-color: rgba(0,0,0,0.5);
border-radius: 0.5rem;
padding: 2px 5px;
}
#clock {
font-weight: bolder;
border-radius: 0.5rem;
padding: 0 3px 0 0;
}
#battery {
color: lightgreen;
}
#memory {
color: lightpink;
}
#disk {
color: lightskyblue;
}
#cpu {
color: lightgoldenrodyellow;
}
#temperature {
color: lightslategray;
}
#network {
color: lightsteelblue;
}

View file

@ -0,0 +1,7 @@
{
imports = [
./home.nix
./spicetify.nix
./de
];
}

View file

@ -1,8 +1,4 @@
{
pkgs,
inputs,
...
}:
{ pkgs, inputs, ... }:
{
home.username = "kaitotlex";
home.homeDirectory = "/home/kaitotlex";
@ -26,7 +22,6 @@
home.packages = with pkgs; [
# here is some command line tools I use frequently
# feel free to add your own or remove some of them
firefox-devedition
neofetch
polychromatic
openrazer-daemon
@ -52,11 +47,8 @@
p7zip
# utils
ripgrep # recursively searches directories for a regex pattern
jq # A lightweight and flexible command-line JSON processor
yq-go # yaml processor https://github.com/mikefarah/yq
eza # A modern replacement for ls
fzf # A command-line fuzzy finder
emacs # full featured everything
wl-clipboard
@ -91,7 +83,6 @@
# with more details log output
nix-output-monitor
# productivity
hugo # static site generator
glow # markdown previewer in terminal
obsidian # markdown previewer
thunderbird-unwrapped # Full Feature Email Client
@ -141,8 +132,6 @@
signal-desktop
gh
inputs.nixvim.packages.${pkgs.system}.default
#Pentest
netcat
nmap
@ -168,6 +157,8 @@
};
};
programs.neovim.defaultEditor = true;
programs.lazygit.enable = true;
programs.zoxide = {
@ -188,47 +179,12 @@
};
};
programs.waybar = {
programs.firefox = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
output = [
"DP-1"
"HDMI-A-1"
];
modules-left = [
"hyprland/workspaces"
"sway/submap"
"wlr/taskbar"
];
modules-center = [
"hyprland/window"
"custom/hello-from-waybar"
];
modules-right = [
"mpd"
"custom/mymodule#with-css-id"
"temperature"
];
package = pkgs.firefox-devedition;
};
"hyprland/workspaces" = {
disable-scroll = true;
all-outputs = true;
};
"custom/hello-from-waybar" = {
format = "hello {}";
max-length = 40;
interval = "once";
exec = pkgs.writeShellScript "hello-from-waybar" ''
echo "from within waybar"
'';
};
};
};
};
programs.ripgrep.enable = true;
programs.oh-my-posh = {
enable = true;

View file

@ -1,13 +1,9 @@
{
inputs,
pkgs,
...
}: let
{ inputs, pkgs, ... }:
let
spicepkgs = inputs.spicetify.legacyPackages.${pkgs.system};
in {
imports = [
inputs.spicetify.homeManagerModules.default
];
in
{
imports = [ inputs.spicetify.homeManagerModules.default ];
programs.spicetify = {
enable = true;
@ -17,8 +13,6 @@ in {
lastfm
fullAppDisplayMod
];
enabledCustomApps = with spicepkgs.apps; [
lyricsPlus
];
enabledCustomApps = with spicepkgs.apps; [ lyricsPlus ];
};
}