mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-04 20:02:10 +02:00
init server modules
This commit is contained in:
21
hosts/server/configuration.nix
Normal file
21
hosts/server/configuration.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{ config, ... }: {
|
||||||
|
imports = [
|
||||||
|
../../nixos/home-manager.nix
|
||||||
|
../../nixos/nix.nix
|
||||||
|
../../nixos/systemd-boot.nix
|
||||||
|
../../nixos/users.nix
|
||||||
|
../../nixos/utils.nix
|
||||||
|
../../nixos/docker.nix
|
||||||
|
|
||||||
|
../../server-modules/ssh.nix
|
||||||
|
|
||||||
|
# You should let those lines as is
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./variables.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users."${config.var.username}" = import ./home.nix;
|
||||||
|
|
||||||
|
# Don't touch this
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
||||||
45
hosts/server/home.nix
Normal file
45
hosts/server/home.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{ pkgs, config, ... }: {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
# Mostly user-specific configuration
|
||||||
|
./variables.nix
|
||||||
|
|
||||||
|
# Programs
|
||||||
|
../../home/programs/nvim
|
||||||
|
../../home/programs/shell
|
||||||
|
../../home/programs/fetch
|
||||||
|
../../home/programs/git
|
||||||
|
../../home/programs/lazygit
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
../../home/scripts # All scripts
|
||||||
|
];
|
||||||
|
|
||||||
|
home = {
|
||||||
|
inherit (config.var) username;
|
||||||
|
homeDirectory = "/home/" + config.var.username;
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
# Dev
|
||||||
|
go
|
||||||
|
nodejs
|
||||||
|
python3
|
||||||
|
jq
|
||||||
|
just
|
||||||
|
pnpm
|
||||||
|
|
||||||
|
# Utils
|
||||||
|
zip
|
||||||
|
unzip
|
||||||
|
optipng
|
||||||
|
pfetch
|
||||||
|
btop
|
||||||
|
fastfetch
|
||||||
|
];
|
||||||
|
|
||||||
|
# Don't touch this
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
36
hosts/server/variables.nix
Normal file
36
hosts/server/variables.nix
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{ config, lib, ... }: {
|
||||||
|
imports = [
|
||||||
|
# Choose your theme here:
|
||||||
|
../../themes/nixy.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config.var = {
|
||||||
|
hostname = "jack";
|
||||||
|
username = "hadi";
|
||||||
|
configDirectory = "/home/" + config.var.username
|
||||||
|
+ "/.config/nixos"; # The path of the nixos configuration directory
|
||||||
|
|
||||||
|
keyboardLayout = "fr";
|
||||||
|
|
||||||
|
location = "Paris";
|
||||||
|
timeZone = "Europe/Paris";
|
||||||
|
defaultLocale = "en_US.UTF-8";
|
||||||
|
extraLocale = "fr_FR.UTF-8";
|
||||||
|
|
||||||
|
git = {
|
||||||
|
username = "Hadi";
|
||||||
|
email = "112569860+anotherhadi@users.noreply.github.com";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoUpgrade = false;
|
||||||
|
autoGarbageCollector = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let this here
|
||||||
|
options = {
|
||||||
|
var = lib.mkOption {
|
||||||
|
type = lib.types.attrs;
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
16
server-modules/ssh.nix
Normal file
16
server-modules/ssh.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ config, ... }: {
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
permitRootLogin = "no";
|
||||||
|
passwordAuthentication = false;
|
||||||
|
openFirewall = true;
|
||||||
|
ports = [ 22 ];
|
||||||
|
settings.AllowUsers = [ config.var.username ];
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users."${config.var.username}" = {
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPG9SE80ZyBcXZK/f5ypSKudaM5Jo3XtQikCnGo0jI5E hadi@nixy"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user