diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e1da6a --- /dev/null +++ b/README.md @@ -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/ +├── +    ├── 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 = { + = nixpkgs.lib.nixosSystem { + modules = [ + nix-index-database.nixosModules.nix-index + ./system/dev/ + ]; + specialArgs = { + inherit inputs system nix-version; + }; + }; +}; +``` + +### ❄️ Flake + +> home manager is configured to rebuild with NixOS + +OS Install + +```bash +nixos-install --flake .# +``` + +Rebuild Switch + +```bash +nixos-rebuild switch --flake .# +``` diff --git a/flake.nix b/flake.nix index a128e6f..87021b2 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/home/default.nix b/home/default.nix index a9d2682..5cc8fe8 100644 --- a/home/default.nix +++ b/home/default.nix @@ -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; diff --git a/home/user/environment.nix b/home/user/environment.nix index b70c48a..b0af410 100644 --- a/home/user/environment.nix +++ b/home/user/environment.nix @@ -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"; diff --git a/home/user/git.nix b/home/user/git.nix index e19a4f9..9279791 100644 --- a/home/user/git.nix +++ b/home/user/git.nix @@ -1,6 +1,7 @@ +{ git-config }: let - userName = "dachxy"; - email = "Danny10132024@gmail.com"; + userName = git-config.username; + email = git-config.email; in { programs.git = { diff --git a/home/user/shell.nix b/home/user/shell.nix index 4649c1d..ee8a924 100644 --- a/home/user/shell.nix +++ b/home/user/shell.nix @@ -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; }; diff --git a/home/user/swaync.nix b/home/user/swaync.nix index d651a99..eb44e53 100644 --- a/home/user/swaync.nix +++ b/home/user/swaync.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { services.swaync = { enable = true; diff --git a/system/dev/dn-lap/boot.nix b/system/dev/dn-lap/boot.nix index de17aab..096bf42 100644 --- a/system/dev/dn-lap/boot.nix +++ b/system/dev/dn-lap/boot.nix @@ -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; } diff --git a/system/dev/dn-lap/default.nix b/system/dev/dn-lap/default.nix index 108330c..1a5997d 100644 --- a/system/dev/dn-lap/default.nix +++ b/system/dev/dn-lap/default.nix @@ -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 ]; + }; }; } - diff --git a/system/dev/dn-pre7780/boot.nix b/system/dev/dn-pre7780/boot.nix index 5462f14..2ff81b5 100644 --- a/system/dev/dn-pre7780/boot.nix +++ b/system/dev/dn-pre7780/boot.nix @@ -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 "; } diff --git a/system/dev/dn-pre7780/default.nix b/system/dev/dn-pre7780/default.nix index 064ce40..10311c2 100644 --- a/system/dev/dn-pre7780/default.nix +++ b/system/dev/dn-pre7780/default.nix @@ -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 ]; + }; }; } - diff --git a/system/modules/auto-upgrade.nix b/system/modules/auto-upgrade.nix index f23cd1d..fdff674 100644 --- a/system/modules/auto-upgrade.nix +++ b/system/modules/auto-upgrade.nix @@ -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"; }; diff --git a/system/modules/display-manager.nix b/system/modules/display-manager.nix index a7dfa8e..169702c 100644 --- a/system/modules/display-manager.nix +++ b/system/modules/display-manager.nix @@ -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 - # ]; } diff --git a/system/modules/dn-ca.nix b/system/modules/dn-ca.nix index bf4e5ed..e8cfa9b 100644 --- a/system/modules/dn-ca.nix +++ b/system/modules/dn-ca.nix @@ -1,6 +1,7 @@ { ... }: { + # This is my CA root cerificate, you shall delete it security.pki.certificates = [ '' -----BEGIN CERTIFICATE----- diff --git a/system/modules/fonts.nix b/system/modules/fonts.nix index 1947ca6..de64874 100644 --- a/system/modules/fonts.nix +++ b/system/modules/fonts.nix @@ -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; diff --git a/system/modules/services.nix b/system/modules/services.nix index ea9fbd9..469e28c 100644 --- a/system/modules/services.nix +++ b/system/modules/services.nix @@ -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; diff --git a/system/modules/users.nix b/system/modules/users.nix index b45b923..2459a25 100644 --- a/system/modules/users.nix +++ b/system/modules/users.nix @@ -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" + ]; }; } diff --git a/system/modules/virtualization.nix b/system/modules/virtualization.nix index 46468b8..6ebff24 100644 --- a/system/modules/virtualization.nix +++ b/system/modules/virtualization.nix @@ -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; diff --git a/system/modules/wireguard.nix b/system/modules/wireguard.nix index 664340a..04ab5e5 100644 --- a/system/modules/wireguard.nix +++ b/system/modules/wireguard.nix @@ -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 + { }; }