docs: add README.md

This commit is contained in:
dachxy 2025-01-03 13:59:16 +08:00
parent fe1d9adfa8
commit 1c2b263904
19 changed files with 241 additions and 73 deletions

91
README.md Normal file
View file

@ -0,0 +1,91 @@
# 🚀 NixOS With Hyprland
---
## ✨ Main Applications
- [X] Hyprland (uwsm support)
- [X] Neovim
- ✅ [lazyvim](https://github.com/LazyVim/LazyVim)
- ✅ [treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- ❌ mason (not support on NixOS)
- [X] Waybar
- [X] Swayidle
- [X] Swaync (Notification Center)
- [X] Hyprpaper (Wallpaper)
- [X] Ghostty (Terminal)
- [X] SDDM (Display Manager)
- [X] Fish (shell)
- [X] Lofi (Application Launcher)
## 🎈 Theme
- Catppuccin (Macchiato Lavender)
- plymouth (Boot Splash)
## 🎮️ Game
- Steam
- Xbox wireless controller
## 🧠 Virtualization
- Virt Manager (libvirt)
- Windows 11 example config: [win11_kvm.xml](./home/config/vm/win11_kvm.xml)
## ⌨️ Input (Fcitx5)
- Rime (bopomofo, pinyin)
- Mozc (Japanese)
## 🌐 VPN
- Wireguard (You need put your own `wg0.conf` file)
---
## 💿️ Installation
> Your need to add your own device [flake.nix](./flake.nix), and create configuration in [system/dev](./system/dev/) (don't forget the `hardware-configuration.nix` generated with `nixos-generate-config`)
### Example
```
system/dev/
├── <your-device-name>
   ├── boot.nix # You can add extra boot options here
   ├── default.nix # Import modules you need
   └── hardware-configuration.nix # Your hardware configuration
```
`flake.nix`
```nix
nixosConfigurations = {
<your-device-name> = nixpkgs.lib.nixosSystem {
modules = [
nix-index-database.nixosModules.nix-index
./system/dev/<your-device-name>
];
specialArgs = {
inherit inputs system nix-version;
};
};
};
```
### ❄️ Flake
> home manager is configured to rebuild with NixOS
OS Install
```bash
nixos-install --flake .#<your device name>
```
Rebuild Switch
```bash
nixos-rebuild switch --flake .#<your device name>
```

View file

@ -1,5 +1,5 @@
{ {
description = "danny NixOS"; description = "DACHXY NixOS with hyprland";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -39,7 +39,12 @@
}; };
outputs = outputs =
{ self, nixpkgs, nix-index-database, ... }@inputs: {
self,
nixpkgs,
nix-index-database,
...
}@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
nix-version = "25.05"; nix-version = "25.05";

View file

@ -1,9 +1,9 @@
{ nix-version, ... }: { nix-version, username, ... }:
{ {
imports = [ ./user ]; imports = [ ./user ];
home.username = "danny"; home.username = username;
home.homeDirectory = "/home/danny"; home.homeDirectory = "/home/${username}";
home.stateVersion = nix-version; home.stateVersion = nix-version;

View file

@ -23,7 +23,6 @@
NIXOS_XDG_OPEN_USE_PORTAL = "1"; NIXOS_XDG_OPEN_USE_PORTAL = "1";
XDG_CACHE_HOME = "\${HOME}/.cache"; XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config"; XDG_CONFIG_HOME = "\${HOME}/.config";
#XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share"; XDG_DATA_HOME = "\${HOME}/.local/share";
GTK_IM_MODULE = ""; GTK_IM_MODULE = "";
XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share"; XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share";

View file

@ -1,6 +1,7 @@
{ git-config }:
let let
userName = "dachxy"; userName = git-config.username;
email = "Danny10132024@gmail.com"; email = git-config.email;
in in
{ {
programs.git = { programs.git = {

View file

@ -4,19 +4,16 @@ let
in in
{ {
programs = { programs = {
# nushell = {
# enable = true;
# configFile.source = ../config/nushell/config.nu;
# envFile.source = ../config/nushell/env.nu;
# };
fish = { fish = {
enable = true; enable = true;
interactiveShellInit = '' interactiveShellInit = ''
set fish_greeting # Disable greeting set fish_greeting # Disable greeting
''; '';
plugins = [ plugins = [
{ name = "grc"; src = pkgs.fishPlugins.grc.src; } {
name = "grc";
src = pkgs.fishPlugins.grc.src;
}
]; ];
shellAliases = shellAlias; shellAliases = shellAlias;
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { ... }:
{ {
services.swaync = { services.swaync = {
enable = true; enable = true;

View file

@ -2,11 +2,12 @@
{ {
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
# Enable F keys in some wireless keyboard (Ex. neo65)
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options hid_apple fnmode=2 options hid_apple fnmode=2
''; '';
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = [ "i915" ]; boot.initrd.kernelModules = [ "i915" ];
boot.swraid.enable = true;
} }

View file

@ -1,7 +1,18 @@
{ lib, system, inputs, nix-version, ... }: {
lib,
system,
inputs,
nix-version,
...
}:
let let
cursor-size = "24"; cursor-size = "24";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in in
{ {
imports = [ imports = [
@ -19,8 +30,18 @@ in
system.stateVersion = nix-version; system.stateVersion = nix-version;
home-manager = { home-manager = {
backupFileExtension = "hm-backup"; backupFileExtension = "hm-backup";
extraSpecialArgs = { inherit inputs system nix-version cursor-size; }; extraSpecialArgs = {
users."danny" = { imports = [ ../../../home ]; }; inherit
inputs
system
nix-version
cursor-size
git-config
username
;
};
users."${username}" = {
imports = [ ../../../home ];
};
}; };
} }

View file

@ -1,18 +1,26 @@
{ config, pkgs, lib, ... }: { ... }:
{ {
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.kernelParams = boot.kernelParams = [
[ "nvidia-drm.fbdev=1" "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; "nvidia-drm.fbdev=1"
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
];
# Enable F keys in some wireless keyboard (Ex. neo65)
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options hid_apple fnmode=2 options hid_apple fnmode=2
options nvidia_drm modeset=1 dbdev=1 options nvidia_drm modeset=1 dbdev=1
''; '';
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
boot.initrd.kernelModules = boot.initrd.kernelModules = [
[ "nvidia" "i915" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; "nvidia"
"i915"
"nvidia_modeset"
"nvidia_uvm"
"nvidia_drm"
];
boot.swraid.enable = true; boot.swraid.enable = true;
boot.swraid.mdadmConf = boot.swraid.mdadmConf = "\n MAILADDR smitty\n ARRAY /dev/md126 metadata=1.2 name=stuff:0\n UUID=3b0b7c51-2681-407e-a22a-e965a8aeece7\n ";
"\n MAILADDR smitty\n ARRAY /dev/md126 metadata=1.2 name=stuff:0\n UUID=3b0b7c51-2681-407e-a22a-e965a8aeece7\n ";
} }

View file

@ -1,7 +1,18 @@
{ lib, inputs, system, nix-version, ... }: {
lib,
inputs,
system,
nix-version,
...
}:
let let
cursor-size = "32"; cursor-size = "32";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in in
{ {
imports = [ imports = [
@ -23,8 +34,18 @@ in
backupFileExtension = "hm-backup"; backupFileExtension = "hm-backup";
useUserPackages = true; useUserPackages = true;
useGlobalPkgs = true; useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs system nix-version cursor-size; }; extraSpecialArgs = {
users."danny" = { imports = [ ../../../home ]; }; inherit
inputs
system
nix-version
cursor-size
git-config
username
;
};
users."${username}" = {
imports = [ ../../../home ];
};
}; };
} }

View file

@ -9,7 +9,13 @@
enable = true; enable = true;
operation = "switch"; # If you don't want to apply updates immediately, only after rebooting, use `boot` option in this case operation = "switch"; # If you don't want to apply updates immediately, only after rebooting, use `boot` option in this case
flake = "/etc/nixos"; flake = "/etc/nixos";
flags = [ "--update-input" "nixpkgs" "--update-input" "rust-overlay" "--commit-lock-file" ]; flags = [
"--update-input"
"nixpkgs"
"--update-input"
"rust-overlay"
"--commit-lock-file"
];
dates = "weekly"; dates = "weekly";
# channel = "https://nixos.org/channels/nixos-unstable"; # channel = "https://nixos.org/channels/nixos-unstable";
}; };

View file

@ -2,24 +2,10 @@
{ {
services = { services = {
# greetd = {
# enable = true;
# settings = {
# default_session = {
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --time-format '%I:%M %p | %a • %h | %F' --cmd Hyprland";
# user = "danny";
# };
# };
# };
displayManager = { displayManager = {
# sddm.wayland.enable = true; sddm.wayland.enable = true;
sddm.enable = true; sddm.enable = true;
sddm.theme = "${import ./sddm-theme.nix { inherit pkgs; }}"; sddm.theme = "${import ./sddm-theme.nix { inherit pkgs; }}";
}; };
}; };
# environment.systemPackages = with pkgs; [
# greetd.tuigreet
# ];
} }

View file

@ -1,6 +1,7 @@
{ ... }: { ... }:
{ {
# This is my CA root cerificate, you shall delete it
security.pki.certificates = [ security.pki.certificates = [
'' ''
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----

View file

@ -1,15 +1,21 @@
{ pkgs, nix-version, ... }: { pkgs, nix-version, ... }:
let let
nerdfont-pkg = if nix-version == "25.05" then pkgs.nerd-fonts.caskaydia-cove else (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; }); nerdfont-pkg =
if nix-version == "25.05" then
pkgs.nerd-fonts.caskaydia-cove
else
(pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; });
in in
{ {
fonts.packages = (with pkgs; [ fonts.packages =
(with pkgs; [
font-awesome font-awesome
jetbrains-mono jetbrains-mono
noto-fonts-cjk-sans noto-fonts-cjk-sans
noto-fonts-cjk-serif noto-fonts-cjk-serif
noto-fonts-emoji noto-fonts-emoji
]) ++ ([ ])
++ ([
nerdfont-pkg nerdfont-pkg
]); ]);
@ -18,8 +24,14 @@ in
fonts.fontconfig = { fonts.fontconfig = {
enable = true; enable = true;
defaultFonts = { defaultFonts = {
serif = [ "CaskaydiaCove Nerd Font" "Noto Sans CJK" ]; serif = [
sansSerif = [ "CaskaydiaCove Nerd Font" "Noto Sans CJK" ]; "CaskaydiaCove Nerd Font"
"Noto Sans CJK"
];
sansSerif = [
"CaskaydiaCove Nerd Font"
"Noto Sans CJK"
];
monospace = [ "CaskaydiaCove Nerd Font Mono" ]; monospace = [ "CaskaydiaCove Nerd Font Mono" ];
}; };
cache32Bit = true; cache32Bit = true;

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { username, pkgs, ... }:
{ {
systemd.services.flatpak-repo = { systemd.services.flatpak-repo = {
@ -20,7 +20,7 @@
ports = [ 22 ]; ports = [ 22 ];
settings = { settings = {
PasswordAuthentication = false; PasswordAuthentication = false;
AllowUsers = [ "danny" ]; AllowUsers = [ username ];
UseDns = true; UseDns = true;
PermitRootLogin = "no"; PermitRootLogin = "no";
}; };
@ -31,7 +31,6 @@
xkb.layout = "us"; xkb.layout = "us";
}; };
# USB auto mount # USB auto mount
gvfs.enable = true; gvfs.enable = true;
udisks2.enable = true; udisks2.enable = true;

View file

@ -1,9 +1,16 @@
{ config, pkgs, ... }: { username, pkgs, ... }:
{ {
users.users.danny = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.bash; # Actually fish shell = pkgs.bash; # Actually fish
extraGroups = [ "wheel" "input" "networkmanager" "docker" "libvirtd" "kvm" ]; extraGroups = [
"wheel"
"input"
"networkmanager"
"docker"
"libvirtd"
"kvm"
];
}; };
} }

View file

@ -1,8 +1,13 @@
{ pkgs, config, ... }: {
username,
pkgs,
config,
...
}:
{ {
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
users.groups.libvirtd.members = [ "danny" ]; users.groups.libvirtd.members = [ username ];
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;

View file

@ -1,8 +1,16 @@
{ config, pkgs, ... }: { ... }:
let let
configPath = "/etc/wireguard/wg0.conf"; configPath = "/etc/wireguard/wg0.conf";
in in
{ {
networking.firewall = { allowedUDPPorts = [ 51820 ]; }; networking.firewall = {
networking.wg-quick.interfaces.wg0.configFile = configPath; allowedUDPPorts = [ 51820 ];
};
networking.wg-quick.interfaces.wg0 =
if builtins.pathExists configPath then
{
configFile = configPath;
}
else
{ };
} }