mirror of
https://github.com/lxstinthesky/matrix.git
synced 2025-11-02 17:02:47 +00:00
Compare commits
2 Commits
665bd1d1f4
...
981683bf51
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
981683bf51 | ||
|
|
3cd6c1c941 |
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./users/users.nix
|
./users/users.nix
|
||||||
./modules/ssh.nix
|
./modules/security.nix
|
||||||
./vps/hetzner/hardware-configuration.nix
|
./vps/hetzner/hardware-configuration.nix
|
||||||
./modules/zsh.nix
|
./modules/zsh.nix
|
||||||
];
|
];
|
||||||
@@ -11,8 +11,22 @@
|
|||||||
# nix settings
|
# nix settings
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
# Bootloader.
|
# Bootloader to work with LUKS
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/55332
|
||||||
|
device = "nodev"; # Don't install to MBR
|
||||||
|
efiSupport = true; # Enable EFI support
|
||||||
|
enableCryptodisk = true; # Enable LUKS support
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
# LUKS configuration
|
||||||
|
boot.initrd.luks.devices."crypted" = {
|
||||||
|
device = "/dev/disk/by-partlabel/luks";
|
||||||
|
allowDiscards = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "virtio_gpu" ];
|
boot.initrd.kernelModules = [ "virtio_gpu" ];
|
||||||
@@ -54,9 +68,9 @@
|
|||||||
diskSize = 5000; # 5GB, needed to prevent docker error running out of space
|
diskSize = 5000; # 5GB, needed to prevent docker error running out of space
|
||||||
|
|
||||||
# Networking configuration
|
# Networking configuration
|
||||||
#forwardPorts = [
|
forwardPorts = [
|
||||||
# { from = "host"; host.port = 2222; guest.port = 22; }
|
{ from = "host"; host.port = 2222; guest.port = 22; }
|
||||||
#];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Add VM-specific users
|
# Add VM-specific users
|
||||||
@@ -69,8 +83,6 @@
|
|||||||
packages = with pkgs; [ ];
|
packages = with pkgs; [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo.wheelNeedsPassword = false;
|
|
||||||
|
|
||||||
# VM-specific packages
|
# VM-specific packages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
ESP = {
|
ESP = {
|
||||||
size = "500M";
|
size = "500M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
|
label = "boot";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "vfat";
|
format = "vfat";
|
||||||
@@ -20,12 +21,11 @@
|
|||||||
};
|
};
|
||||||
luks = {
|
luks = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
|
label = "luks";
|
||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted";
|
name = "crypted";
|
||||||
settings.allowDiscards = true; # Enable SSD TRIM support
|
settings.allowDiscards = true; # Enable SSD TRIM support
|
||||||
passwordFile = "/tmp/secret.key"; # install time key file location
|
|
||||||
# additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
|
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "ext4";
|
format = "ext4";
|
||||||
|
|||||||
17
nix/modules/security.nix
Normal file
17
nix/modules/security.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# providing an ssh configuration
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
PermitRootLogin = "no"; # Disable root login
|
||||||
|
PasswordAuthentication = false; # Force SSH key auth only
|
||||||
|
PubkeyAuthentication = true; # Enable SSH keys
|
||||||
|
};
|
||||||
|
ports = [ 22 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# other security hardening options can go here
|
||||||
|
security.sudo.wheelNeedsPassword = false;
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{ config, pkgs, inputs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
# permitRootLogin = "no";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
1
nix/users/keys/neo.pub
Normal file
1
nix/users/keys/neo.pub
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBtePfzkSorgiFNuol/pEYlR0HToDCy9fk8PPfZWMuf3 henrik@strange
|
||||||
@@ -5,15 +5,18 @@
|
|||||||
users.defaultUserShell = pkgs.zsh;
|
users.defaultUserShell = pkgs.zsh;
|
||||||
users.users.neo = {
|
users.users.neo = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "Matrix User 1";
|
description = "Neovim only user";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
packages = with pkgs; [ ];
|
packages = with pkgs; [ ];
|
||||||
|
openssh.authorizedKeys.keyFiles = [
|
||||||
|
./keys/neo.pub
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.morpheus = {
|
users.users.morpheus = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "Matrix User 2";
|
description = "Insert joke here";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
packages = with pkgs; [ ];
|
packages = with pkgs; [ ];
|
||||||
@@ -21,7 +24,7 @@
|
|||||||
|
|
||||||
users.users.trinity = {
|
users.users.trinity = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "Matrix User 3";
|
description = "Named after an atom bomb test";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
packages = with pkgs; [ ];
|
packages = with pkgs; [ ];
|
||||||
|
|||||||
Reference in New Issue
Block a user