manatee: Add host manatee
This commit is contained in:
14
hosts/manatee/modules/age/default.nix
Normal file
14
hosts/manatee/modules/age/default.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.agenix.nixosModules.default ];
|
||||
|
||||
config = {
|
||||
age = {
|
||||
identityPaths = [ "/etc/ssh/manatee" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
inputs.agenix.packages."${pkgs.system}".default
|
||||
];
|
||||
};
|
||||
}
|
||||
43
hosts/manatee/modules/boot/default.nix
Normal file
43
hosts/manatee/modules/boot/default.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
configurationLimit = config.mod.gc.configurationLimit;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.nix-gc-env.nixosModules.default ];
|
||||
|
||||
options = {
|
||||
mod.gc = {
|
||||
configurationLimit = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 10;
|
||||
description = "number of configuration generations to keep";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
|
||||
# `delete_generations` added by nix-gc-env
|
||||
delete_generations = "+${builtins.toString configurationLimit}";
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
inherit configurationLimit;
|
||||
};
|
||||
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
17
hosts/manatee/modules/default.nix
Normal file
17
hosts/manatee/modules/default.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
toModulePath = dir: _: ./. + "/${dir}";
|
||||
filterDirs = dirs: lib.attrsets.filterAttrs (_: type: type == "directory") dirs;
|
||||
in
|
||||
{
|
||||
imports = lib.mapAttrsToList toModulePath (filterDirs (builtins.readDir ./.));
|
||||
|
||||
config = {
|
||||
mod = {
|
||||
gc.configurationLimit = 10;
|
||||
|
||||
ssh.enable = true;
|
||||
git.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
39
hosts/manatee/modules/git/default.nix
Normal file
39
hosts/manatee/modules/git/default.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
enabled = config.mod.git.enable;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
mod.git = {
|
||||
enable = lib.mkEnableOption "enable git module";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf enabled {
|
||||
home-manager.users.alex = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
includes = [
|
||||
{ path = ./gitconfig; }
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
rerere.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.tig ];
|
||||
|
||||
home.file.".tigrc".text = ''
|
||||
set main-view-line-number = yes
|
||||
set main-view-line-number-interval = 1
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
9
hosts/manatee/modules/git/gitconfig
Normal file
9
hosts/manatee/modules/git/gitconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
[user]
|
||||
name = Alexander Heldt
|
||||
email = me@alexanderheldt.se
|
||||
|
||||
[url "git@github.com:"]
|
||||
insteadOf = https://github.com/
|
||||
|
||||
[url "gitea@git.ppp.pm:"]
|
||||
insteadOf = https://git.ppp.pm/
|
||||
22
hosts/manatee/modules/network/default.nix
Normal file
22
hosts/manatee/modules/network/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ ... }:
|
||||
{
|
||||
networking = {
|
||||
hostName = "manatee";
|
||||
|
||||
defaultGateway = "192.168.50.1";
|
||||
nameservers = [ "1.1.1.1" ];
|
||||
interfaces = {
|
||||
enp3s0 = {
|
||||
useDHCP = false;
|
||||
ipv4 = {
|
||||
addresses = [
|
||||
{
|
||||
address = "192.168.50.203";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
101
hosts/manatee/modules/ssh/default.nix
Normal file
101
hosts/manatee/modules/ssh/default.nix
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
enabled = config.mod.ssh.enable;
|
||||
|
||||
authorizedKeysPath = "/home/alex/.ssh/authorized-keys";
|
||||
rootSSHKeyPath = "/etc/ssh";
|
||||
in
|
||||
{
|
||||
options = {
|
||||
mod.ssh = {
|
||||
enable = lib.mkEnableOption "enable ssh module";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf enabled {
|
||||
home-manager.users.alex = {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
matchBlocks = {
|
||||
"git.ppp.pm" = {
|
||||
hostname = "git.ppp.pm";
|
||||
identityFile = "/home/alex/.ssh/alex.manatee-git.ppp.pm";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc."ssh/authorized_keys_command" = {
|
||||
mode = "0755";
|
||||
text = ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
for file in ${authorizedKeysPath}/*; do
|
||||
${pkgs.coreutils}/bin/cat "$file"
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
services = {
|
||||
openssh = {
|
||||
enable = true;
|
||||
ports = [ 1122 ];
|
||||
|
||||
hostKeys = [
|
||||
{
|
||||
path = "${rootSSHKeyPath}/root.manatee";
|
||||
type = "ed25519";
|
||||
}
|
||||
];
|
||||
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
};
|
||||
|
||||
authorizedKeysCommand = "/etc/ssh/authorized_keys_command";
|
||||
authorizedKeysCommandUser = "root";
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [ 1122 ];
|
||||
};
|
||||
};
|
||||
|
||||
age.secrets = {
|
||||
"root.manatee" = {
|
||||
file = ../../../../secrets/manatee/root.manatee.age;
|
||||
path = "${rootSSHKeyPath}/root.manatee";
|
||||
};
|
||||
"root.manatee.pub" = {
|
||||
file = ../../../../secrets/manatee/root.manatee.pub.age;
|
||||
path = "${rootSSHKeyPath}/root.manatee.pub";
|
||||
};
|
||||
|
||||
"alex.pinwheel-manatee.pub" = {
|
||||
file = ../../../../secrets/pinwheel/alex.pinwheel-manatee.pub.age;
|
||||
path = "${authorizedKeysPath}/alex.pinwheel-manatee.pub";
|
||||
};
|
||||
|
||||
"alex.manatee-git.ppp.pm" = {
|
||||
file = ../../../../secrets/manatee/alex.manatee-git.ppp.pm.age;
|
||||
path = "/home/alex/.ssh/alex.manatee-git.ppp.pm";
|
||||
owner = "alex";
|
||||
group = "users";
|
||||
};
|
||||
"alex.manatee-git.ppp.pm.pub" = {
|
||||
file = ../../../../secrets/manatee/alex.manatee-git.ppp.pm.pub.age;
|
||||
path = "/home/alex/.ssh/alex.manatee-git.ppp.pm.pub";
|
||||
owner = "alex";
|
||||
group = "users";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user