调整项目结构和readme

This commit is contained in:
2025-05-09 14:40:19 +08:00
parent 79d3ca7ec4
commit 05c8ab6c82
28 changed files with 373 additions and 345 deletions

View File

@@ -2,11 +2,29 @@ args@{ libs, inputs, nixos, ... }:
let
# 使用pkgs.unstable中的nixpkgs和home-manager
inherit (nixos.unstable) nixpkgs home-manager version;
sysArgs = args // { inherit home-manager version; };
specialArgs = args // { inherit home-manager version; };
configuration = conf-args@{ self, pkgs, home-manager, username, version, ... }: {
imports = [
./nixos
home-manager.nixosModules.home-manager
{
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
home-manager = {
extraSpecialArgs = {
inherit (conf-args) self inputs outputs libs sourcepath hostname username useremail version;
};
users."${username}" = ./home;
};
}
];
};
in
# 使用libs.mkNixosSystem创建nixosSystem
libs.mkNixosSystem {
inherit nixpkgs;
args = sysArgs;
path = ./.;
nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
configuration
];
}

View File

@@ -1,66 +0,0 @@
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

@@ -1,6 +1,8 @@
{ self, pkgs, ... }: {
imports = [
./ssh
"${self}/home/desktop.nix"
"${self}/modules/home/develop.nix"
];
home.packages = with pkgs; [

View File

@@ -0,0 +1,64 @@
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

@@ -1,58 +0,0 @@
{ 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;
# bridges = {
# br0 = { interfaces = [ "eno1" ]; };
# };
# Set up bridge network
interfaces = {
eno1 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.7.43.10";
prefixLength = 24;
}
];
wakeOnLan = {
enable = true;
policy = [
"magic"
];
};
};
# br0 = {
# useDHCP = false;
# ipv4.addresses = [
# {
# address = "10.7.43.10";
# prefixLength = 24;
# }
# ];
# };
};
defaultGateway = {
address = "10.7.43.30";
interface = "eno1";
# interface = "br0";
};
nameservers = [ "10.7.43.1" ];
};
}

View File

@@ -1,5 +1,4 @@
args@{ self, pkgs, home-manager, username, version, ... }: {
# You can import other NixOS modules here
{ self, pkgs, username, version, ... }: {
imports = [
./mount.nix
./network.nix
@@ -9,28 +8,10 @@ args@{ self, pkgs, home-manager, username, version, ... }: {
"${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 (args) self inputs outputs libs sourcepath hostname username useremail version;
};
users."${username}" = { ... }: {
imports = [
./hm
"${self}/home/desktop.nix"
"${self}/modules/home/develop.nix"
];
};
};
}
"${self}/modules/nixos/gnome.nix"
];
hardware.graphics = {

View File

@@ -0,0 +1,42 @@
{ config, pkgs, hostname, ... }: {
networking = {
hostId = "6fa8b74d";
hostName = "${hostname}";
networkmanager = {
enable = true;
ensureProfiles.profiles = {
"eno1" = {
connection = {
id = "eno1";
type = "ethernet"; # 有线连接
autoconnect = true; # 自动连接
};
ipv4 = {
method = "manual"; # 设置为手动配置 IPv4
addresses = "10.7.43.10/24,10.7.43.30";
# 如果需要,可以添加 DNS 服务器
# dns = [ "10.7.43.1" "8.8.8.8" ];
};
ipv6 = {
method = "auto"; # 设置为自动配置 IPv6 (动态)
};
ethernet = {
wake-on-lan=64;
};
};
};
};
interfaces = {
eno1 = {
wakeOnLan = {
enable = true;
policy = [
"magic"
];
};
};
};
};
}