Move server configs into a reusable module

This commit is contained in:
2024-07-18 22:29:21 -07:00
parent 4c534c4ce3
commit 38fe094119
5 changed files with 37 additions and 42 deletions

View File

@@ -11,6 +11,7 @@
in { in {
nixosModules = { nixosModules = {
common = import ./modules/common.nix; common = import ./modules/common.nix;
server = import ./modules/server.nix;
}; };
nixosConfigurations = { nixosConfigurations = {

View File

@@ -56,13 +56,6 @@
}; };
}; };
users.users = {
nettika = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
};
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# Chat clients # Chat clients
discord discord
@@ -127,11 +120,6 @@
enable = true; enable = true;
}; };
services.zerotierone = {
enable = true;
joinNetworks = secrets.zerotier.networks;
};
time.timeZone = "America/Los_Angeles"; time.timeZone = "America/Los_Angeles";
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View File

@@ -1,10 +1,13 @@
{ self, pkgs, secrets, ... }: { { self, pkgs, secrets, ... }:
imports = [ self.nixosModules.common ]; {
imports = [
self.nixosModules.common
self.nixosModules.server
];
networking = { networking = {
hostName = "monolith"; hostName = "monolith";
hostId = "44551c32"; hostId = "44551c32";
networkmanager.enable = true;
}; };
fileSystems = { fileSystems = {
@@ -33,30 +36,7 @@
supportedFilesystems = [ "zfs" ]; supportedFilesystems = [ "zfs" ];
}; };
users.users = {
nettika = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHopty1QG8P+OfGxQ9CV0BI1IRB/q6yITzMZaZ6Zspid nettika@marauder"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8s5w9uAFMguVbbAamI7pKysgeLTwULXAVn5F0UDVl2 nettika@pixeltablet"
];
};
};
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
services.zerotierone = {
enable = true;
joinNetworks = secrets.zerotier.networks;
};
security.sudo.wheelNeedsPassword = false;
time.timeZone = "America/Los_Angeles"; time.timeZone = "America/Los_Angeles";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
} }

View File

@@ -1,9 +1,16 @@
{ pkgs, ... }: { pkgs, secrets, ... }:
{ {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
users.users.nettika = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
};
security.sudo.wheelNeedsPassword = false;
programs.git = { programs.git = {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;
@@ -16,7 +23,7 @@
credential.helper = "store"; credential.helper = "store";
}; };
}; };
programs.nano = { programs.nano = {
enable = true; enable = true;
nanorc = '' nanorc = ''
@@ -24,6 +31,11 @@
set linenumbers set linenumbers
''; '';
}; };
services.zerotierone = {
enable = true;
joinNetworks = secrets.zerotier.networks;
};
environment.systemPackages = [ pkgs.git-crypt ]; environment.systemPackages = [ pkgs.git-crypt ];
} }

14
modules/server.nix Normal file
View File

@@ -0,0 +1,14 @@
{ ... }:
{
networking.networkmanager.enable = true;
users.users.nettika.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHopty1QG8P+OfGxQ9CV0BI1IRB/q6yITzMZaZ6Zspid nettika@marauder"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8s5w9uAFMguVbbAamI7pKysgeLTwULXAVn5F0UDVl2 nettika@pixeltablet"
];
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
}