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 = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -39,7 +39,12 @@
};
outputs =
{ self, nixpkgs, nix-index-database, ... }@inputs:
{
self,
nixpkgs,
nix-index-database,
...
}@inputs:
let
system = "x86_64-linux";
nix-version = "25.05";

View file

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

View file

@ -23,7 +23,6 @@
NIXOS_XDG_OPEN_USE_PORTAL = "1";
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
#XDG_BIN_HOME = "\${HOME}/.local/bin";
XDG_DATA_HOME = "\${HOME}/.local/share";
GTK_IM_MODULE = "";
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
userName = "dachxy";
email = "Danny10132024@gmail.com";
userName = git-config.username;
email = git-config.email;
in
{
programs.git = {

View file

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

View file

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

View file

@ -2,11 +2,12 @@
{
boot.loader.systemd-boot.enable = true;
# Enable F keys in some wireless keyboard (Ex. neo65)
boot.extraModprobeConfig = ''
options hid_apple fnmode=2
'';
boot.initrd.systemd.enable = true;
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
cursor-size = "24";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in
{
imports = [
@ -19,8 +30,18 @@ in
system.stateVersion = nix-version;
home-manager = {
backupFileExtension = "hm-backup";
extraSpecialArgs = { inherit inputs system nix-version cursor-size; };
users."danny" = { imports = [ ../../../home ]; };
extraSpecialArgs = {
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.kernelParams =
[ "nvidia-drm.fbdev=1" "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
boot.kernelParams = [
"nvidia-drm.fbdev=1"
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
];
# Enable F keys in some wireless keyboard (Ex. neo65)
boot.extraModprobeConfig = ''
options hid_apple fnmode=2
options nvidia_drm modeset=1 dbdev=1
'';
boot.initrd.systemd.enable = true;
boot.initrd.kernelModules =
[ "nvidia" "i915" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
boot.initrd.kernelModules = [
"nvidia"
"i915"
"nvidia_modeset"
"nvidia_uvm"
"nvidia_drm"
];
boot.swraid.enable = true;
boot.swraid.mdadmConf =
"\n MAILADDR smitty\n ARRAY /dev/md126 metadata=1.2 name=stuff:0\n UUID=3b0b7c51-2681-407e-a22a-e965a8aeece7\n ";
boot.swraid.mdadmConf = "\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
cursor-size = "32";
username = "danny";
git-config = {
username = "DACHXY";
email = "danny10132024@gmail.com";
};
in
{
imports = [
@ -23,8 +34,18 @@ in
backupFileExtension = "hm-backup";
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs system nix-version cursor-size; };
users."danny" = { imports = [ ../../../home ]; };
extraSpecialArgs = {
inherit
inputs
system
nix-version
cursor-size
git-config
username
;
};
users."${username}" = {
imports = [ ../../../home ];
};
};
}

View file

@ -1,15 +1,21 @@
{ ... }:
{
# Scheduled auto upgrade system (this is only for system upgrades,
# if you want to upgrade cargo\npm\pip global packages, docker containers or different part of the system
# Scheduled auto upgrade system (this is only for system upgrades,
# if you want to upgrade cargo\npm\pip global packages, docker containers or different part of the system
# or get really full system upgrade, use `topgrade` CLI utility manually instead.
# I recommend running `topgrade` once a week or at least once a month)
system.autoUpgrade = {
enable = true;
operation = "switch"; # If you don't want to apply updates immediately, only after rebooting, use `boot` option in this case
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";
# channel = "https://nixos.org/channels/nixos-unstable";
};

View file

@ -2,24 +2,10 @@
{
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 = {
# sddm.wayland.enable = true;
sddm.wayland.enable = true;
sddm.enable = true;
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 = [
''
-----BEGIN CERTIFICATE-----

View file

@ -1,25 +1,37 @@
{ pkgs, nix-version, ... }:
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
{
fonts.packages = (with pkgs; [
font-awesome
jetbrains-mono
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
]) ++ ([
nerdfont-pkg
]);
fonts.packages =
(with pkgs; [
font-awesome
jetbrains-mono
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
])
++ ([
nerdfont-pkg
]);
fonts.fontDir.enable = true;
fonts.fontconfig = {
enable = true;
defaultFonts = {
serif = [ "CaskaydiaCove Nerd Font" "Noto Sans CJK" ];
sansSerif = [ "CaskaydiaCove Nerd Font" "Noto Sans CJK" ];
serif = [
"CaskaydiaCove Nerd Font"
"Noto Sans CJK"
];
sansSerif = [
"CaskaydiaCove Nerd Font"
"Noto Sans CJK"
];
monospace = [ "CaskaydiaCove Nerd Font Mono" ];
};
cache32Bit = true;

View file

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

View file

@ -1,9 +1,16 @@
{ config, pkgs, ... }:
{ username, pkgs, ... }:
{
users.users.danny = {
users.users.${username} = {
isNormalUser = true;
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;
users.groups.libvirtd.members = [ "danny" ];
users.groups.libvirtd.members = [ username ];
virtualisation = {
docker.enable = true;

View file

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