move some nixos configuration to ./nixos/modules and ./nixos/configurations. try to find a good arch to conbine home-manager and nixos modules.

This commit is contained in:
Ulic-youthlic 2025-01-07 22:41:55 +08:00
parent 6be554822c
commit 64db779064
32 changed files with 534 additions and 635 deletions

View file

@ -11,15 +11,6 @@
}:
{
# Bootloader.
boot.kernelPackages = pkgs.linuxPackages_zen;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# services.asusd = {
# enable = true;
# };
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
@ -29,54 +20,6 @@
spiceUSBRedirection.enable = true;
};
networking = {
hostName = "Tytonidae";
networkmanager.enable = false;
useNetworkd = true;
useDHCP = false;
wireless.iwd = {
enable = true;
settings = {
General = {
EnableNetworkConfiguration = true;
};
Network = {
EnableIPv6 = true;
NameResolvingService = "systemd";
};
};
};
};
systemd.network = {
enable = true;
wait-online.enable = false;
networks = {
"eno2" = {
matchConfig.Name = "eno2";
networkConfig = {
DHCP = "yes";
IPv6AcceptRA = true;
};
};
};
};
time.timeZone = "Asia/Shanghai";
i18n.defaultLocale = "zh_CN.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "zh_CN.UTF-8";
LC_IDENTIFICATION = "zh_CN.UTF-8";
LC_MEASUREMENT = "zh_CN.UTF-8";
LC_MONETARY = "zh_CN.UTF-8";
LC_NAME = "zh_CN.UTF-8";
LC_NUMERIC = "zh_CN.UTF-8";
LC_PAPER = "zh_CN.UTF-8";
LC_TELEPHONE = "zh_CN.UTF-8";
LC_TIME = "zh_CN.UTF-8";
};
i18n.inputMethod = {
enable = true;
type = "fcitx5";
@ -87,12 +30,15 @@
fcitx5-configtool
fcitx5-chinese-addons
(fcitx5-rime.override {
rimeDataPkgs = [
rime-data
nur.repos.xddxdd.rime-ice
nur.repos.xddxdd.rime-zhwiki
nur.repos.xddxdd.rime-moegirl
];
rimeDataPkgs =
[
rime-data
]
++ (with (pkgs.callPackage inputs.nur-xddxdd { }); [
rime-ice
rime-zhwiki
rime-moegirl
]);
})
];
waylandFrontend = true;
@ -146,8 +92,7 @@
"aes192-ctr"
"aes128-ctr"
];
KexAlgorithms = [
"curve25519-sha256@libssh.org"
KexAlgorithms = [ "curve25519-sha256@libssh.org"
"ecdh-sha2-nistp521"
"ecdh-sha2-nistp384"
"ecdh-sha2-nistp256"
@ -192,9 +137,6 @@
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
environment.systemPackages = with pkgs; [
nix-output-monitor
@ -204,10 +146,38 @@
helix
nixd
nixfmt-rfc-style
fontconfig
noto-fonts-cjk-sans
noto-fonts-cjk-serif
];
fonts = {
enableDefaultPackages = false;
packages = with pkgs; [
nerd-fonts.fira-code
noto-fonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
lxgw-wenkai
];
fontconfig.defaultFonts = pkgs.lib.mkForce {
serif = [
"LXGW WenKai"
"Noto Serif CJK SC"
"Noto Serif"
];
sansSerif = [
"Noto Serif CJK SC"
"Noto Serif"
];
monospace = [
"FiraCode Nerd Font"
];
emoji = [ "Noto Color Emoji" ];
};
};
environment.variables.EDITOR = "hx";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
@ -219,12 +189,6 @@
# List services that you want to enable:
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
@ -232,11 +196,6 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.stateVersion = "24.11"; # Did you read the comment?
}

402
flake.lock generated
View file

@ -34,6 +34,28 @@
"type": "github"
}
},
"firefox-addons": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1736222615,
"narHash": "sha256-fyc7nHAOQ5SWEeYEFyv/DO2/h1np0E9ZB3FR4JgTm+o=",
"ref": "master",
"rev": "6a50ba16d8c33e0ceb2682f4d0481eaf43cddd9a",
"revCount": 4023,
"type": "git",
"url": "https://gitlab.com/rycee/nur-expressions.git?dir=pkgs/firefox-addons"
},
"original": {
"dir": "pkgs/firefox-addons",
"ref": "master",
"type": "git",
"url": "https://gitlab.com/rycee/nur-expressions.git?dir=pkgs/firefox-addons"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -100,17 +122,14 @@
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nur",
"nixpkgs"
]
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
@ -121,7 +140,7 @@
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
"nixpkgs-lib": "nixpkgs-lib_3"
},
"locked": {
"lastModified": 1733312601,
@ -139,7 +158,7 @@
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_3"
"nixpkgs-lib": "nixpkgs-lib_4"
},
"locked": {
"lastModified": 1727826117,
@ -156,15 +175,12 @@
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1629284811,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c",
"type": "github"
},
"original": {
@ -175,43 +191,7 @@
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_5"
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
@ -227,20 +207,57 @@
"type": "github"
}
},
"freetype2": {
"flake": false,
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1723459814,
"narHash": "sha256-4l90lDtpgm5xlh2m7ifrqNy373DTRTULRkAzicrM93c=",
"owner": "freetype",
"repo": "freetype",
"rev": "42608f77f20749dd6ddc9e0536788eaad70ea4b5",
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "freetype",
"ref": "VER-2-13-3",
"repo": "freetype",
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
@ -252,11 +269,11 @@
"zig": "zig"
},
"locked": {
"lastModified": 1736131979,
"narHash": "sha256-NPfIRTbmzP5+IbbDIYED3zxVd+b1DSsl8nCGRBt3iQo=",
"lastModified": 1736210320,
"narHash": "sha256-QnDkQ/s1OWmPj1f+7MFNxQiAPJdHbI1Aft7yM5I+8gQ=",
"owner": "ghostty-org",
"repo": "ghostty",
"rev": "6181487bad55f8bbff9ce4f849a40fac72120f82",
"rev": "a3837a1e4ee06a183f32d4a622c2cdcd51f73fb8",
"type": "github"
},
"original": {
@ -265,38 +282,21 @@
"type": "github"
}
},
"harfbuzz": {
"flake": false,
"locked": {
"lastModified": 1719502711,
"narHash": "sha256-2ieCf3ftNk851FZBDPVl+7QHWBqD729KiUxUyxi26Yg=",
"owner": "harfbuzz",
"repo": "harfbuzz",
"rev": "9c03576c49db6e7207d9bcdfe3abd170a809157f",
"type": "github"
},
"original": {
"owner": "harfbuzz",
"ref": "9.0.0",
"repo": "harfbuzz",
"type": "github"
}
},
"helix": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1736116509,
"narHash": "sha256-ZcUDcqSSLmSLgNVFZ9r3wQ2Dp7MK94kZ1gSOABJ2+Wo=",
"lastModified": 1736210061,
"narHash": "sha256-POnlYfIcCreEB/abiregCnuIt+FXxpYsFAAnxvrys44=",
"owner": "helix-editor",
"repo": "helix",
"rev": "6c9619d0944570727ce1f9e8212c4081456fc361",
"rev": "e698b20245bf46711575a76d459eb04dd3913f2a",
"type": "github"
},
"original": {
@ -313,11 +313,11 @@
]
},
"locked": {
"lastModified": 1736089250,
"narHash": "sha256-/LPWMiiJGPHGd7ZYEgmbE2da4zvBW0acmshUjYC3WG4=",
"lastModified": 1736204492,
"narHash": "sha256-CoBPRgkUex9Iz6qGSzi/BFVUQjndB0PmME2B6eEyeCs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "172b91bfb2b7f5c4a8c6ceac29fd53a01ef07196",
"rev": "20665c6efa83d71020c8730f26706258ba5c6b2a",
"type": "github"
},
"original": {
@ -348,28 +348,11 @@
"type": "github"
}
},
"libpng": {
"flake": false,
"locked": {
"lastModified": 1726173884,
"narHash": "sha256-gBfHgGaqVYdmhWXoNKZzPyGzyw2rr3zp+DjWmfC41jk=",
"owner": "pnggroup",
"repo": "libpng",
"rev": "f5e92d76973a7a53f517579bc95d61483bf108c0",
"type": "github"
},
"original": {
"owner": "pnggroup",
"ref": "v1.6.44",
"repo": "libpng",
"type": "github"
}
},
"niri-flake": {
"inputs": {
"niri-stable": "niri-stable",
"niri-unstable": "niri-unstable",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-stable": "nixpkgs-stable_2",
"xwayland-satellite-stable": "xwayland-satellite-stable",
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
@ -433,8 +416,8 @@
"nixpkgs"
],
"nixpkgs-wine": "nixpkgs-wine",
"systems": "systems_3",
"treefmt-nix": "treefmt-nix_2"
"systems": "systems_4",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1731422383,
@ -520,16 +503,16 @@
"nixos-cosmic": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable_3",
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1736127757,
"narHash": "sha256-VYQqg7vaRoao+A5XUrflxcDBe1kXQUGSQId4M7fz8nw=",
"lastModified": 1736214624,
"narHash": "sha256-Pi70vbASZ1O9cR8RO5d2hBiNjIJBKKLoABl4sxWyOgg=",
"owner": "lilyinstarlight",
"repo": "nixos-cosmic",
"rev": "5e273a14a62532d518e1ea5d7bc3f9a2c001ea95",
"rev": "0830abeebf3b2d1bae44652ffb2c89cf0d56ddaa",
"type": "github"
},
"original": {
@ -599,6 +582,18 @@
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1735774519,
"narHash": "sha256-CewEm1o2eVAnoqb6Ml+Qi9Gg/EfNAxbRx1lANGVyoLI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/e9b51731911566bbf7e4895475a87fe06961de0b.tar.gz"
}
},
"nixpkgs-lib_3": {
"locked": {
"lastModified": 1733096140,
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
@ -610,7 +605,7 @@
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
}
},
"nixpkgs-lib_3": {
"nixpkgs-lib_4": {
"locked": {
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
@ -720,27 +715,27 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1736012469,
"narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "NixOS",
"lastModified": 1736134818,
"narHash": "sha256-30sOEZ8CFK2nTTMdkhaNrfVlIi3rWTNV0Z5z+NmpFNI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"rev": "3df3c47c19dc90fec35359e89ffb52b34d2b0e94",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1735834308,
"narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=",
"lastModified": 1736012469,
"narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6df24922a1400241dae323af55f30e4318a6ca65",
"rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"type": "github"
},
"original": {
@ -766,29 +761,23 @@
"type": "github"
}
},
"nur": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"nixpkgs_5": {
"locked": {
"lastModified": 1736163949,
"narHash": "sha256-ewYhjZY7zHQ9Jv1ePIShLGM5odwyX06OWzDNHxEpcs8=",
"owner": "nix-community",
"repo": "NUR",
"rev": "879889538510c1974242e90c17fe1d1ad156f822",
"lastModified": 1736012469,
"narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur_2": {
"nur": {
"locked": {
"lastModified": 1731941414,
"narHash": "sha256-2Xf90oIkzvOjzZBIgLxga6DqidvB6CSODE5+DODfLeI=",
@ -803,6 +792,25 @@
"type": "github"
}
},
"nur-xddxdd": {
"flake": false,
"locked": {
"dir": "/pkgs/uncategorized",
"lastModified": 1736240807,
"narHash": "sha256-BT517AKtTJX6VVun6sS7hdWAUAnYfONYkW/6Y7YjZLo=",
"owner": "xddxdd",
"repo": "nur-packages",
"rev": "31d037a5792423669a9345f7e3c32c850f81a878",
"type": "github"
},
"original": {
"dir": "/pkgs/uncategorized",
"owner": "xddxdd",
"ref": "master",
"repo": "nur-packages",
"type": "github"
}
},
"oskars-dotfiles": {
"inputs": {
"flake-parts": "flake-parts_3",
@ -815,16 +823,16 @@
],
"nixpkgs-darwin": "nixpkgs-darwin",
"nixpkgs-unstable": "nixpkgs-unstable_2",
"nur": "nur_2",
"nur": "nur",
"rust-overlay": "rust-overlay_3",
"winapps": "winapps"
},
"locked": {
"lastModified": 1735384567,
"narHash": "sha256-8+cAKak4QNBsvg+qUEROeH+xvBNfjHtBBI/gI/zRP7Q=",
"lastModified": 1736181070,
"narHash": "sha256-WEGej7QAcCFLiv8QIC/PK3dDTRNa6R5y5WaZGaBRU0E=",
"owner": "oskardotglobal",
"repo": ".dotfiles",
"rev": "88510c4f7bb9d8939f17d4f1e33d6a7a47d7ba2b",
"rev": "3cae6793b840d17c4827a03172e681b3b3389ae0",
"type": "github"
},
"original": {
@ -837,16 +845,18 @@
"root": {
"inputs": {
"dae": "dae",
"firefox-addons": "firefox-addons",
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils_2",
"ghostty": "ghostty",
"helix": "helix",
"home-manager": "home-manager",
"niri-flake": "niri-flake",
"nixos-cosmic": "nixos-cosmic",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_4",
"nur": "nur",
"oskars-dotfiles": "oskars-dotfiles",
"wezterm": "wezterm"
"nixpkgs": "nixpkgs_5",
"nur-xddxdd": "nur-xddxdd",
"oskars-dotfiles": "oskars-dotfiles"
}
},
"rust-overlay": {
@ -878,11 +888,11 @@
]
},
"locked": {
"lastModified": 1736044260,
"narHash": "sha256-DTAr0mAd8AZwWgRtU9ZZFPz3DwNeoH/Oi/1QMSqc9YQ=",
"lastModified": 1736130662,
"narHash": "sha256-z+WGez9oTR2OsiUWE5ZhIpETqM1ogrv6Xcd24WFi6KQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c8ed24cc104ebbc218d992e208131e9f024b69f0",
"rev": "2f5d4d9cd31cc02c36e51cb2e21c4b25c4f78c52",
"type": "github"
},
"original": {
@ -912,27 +922,6 @@
"type": "github"
}
},
"rust-overlay_4": {
"inputs": {
"nixpkgs": [
"wezterm",
"nixpkgs"
]
},
"locked": {
"lastModified": 1735871325,
"narHash": "sha256-6Ta5E4mhSfCP6LdkzkG2+BciLOCPeLKuYTJ6lOHW+mI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a599f011db521766cbaf7c2f5874182485554f00",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
@ -1009,27 +998,6 @@
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733222881,
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"oskars-dotfiles",
@ -1077,39 +1045,10 @@
"url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix"
}
},
"wezterm": {
"inputs": {
"flake-utils": "flake-utils_4",
"freetype2": "freetype2",
"harfbuzz": "harfbuzz",
"libpng": "libpng",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_4",
"zlib": "zlib"
},
"locked": {
"dir": "nix",
"lastModified": 1735931735,
"narHash": "sha256-4wzEN5IPYmqLP8TAdFatoRhCZ7W9y65AWoYN0Qgvbg8=",
"owner": "wez",
"repo": "wezterm",
"rev": "8e9cf912e66f704f300fac6107206a75036de1e7",
"type": "github"
},
"original": {
"dir": "nix",
"owner": "wez",
"ref": "main",
"repo": "wezterm",
"type": "github"
}
},
"winapps": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_5",
"nixpkgs": [
"oskars-dotfiles",
"nixpkgs"
@ -1167,7 +1106,7 @@
"flake-compat": [
"ghostty"
],
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"ghostty",
"nixpkgs-stable"
@ -1186,23 +1125,6 @@
"repo": "zig-overlay",
"type": "github"
}
},
"zlib": {
"flake": false,
"locked": {
"lastModified": 1705948357,
"narHash": "sha256-TkPLWSN5QcPlL9D0kc/yhH0/puE9bFND24aj5NVDKYs=",
"owner": "madler",
"repo": "zlib",
"rev": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf",
"type": "github"
},
"original": {
"owner": "madler",
"ref": "v1.3.1",
"repo": "zlib",
"type": "github"
}
}
},
"root": "root",

147
flake.nix
View file

@ -3,69 +3,130 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
helix = {
url = "github:helix-editor/helix/master";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
wezterm = {
url = "github:wez/wezterm/main?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
oskars-dotfiles = {
url = "github:oskardotglobal/.dotfiles/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
niri-flake.url = "github:sodiboo/niri-flake";
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
niri-flake = {
url = "github:sodiboo/niri-flake";
};
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
};
ghostty = {
url = "github:ghostty-org/ghostty";
};
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
dae = {
url = "github:daeuniverse/flake.nix";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
nur-xddxdd = {
url = "github:xddxdd/nur-packages?ref=master&dir=/pkgs/uncategorized";
flake = false;
};
firefox-addons = {
url = "git+https://gitlab.com/rycee/nur-expressions.git?dir=pkgs/firefox-addons&ref=master";
flake = false;
};
nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
ghostty.url = "github:ghostty-org/ghostty";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
dae.url = "github:daeuniverse/flake.nix";
};
outputs =
{
self,
nixpkgs,
home-manager,
nur,
flake-parts,
flake-utils,
...
}@inputs:
{
nixosConfigurations."Tytonidae" = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
inputs.niri-flake.nixosModules.niri
{
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
nixpkgs.overlays = [
(final: prev: {
helix = inputs.helix.packages."${system}".default;
})
inputs.niri-flake.overlays.niri
let
inherit (self) outputs;
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = flake-utils.lib.defaultSystems;
flake = {
nix.settings = {
# substituters shared in home-manager and nixos configuration
substituters =
let
channelStore = x: "https://${x}/nix-channels/store";
mirrors = map (x: channelStore "mirrors.${x}.edu.cn") [
"bfsu"
"tuna.tsinghua"
"ustc"
];
cachix = x: "https://${x}.cachix.org";
in
nixpkgs.lib.flatten [
mirrors
(cachix "nix-community")
"https://cache.nixos.org"
(cachix "cosmic")
];
}
inputs.nixos-hardware.nixosModules.asus-fx506hm
inputs.nixos-cosmic.nixosModules.default
nur.modules.nixos.default
nur.legacyPackages."${system}".repos.iopq.modules.xraya
./configuration.nix
./hardware-configuration.nix
home-manager.nixosModules.home-manager
./users
inputs.dae.nixosModules.dae
];
};
nixosModules.default = import ./nixos/modules;
overlays = {
modifications = (import ./overlays/modifications { inherit inputs; });
};
nixosConfigurations =
let
nixosConfigDir = ./nixos/configurations;
in
nixpkgs.lib.genAttrs
(map (f: nixpkgs.lib.removeSuffix ".nix" f) (builtins.attrNames (builtins.readDir nixosConfigDir)))
(
hostName:
nixpkgs.lib.nixosSystem {
modules =
[
(
let
dirPath = nixosConfigDir + "/${hostName}";
filePath = nixosConfigDir + "/${hostName}.nix";
in
if builtins.pathExists dirPath then dirPath else filePath
)
./configuration.nix
./users
]
++ [
outputs.nixosModules.default
];
specialArgs = {
inherit inputs outputs;
};
}
);
};
};
}

View file

@ -0,0 +1,43 @@
{ pkgs, inputs, ... }:
{
imports =
(with inputs; [
nixos-hardware.nixosModules.asus-fx506hm
])
++ [
# Include the hardware related config
./hardware-configuration.nix
./networking.nix
];
networking.hostName = "Tytonidae";
time.timeZone = "Asia/Shanghai";
i18n = {
defaultLocale = "C.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "zh_CN.UTF-8";
LC_IDENTIFICATION = "zh_CN.UTF-8";
LC_MEASUREMENT = "zh_CN.UTF-8";
LC_MONETARY = "zh_CN.UTF-8";
LC_NAME = "zh_CN.UTF-8";
LC_NUMERIC = "zh_CN.UTF-8";
LC_PAPER = "zh_CN.UTF-8";
LC_TELEPHONE = "zh_CN.UTF-8";
LC_TIME = "zh_CN.UTF-8";
};
};
nixpkgs = {
config = {
allowUnfree = true;
};
};
boot = {
kernelPackages = pkgs.linuxPackages_zen;
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
};
}

View file

@ -0,0 +1,36 @@
{ ... }:
{
systemd.network = {
enable = true;
wait-online.enable = false;
networks = {
"eno2" = {
matchConfig.Name = "eno2";
networkConfig = {
DHCP = "yes";
IPv6AcceptRA = true;
};
};
};
};
networking = {
networkmanager.enable = false;
useNetworkd = true;
useDHCP = false;
wireless.iwd = {
enable = true;
settings = {
General = {
EnableNetworkConfiguration = true;
};
Network = {
EnableIPv6 = true;
NameResolvingService = "systemd";
};
};
};
firewall.enable = false;
};
}

30
nixos/modules/default.nix Normal file
View file

@ -0,0 +1,30 @@
{
inputs,
outputs,
pkgs,
...
}:
{
imports =
(with inputs; [
niri-flake.nixosModules.niri
nixos-cosmic.nixosModules.default
home-manager.nixosModules.home-manager
dae.nixosModules.dae
])
++ [
./nix.nix
];
config = {
nixpkgs = {
overlays =
(with outputs; [
overlays.modifications
])
++ (with inputs; [
niri-flake.overlays.niri
]);
};
};
}

45
nixos/modules/nix.nix Normal file
View file

@ -0,0 +1,45 @@
{
inputs,
outputs,
pkgs,
lib,
...
}:
{
config = {
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
settings = {
inherit (outputs.nix.settings) substituters;
trusted-users = [
"root"
"@wheel"
];
trusted-public-keys = [
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
auto-optimise-store = lib.mkDefault true;
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
system-features = [
"kvm"
"big-parallel"
];
use-xdg-base-directories = true;
builders-use-substitutes = true;
};
package = pkgs.nix;
registry.sys = lib.mkDefault {
from = {
type = "indirect";
id = "sys";
};
flake = inputs.nixpkgs;
};
};
};
}

View file

View file

@ -0,0 +1,10 @@
{ ... }@args:
final: prev:
let
inherit (prev) lib;
overlay-files = [
./helix.nix
];
overlay-list = map (file: import file args) overlay-files;
in
(lib.composeManyExtensions overlay-list) final prev

View file

@ -0,0 +1,9 @@
{ inputs, ... }:
final: prev:
let
inherit (final) stdenv;
inherit (stdenv.hostPlatform) system;
in
{
helix = inputs.helix.packages."${system}".default;
}

View file

@ -0,0 +1 @@

View file

@ -3,7 +3,6 @@ include {
}
global {
# 绑定到 LAN 和/或 WAN 接口。将下述接口替换成你自己的接口名。
lan_interface: auto
wan_interface: auto
@ -11,21 +10,31 @@ global {
allow_insecure: false
auto_config_kernel_parameter: true
dial_mode: domain
tcp_check_url: 'http://cp.cloudflare.com'
udp_check_dns: 'dns.google.com:53'
check_interval: 600s
check_tolerance: 50ms
tproxy_port: 12345
}
# 更多的 DNS 样例见 https://github.com/daeuniverse/dae/blob/main/docs/en/configuration/dns.md
dns {
ipversion_prefer: 4
upstream {
googledns: 'tcp+udp://8.8.8.8:53'
alidns: 'udp://114.114.114.114:53'
alidns: 'udp://dns.alidns.com:53'
}
routing {
request {
fallback: alidns
qname(geosite: category-ads) -> reject
qname(geosite: category-ads-all) -> reject
qname(geosite: cn) -> alidns
fallback: googledns
}
response {
upstream(googledns) -> accept
ip(geoip: private) && !qname(geosite: cn) -> googledns
upstream(googledns) && ip(geoip: private) -> alidns
fallback: accept
}
}
@ -50,19 +59,20 @@ group {
routing {
pname(hickory-dns) && dport(53) -> must_direct
pname(mihomo) -> must_direct
domain(geosite:cn) -> direct
# personal config routing
pname(systemd-resolved) -> must_direct
domain(full: time.windows.com) -> must_direct
domain(suffix: 'hit.edu.cn') -> must_direct
domain(regex: ".*wgetcloud.*v2ray.*") -> must_direct
domain(suffix: "hit.edu.cn") -> must_direct
domain(geosite: microsoft) -> proxy
# domain(geosite: onedrive) -> must_direct
domain(geosite: 'category-ai-chat-!cn') -> us
domain(geosite: "category-ai-chat-!cn") -> us
domain(geosite: google) -> us
domain(geosite: google-play) -> proxy
domain(geosite: apple) -> us
domain(keyword: spotify) -> us
domain(geosite: spotify) -> us
domain(geosite: tiktok) -> us
domain(geosite: cn) -> direct
dip(geoip:private) -> direct
dip(geoip:cn) -> direct
@ -75,8 +85,5 @@ routing {
# dip(175.27.0.0/16) -> block
# dip('2409:8C1E:75B0:80::/64') -> block
## 禁用 h3因为它通常消耗很多 CPU 和内存资源
# l4proto(udp) && dport(443) -> block
fallback: proxy
}

View file

@ -73,42 +73,38 @@
wantedBy = [ "multi-user.target" ];
};
"update-dae-subscription-weekly" = {
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStartPre = [ "${config.systemd.package}/bin/systemctl stop dae.service" ];
ExecStartPost = [
"${config.systemd.package}/bin/systemctl start dae.service"
];
ExecStart =
let
script = pkgs.writeTextFile {
name = "update-dae-subscription-weekly";
executable = true;
destination = "/bin/script";
text = ''
${pkgs.coreutils}/bin/echo "Force subscription update..."
${pkgs.coreutils}/bin/mkdir -p /etc/proxy.d
${update}
'';
};
in
[
"${pkgs.bash}/bin/bash ${script}/bin/script"
];
};
};
# "update-dae-subscription-weekly" = {
# after = [ "network-online.target" ];
# wants = [ "network-online.target" ];
# wantedBy = [ "multi-user.target" ];
# serviceConfig = {
# Type = "oneshot";
# ExecStart =
# let
# script = pkgs.writeTextFile {
# name = "update-dae-subscription-weekly";
# executable = true;
# destination = "/bin/script";
# text = ''
# ${pkgs.coreutils}/bin/echo "Force subscription update..."
# ${pkgs.coreutils}/bin/mkdir -p /etc/proxy.d
# ${update}
# '';
# };
# in
# [
# "${pkgs.bash}/bin/bash ${script}/bin/script"
# ];
# };
# };
};
systemd.timers."dae-update" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "weekly";
Unit = "dae-update.service";
Persistent = true;
};
};
# systemd.timers."dae-update" = {
# wantedBy = [ "timers.target" ];
# timerConfig = {
# OnCalendar = "weekly";
# Unit = "dae-update.service";
# Persistent = true;
# };
# };
}

View file

@ -8,7 +8,6 @@
imports = [
./starship
./helix
./wezterm
./fish
./rime-ice.nix
./firefox.nix

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, firefox-addons, ... }:
{
programs.firefox = {
enable = true;
@ -9,8 +9,8 @@
profiles.default = {
name = "default";
isDefault = true;
extensions = with pkgs.nur.repos; [
rycee.firefox-addons.immersive-translate
extensions = with (pkgs.callPackage firefox-addons { }); [
immersive-translate
];
search = {
force = true;

View file

@ -1,18 +0,0 @@
{
pkgs,
wezterm,
...
}:
{
programs.wezterm = {
enable = true;
package = wezterm.packages."${pkgs.system}".default;
};
home.file.".config/wezterm" = {
source = ./lua;
recursive = true;
};
home.packages = with pkgs; [
nerd-fonts.fira-code
];
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

View file

@ -1,33 +0,0 @@
local wezterm = require("wezterm")
---@class Config
---@filed options table
local Config = {}
---Init Config
---@return Config
function Config:init()
local o = {}
self = setmetatable(o, { __index = Config })
self.options = {}
return o
end
---Append to `Config.options`
---@param new_options table new options to append
---@return Config
function Config:append(new_options)
for key, val in pairs(new_options) do
if self.options[key] ~= nil then
wezterm.log_warn("Duplicate config option detected: ", {
old = self.options[key],
new = new_options[key],
})
else
self.options[key] = val
end
end
return self
end
return Config

View file

@ -1,7 +0,0 @@
return {
---Check whether the current os is windows
---@return boolean whether the current os is windows
is_windows = function()
return require("wezterm").target_triple:find("windows") ~= nil
end,
}

View file

@ -1,22 +0,0 @@
return {
family = [[FiraCode Nerd Font]],
assume_emoji_presentation = false,
style = [[Normal]],
harfbuzz_features = {
"calt=1",
"clig=1",
"liga=1",
"cv01",
"cv02",
"cv06",
"zero",
"onum",
"cv17",
"ss05",
"ss03",
"cv16",
"cv31",
"cv29",
"cv30",
},
}

View file

@ -1,4 +0,0 @@
return {
family = [[Noto Color Emiji]],
assume_emoji_presentation = true,
}

View file

@ -1,4 +0,0 @@
return {
family = [[Noto Sans CJK SC]],
assume_emoji_presentation = false,
}

View file

@ -1,4 +0,0 @@
return {
family = [[Segoe UI Emoji]],
assume_emoji_presentation = true,
}

View file

@ -1,5 +0,0 @@
return {
family = [[VictorMono Nerd Font]],
assume_emoji_presentation = false,
style = "Italic",
}

View file

@ -1,17 +0,0 @@
local wezterm = require("wezterm")
local M = {
-- front_end = 'WebGpu',
webgpu_power_preference = "HighPerformance",
}
for _, gpu in ipairs(wezterm.gui.enumerate_gpus()) do
if gpu.backend == "Vulkan" and gpu.device_type == "DiscreteGpu" then
M.webgpu_preferred_adapter = gpu
break
elseif gpu.backend == "Vulkan" and M.webgpu_preferred_adapter == nil then
M.webgpu_preferred_adapter = gpu
end
end
return M

View file

@ -1,28 +0,0 @@
local wezterm = require("wezterm")
return {
automatically_reload_config = true,
cell_width = 1.0,
audible_bell = "Disabled",
tab_bar_at_bottom = true,
use_fancy_tab_bar = false,
hide_tab_bar_if_only_one_tab = true,
window_decorations = "RESIZE|TITLE",
underline_thickness = 3.0,
enable_scroll_bar = true,
color_scheme = "MaterialOcean",
window_background_image = wezterm.config_dir .. [[/background/background.png]],
window_background_image_hsb = {
brightness = 0.02,
hue = 1.0,
saturation = 1.0,
},
window_padding = {
left = "0.5cell",
right = 0,
top = "0cell",
bottom = "0cell",
},
window_background_opacity = 0.9,
text_background_opacity = 0.6,
}

View file

@ -1,5 +0,0 @@
if require("fn").is_windows() then
return require("options.os.windows")
else
return require("options.os.other_os")
end

View file

@ -1,30 +0,0 @@
local wezterm = require("wezterm")
local fonts = {
require("fonts.firacode_nerd_font"),
require("fonts.noto_sans_cjk_sc"),
require("fonts.noto_color_emoji"),
}
return {
term = "wezterm",
font_size = 14.0,
animation_fps = 1,
max_fps = 1,
font = wezterm.font_with_fallback(fonts),
font_rules = {
{
italic = true,
font = wezterm.font_with_fallback({
require("fonts.victor_mono_nerd_font"),
}),
},
{
italic = false,
font = wezterm.font_with_fallback({
require("fonts.firacode_nerd_font"),
require("fonts.noto_sans_cjk_sc"),
}),
},
},
}

View file

@ -1,31 +0,0 @@
local wezterm = require("wezterm")
local fonts = {
require("fonts.firacode_nerd_font"),
require("fonts.segoe_ui_emoji"),
}
return {
font_size = 16.0,
animation_fps = 144,
max_fps = 144,
default_prog = {
[[pwsh]],
},
font = wezterm.font_with_fallback(fonts),
font_rules = {
{
italic = true,
font = wezterm.font_with_fallback({
require("fonts.victor_mono_nerd_font"),
}),
},
{
italic = false,
font = wezterm.font_with_fallback({
require("fonts.firacode_nerd_font"),
require("fonts.noto_sans_cjk_sc"),
}),
},
},
}

View file

@ -1,6 +0,0 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120
[sort_requires]
enabled = true

View file

@ -1,5 +0,0 @@
return require("config")
:init()
:append(require("options.base"))
:append(require("options.backend"))
:append(require("options.os")).options