This commit is contained in:
2025-04-25 23:10:55 +08:00
commit ccf46b865e
114 changed files with 6419 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
args@{ inputs, outputs, lib, pkgs, home-manager, self, username, useremail, hostname, sysversion, ... }: {
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# ./users.nix
# Import your generated (nixos-generate-config) hardware configuration
./mount.nix
./network.nix
./hardware-configuration.nix
"${self}/modules/nixos/core"
"${self}/modules/nixos/fonts"
"${self}/modules/nixos/user.nix"
"${self}/modules/nixos/audio.nix"
"${self}/modules/nixos/samba.nix"
"${self}/modules/nixos/virtualize/appimage.nix"
"${self}/modules/nixos/virtualize/docker.nix"
home-manager.nixosModules.home-manager
{
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs outputs hostname username useremail sysversion;
};
home-manager.users."${username}" = { ... }: {
imports = [
./hm
"${self}/home/desktop.nix"
"${self}/modules/home/develop.nix"
];
};
}
];
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
vaapiIntel
intel-media-driver
];
};
services = {
gnome.gnome-keyring.enable = true;
};
security.pam.services.swaylock = { };
programs.zsh = {
enable = true;
};
users.users."${username}".shell = pkgs.zsh;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = sysversion;
}

View File

@@ -0,0 +1,14 @@
args@{ libs, inputs, ... }:
let
# 这里可以选择使用稳定版或不稳定版的nixpkgs
# nixpkgs = inputs.nixpkgs;
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本取消这行注释并注释上一行
home-manager = inputs.home-manager-unstable;
sysArgs = args // { inherit home-manager; };
in
# 使用libs.mkNixosSystem创建nixosSystem
libs.mkNixosSystem {
inherit nixpkgs;
args = sysArgs;
path = ./.;
}

View File

@@ -0,0 +1,58 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FE53-DFFA";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=home" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,6 @@
{ ... }: {
imports = [
./ssh
./hyprland.nix
];
}

View File

@@ -0,0 +1,11 @@
{ ... }:
{
home = {
sessionVariables = {
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
# 启用注释部分会导致NVIDIA下无法启动hyprland
WLR_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0";
};
};
}

View File

@@ -0,0 +1,66 @@
Host *
ForwardAgent no
AddKeysToAgent no
Compression no
ServerAliveInterval 0
ServerAliveCountMax 3
HashKnownHosts no
UserKnownHostsFile ~/.ssh/known_hosts
ControlMaster no
ControlPath ~/.ssh/master-%r@%n:%p
ControlPersist no
Host gaea
HostName 10.7.43.20
Host zion
HostName 10.7.43.1
User root
Host themis
HostName 10.7.43.30
Host armor
HostName armor.synebula.com
Host server.company
HostName file.xzdcbj.com.cn
User xzdc
Port 57982
Host server.info
HostName info.xzdcbj.com.cn
User info
Host server.file
HostName file.xzdcbj.com.cn
User file
Host server.armor
HostName armor.synebula.com
Host ems.hc
Port 57991
User root
Host ems.cx
Port 57996
Host ems.ph
Port 57996
Host ems.yt
Port 57996
User xzdc
Host ems.*
HostName file.xzdcbj.com.cn
User ems
Host *
Port 22
User alex
IdentityFile ~/.ssh/id_rsa

View File

@@ -0,0 +1,10 @@
{ config, ... }:
{
programs.ssh = {
enable = true;
};
home.file.".ssh/config" = {
source = ./config;
};
}

91
profiles/apollo/mount.nix Normal file
View File

@@ -0,0 +1,91 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ lib, username, ... }: {
swapDevices = [{
device = "/swap/swapfile";
size = 16 * 1024;
}];
fileSystems = {
"/" = {
options = lib.mkOptionDefault [ "compress=zstd" ];
};
"/nix" = {
options = lib.mkOptionDefault [ "compress=zstd" "noatime" ];
};
"/home" = {
options = lib.mkOptionDefault [ "compress=zstd" ];
};
"/swap" = {
options = lib.mkOptionDefault [ "compress=no" ];
};
"/tmp" =
{
device = "tmpfs";
fsType = "tmpfs";
};
# data目录
"/data/cache" =
{
device = "/dev/mapper/vcache-data";
fsType = "ext4";
};
"/data/arch" =
{
device = "/dev/mapper/varch-data";
fsType = "ext4";
};
# 用户目录
"/home/${username}/tmp" =
{
device = "tmpfs";
fsType = "tmpfs";
options = [ "uid=1000" "gid=100" "defaults" "size=16G" "mode=755" ];
};
"/home/${username}/data" =
{
device = "/dev/disk/by-uuid/c52805e6-7d25-4930-806d-585f303b5572";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=data" ];
};
"/home/${username}/srv" =
{
device = "/dev/disk/by-uuid/c52805e6-7d25-4930-806d-585f303b5572";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=srv" ];
};
"/home/${username}/priv" =
{
device = "/dev/disk/by-uuid/c52805e6-7d25-4930-806d-585f303b5572";
fsType = "btrfs";
options = [ "compress=zstd" "subvol=priv" ];
};
# 微信相关
"/home/${username}/.local/WeChat/xwechat_files/zerociqher_516a/temp/ImageUtils" =
{
device = "tmpfs";
fsType = "tmpfs";
options = [ "uid=1000" "gid=100" "defaults" "size=4G" "mode=755" ];
};
"/home/${username}/.local/WeChat/xwechat_files/zerociqher_516a/temp/InputTemp" =
{
device = "tmpfs";
fsType = "tmpfs";
options = [ "uid=1000" "gid=100" "defaults" "size=4G" "mode=755" ];
};
};
}

View File

@@ -0,0 +1,42 @@
{ config, pkgs, hostname, ... }: {
networking = {
hostId = "6fa8b74d";
hostName = "${hostname}";
wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networkmanager = {
enable = true;
};
enableIPv6 = true;
# Set up bridge network
interfaces.eno1 = {
useDHCP = false;
};
bridges = {
br0 = { interfaces = [ "eno1" ]; };
};
interfaces.br0 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.7.43.10";
prefixLength = 24;
}
];
};
defaultGateway = {
address = "10.7.43.30";
interface = "br0";
};
nameservers = [ "10.7.43.1" ];
};
}

View File

@@ -0,0 +1,52 @@
args@{ inputs, outputs, lib, pkgs, home-manager, self, username, useremail, hostname, sysversion, ... }: {
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# ./users
# Import your generated (nixos-generate-config) hardware configuration
./mount.nix
./network.nix
./hardware-configuration.nix
"${self}/modules/nixos/core"
"${self}/modules/nixos/fonts"
"${self}/modules/nixos/user.nix"
"${self}/modules/nixos/audio.nix"
"${self}/modules/nixos/nvidia.nix"
"${self}/modules/nixos/samba.nix"
"${self}/modules/nixos/zfs.nix"
"${self}/modules/nixos/sysatomic.nix"
"${self}/modules/nixos/virtualize/libvirtd"
"${self}/modules/nixos/virtualize/docker.nix"
home-manager.nixosModules.home-manager
{
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
home-manager = {
extraSpecialArgs = {
inherit inputs outputs hostname username useremail sysversion;
};
users."${username}" = { ... }: {
imports = [
./hm
"${self}/home/desktop.nix"
"${self}/modules/home/develop.nix"
];
};
};
}
];
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = sysversion;
}

14
profiles/gaea/default.nix Normal file
View File

@@ -0,0 +1,14 @@
args@{ libs, inputs, ... }:
let
# 这里可以选择使用稳定版或不稳定版的nixpkgs
# nixpkgs = inputs.nixpkgs;
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本取消这行注释并注释上一行
home-manager = inputs.home-manager-unstable;
sysArgs = args // { inherit home-manager; };
in
# 使用libs.mkNixosSystem创建nixosSystem
libs.mkNixosSystem {
inherit nixpkgs;
args = sysArgs;
path = ./.;
}

View File

@@ -0,0 +1,58 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FE53-DFFA";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=home" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,6 @@
{ ... }: {
imports = [
./ssh.nix
./hyprland.nix
];
}

View File

@@ -0,0 +1,15 @@
{ ... }:
{
home = {
sessionVariables = {
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
# 启用注释部分会导致NVIDIA下无法启动hyprland
LIBVA_DRIVER_NAME = "nvidia";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
# WLR_RENDERER = "vulkan";
# GBM_BACKEND = "nvidia-drm";
};
};
}

61
profiles/gaea/hm/ssh.nix Normal file
View File

@@ -0,0 +1,61 @@
{ config, ... }:
{
programs.ssh = {
enable = true;
# 全局 SSH 配置
extraConfig = ''
Host apollo
HostName 10.7.43.10
Host zion
HostName 10.7.43.1
User root
Host themis
HostName 10.7.43.30
Host armor
HostName armor.synebula.com
Host server.company
HostName file.xzdcbj.com.cn
User xzdc
Port 57982
Host server.info
HostName info.xzdcbj.com.cn
User info
Host server.file
HostName file.xzdcbj.com.cn
User file
Host server.armor
HostName armor.synebula.com
Host ems.hc
Port 57991
User root
Host ems.cx
Port 57996
Host ems.ph
Port 57996
Host ems.yt
Port 57996
User xzdc
Host ems.*
HostName file.xzdcbj.com.cn
User ems
Host *
Port 22
User alex
IdentityFile ~/.ssh/id_rsa
'';
};
}

26
profiles/gaea/mount.nix Normal file
View File

@@ -0,0 +1,26 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, username, ... }:
{
fileSystems."/home/${username}/tmp" =
{
device = "none";
fsType = "tmpfs";
options = [ "uid=1000" "gid=100" "defaults" "size=8G" "mode=755" ];
};
fileSystems."/tmp" =
{
device = "tmpfs";
fsType = "tmpfs";
};
swapDevices = [{
device = "/var/swapfile";
size = 16 * 1024;
}];
}

42
profiles/gaea/network.nix Normal file
View File

@@ -0,0 +1,42 @@
{ config, pkgs, hostname, ... }: {
networking = {
hostId = "5def12be";
hostName = "${hostname}";
wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networkmanager = {
enable = true;
};
enableIPv6 = true;
# Set up bridge network
interfaces.eno1 = {
useDHCP = false;
};
bridges = {
br0 = { interfaces = [ "eno1" ]; };
};
interfaces.br0 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.7.43.20";
prefixLength = 24;
}
];
};
defaultGateway = {
address = "10.7.43.1";
interface = "br0";
};
nameservers = [ "119.29.29.29" "223.5.5.5" ];
};
}

View File

@@ -0,0 +1,42 @@
args@{ inputs, outputs, lib, pkgs, home-manager, self, username, useremail, hostname, sysversion, ... }: {
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# ./users.nix
# Import your generated (nixos-generate-config) hardware configuration
./network.nix
./hardware-configuration.nix
"${self}/modules/nixos/core"
"${self}/modules/nixos/user.nix"
"${self}/modules/nixos/sysatomic.nix"
home-manager.nixosModules.home-manager
{
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
home-manager = {
extraSpecialArgs = {
inherit inputs outputs hostname username useremail sysversion;
};
users."${username}" = { ... }: {
imports = [
"${self}/home/desktop.nix"
];
};
};
}
];
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = sysversion;
}

14
profiles/luna/default.nix Normal file
View File

@@ -0,0 +1,14 @@
args@{ libs, inputs, ... }:
let
# 这里可以选择使用稳定版或不稳定版的nixpkgs
# nixpkgs = inputs.nixpkgs;
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本取消这行注释并注释上一行
home-manager = inputs.home-manager-unstable;
sysArgs = args // { inherit home-manager; };
in
# 使用libs.mkNixosSystem创建nixosSystem
libs.mkNixosSystem {
inherit nixpkgs;
args = sysArgs;
path = ./.;
}

View File

@@ -0,0 +1,58 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FE53-DFFA";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=swap" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
fsType = "btrfs";
options = [ "subvol=home" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

30
profiles/luna/network.nix Normal file
View File

@@ -0,0 +1,30 @@
# 网络配置
{ config, lib, pkgs, ... }:
{
networking = {
wireless.enable = false; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networkmanager.enable = true;
enableIPv6 = false; # disable ipv6
interfaces.enp0s3 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.7.45.130";
prefixLength = 24;
}
];
};
defaultGateway = "10.7.45.1";
nameservers = [
"119.29.29.29" # DNSPod
"223.5.5.5" # AliDNS
];
};
}