Commit 5cba6e0
Changed files (6)
hosts
chaser-kevin
chaser-pardofelis
outputs
x86_64-linux
hosts/chaser-kevin/default.nix
@@ -9,7 +9,9 @@
# My main computer, with I7-14650HX + RTX4060 Laptop GPU + 48GB memory, for daily use.
#
#############################################################
-{
+let
+ hostName = "kevin";
+in {
imports = [
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-hidpi
@@ -21,6 +23,8 @@
./boot.nix
];
+ modules.currentHost = hostName;
+
# 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. It‘s perfectly fine and recommended to leave
hosts/chaser-pardofelis/default.nix
@@ -10,14 +10,16 @@
# My main server hosted by Yecaoyun.
#
#############################################################
-{
+let
+ hostName = "pardofelis";
+in {
imports =
(mylib.scanModules ./.)
++ [
disko.nixosModules.default
];
- systemd.network.enable = true;
+ modules.currentHost = hostName;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
modules/base/hosts.nix
@@ -81,4 +81,7 @@ in {
description = "My nix hosts general configuration";
default = {};
};
+ options.modules.currentHost = mkOption {
+ type = types.str;
+ };
}
modules/nixos/base/ssh.nix
@@ -1,9 +1,10 @@
{
lib,
config,
- hostName,
...
-}: {
+}: let
+ hostName = config.modules.currentHost;
+in {
# Or disable the firewall altogether.
networking.firewall.enable = lib.mkDefault false;
# Enable the OpenSSH daemon.
outputs/x86_64-linux/src/kevin.nix
@@ -30,10 +30,6 @@
};
in {
nixosConfigurations = {
- "${name}" = mylib.nixosSystem (base-modules
- // args
- // {
- genSpecialArgs = system: (genSpecialArgs system) // {hostName = name;};
- });
+ "${name}" = mylib.nixosSystem (base-modules // args);
};
}
outputs/x86_64-linux/src/pardofelis.nix
@@ -29,12 +29,7 @@
];
};
- systemArgs =
- modules
- // args
- // {
- genSpecialArgs = system: (genSpecialArgs system) // {hostName = name;};
- };
+ systemArgs = modules // args;
in {
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;