This commit is contained in:
EdenQwQ 2025-03-01 22:35:08 +08:00
commit 96895ec3aa
100 changed files with 6349 additions and 0 deletions

6
os/default.nix Normal file
View file

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

24
os/programs/basic.nix Normal file
View file

@ -0,0 +1,24 @@
{
programs = {
fish.enable = true;
adb.enable = true;
light.enable = true;
wshowkeys.enable = true;
nix-ld.enable = true;
virt-manager.enable = true;
git = {
enable = true;
config = {
http = {
proxy = "http://127.0.0.1:7890";
};
https = {
proxy = "http://127.0.0.1:7890";
};
safe = {
directory = "*";
};
};
};
};
}

8
os/programs/default.nix Normal file
View file

@ -0,0 +1,8 @@
{
imports = [
./basic.nix
./doas.nix
./niri.nix
./ollama.nix
];
}

16
os/programs/doas.nix Normal file
View file

@ -0,0 +1,16 @@
{ user, ... }:
{
security = {
doas = {
enable = true;
extraRules = [
{
users = [ user ];
noPass = true;
keepEnv = true;
}
];
};
sudo.enable = true;
};
}

7
os/programs/niri.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
programs.niri = {
enable = true;
package = pkgs.niri-unstable;
};
}

8
os/programs/ollama.nix Normal file
View file

@ -0,0 +1,8 @@
{
services.ollama = {
enable = true;
};
services.nextjs-ollama-llm-ui = {
enable = true;
};
}

36
os/system/boot.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = [
"loglevel=3"
"quiet"
"spash"
"console=tty1"
];
consoleLogLevel = 0;
initrd.verbose = false;
loader = {
systemd-boot.enable = false;
grub = {
enable = true;
device = "nodev";
useOSProber = true;
efiSupport = true;
efiInstallAsRemovable = true;
extraEntriesBeforeNixOS = true;
extraEntries = ''
menuentry "Reboot" {
reboot
}
menuentry "Poweroff" {
halt
}
'';
default = "saved";
};
efi.efiSysMountPoint = "/boot";
};
plymouth.enable = true;
};
}

219
os/system/configuration.nix Normal file
View file

@ -0,0 +1,219 @@
{
pkgs,
config,
user,
...
}:
{
imports = [
./boot.nix
];
networking = {
networkmanager.enable = true;
proxy = {
default = "http://127.0.0.1:7890";
httpProxy = "http://127.0.0.1:7890";
httpsProxy = "http://127.0.0.1:7890";
noProxy = "localhost,internal.domain";
};
};
time = {
timeZone = "Asia/Shanghai";
hardwareClockInLocalTime = true;
};
i18n = {
extraLocaleSettings = {
LANGUAGE = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
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";
};
inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
fcitx5-chinese-addons
fcitx5-rime
];
fcitx5.waylandFrontend = true;
};
};
services = {
xserver = {
enable = true;
displayManager.gdm.enable = false;
desktopManager.gnome.enable = true;
desktopManager.runXdgAutostartIfNone = true;
xkb.layout = "us";
xkb.variant = "";
};
displayManager.sessionPackages = [ pkgs.hyprland ];
greetd = {
enable = true;
vt = 3;
settings.default_session = {
command = # bash
let
inherit (config.services.displayManager.sessionData) desktops;
in
# bash
''
${pkgs.greetd.tuigreet}/bin/tuigreet --time \
--sessions ${desktops}/share/xsessions:${desktops}/share/wayland-sessions \
--remember --remember-user-session --asterisks --cmd niri-session \
--user-menu --greeting "Who TF Are You?" --window-padding 2'';
user = "greeter";
};
};
fprintd = {
enable = true;
};
printing.enable = true;
flatpak.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
blueman.enable = true;
gnome.gnome-browser-connector.enable = true;
gvfs.enable = true;
};
security = {
rtkit.enable = true;
sudo.extraRules = [
{
users = [ user ];
commands = [
{
command = "ALL";
options = [ "NOPASSWD" ];
}
];
}
];
polkit.enable = true;
};
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
documentation.man.generateCaches = true;
users.users.${user} = {
shell = pkgs.fish;
isNormalUser = true;
description = "Eden Lee";
extraGroups = [
"networkmanager"
"wheel"
"adbuser"
"docker"
"libvirtd"
"video"
];
packages = with pkgs; [
nautilus
loupe
podman-compose
];
};
environment = {
systemPackages = with pkgs; [
git
gcc
wget
curl
gnumake
cmake
distrobox
ntfs3g
base16-schemes
home-manager
polkit
polkit_gnome
];
variables = {
EDITOR = "lvim";
GDK_SCALE = "";
GDK_DPI_SCALE = "";
NIRI_CONFIG = "/home/${user}/.config/niri/config-override.kdl";
};
sessionVariables = {
XMODIFIERS = "@im=fcitx";
SDL_IM_MODULE = "fcitx";
GLFW_IM_MODULE = "ibus";
QT_SCALE_FACTOR_ROUNDING_POLICY = "round";
GSK_RENDERER = "vulkan";
NIXOS_OZONE_WL = "1";
};
localBinInPath = true;
};
systemd.user.services = {
polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
niri-flake-polkit.enable = false;
};
virtualisation = {
libvirtd.enable = true;
podman = {
enable = true;
defaultNetwork.settings.dns_enabled = true;
};
docker = {
enable = true;
storageDriver = "btrfs";
rootless = {
enable = true;
setSocketVariable = true;
};
};
};
}

8
os/system/default.nix Normal file
View file

@ -0,0 +1,8 @@
{
imports = [
./configuration.nix
./boot.nix
./fonts.nix
./stylix.nix
];
}

17
os/system/fonts.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-color-emoji
noto-fonts-emoji
nerd-fonts.symbols-only
nerd-fonts.droid-sans-mono
nerd-fonts.monofur
font-awesome
lxgw-wenkai
nasin-nanpa
];
fonts.fontDir.enable = true;
}

29
os/system/stylix.nix Normal file
View file

@ -0,0 +1,29 @@
{
self,
lib,
host,
user,
...
}:
let
cfg = self.homeConfigurations."${user}@${host}".config;
in
{
stylix = {
enable = true;
base16Scheme = lib.mkDefault cfg.stylix.base16Scheme;
autoEnable = false;
targets = {
console.enable = true;
gnome.enable = true;
grub.enable = true;
plymouth.enable = true;
};
};
specialisation = builtins.mapAttrs (name: value: {
configuration = {
stylix.base16Scheme = lib.mkForce cfg.specialisation.${name}.configuration.stylix.base16Scheme;
environment.etc."specialisation".text = name;
};
}) cfg.specialisation;
}