screeps and home-manager.sharedModules

This commit is contained in:
Ingolf Wagner 2023-07-07 02:48:44 +02:00
parent a03344046b
commit f770305273
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
6 changed files with 120 additions and 81 deletions

View file

@ -231,19 +231,12 @@
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.root = { home-manager.sharedModules = [
home.stateVersion = "22.11";
imports = [
home-manager-utils.hmModule
];
};
home-manager.users.mainUser = {
home.stateVersion = "22.11";
imports = [
doom-emacs-nix.hmModule doom-emacs-nix.hmModule
home-manager-utils.hmModule home-manager-utils.hmModule
]; ];
}; home-manager.users.mainUser.home.stateVersion = "22.11";
home-manager.users.root.home.stateVersion = "22.11";
}; };
sopsModule = name: { lib, ... }: { sopsModule = name: { lib, ... }: {

View file

@ -18,49 +18,9 @@ with lib;
home-manager.users.mainUser = { home-manager.users.mainUser = {
# a better cat
programs.bat = {
enable = true;
config.theme = "gruvbox-light";
};
home.shellAliases.cat = "${pkgs.bat}/bin/bat";
# notify me when a command is finished # notify me when a command is finished
programs.noti.enable = true; programs.noti.enable = true;
# a better ls
programs.exa = {
enable = true;
enableAliases = true;
};
home.shellAliases.llt = "${pkgs.exa}/bin/exa -a --tree";
# use z instead of cd
# use zi to fuzzy search through all registered directories
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# provide better `Ctrl+r` command in terminal
programs.mcfly = {
enable = true;
keyScheme = "vim";
fuzzySearchFactor = 3;
enableZshIntegration = true;
enableBashIntegration = true;
};
programs.zsh = {
enable = true;
defaultKeymap = "viins";
};
xdg.configFile."ncmpcpp/config".text = ''
mpd_host = "pepe.private"
mpd_port = 6600
'';
programs.git = { programs.git = {
enable = true; enable = true;

View file

@ -79,20 +79,5 @@ in
}; };
home-manager.users.mainUser.home.file.".mainUser" = {
enable = true;
text = builtins.toJSON (
{
mainUser = config.users.users.mainUser.name;
normalUser = mapAttrs (_: value: value.name)
(filterAttrs (_: value: value.isNormalUser)
config.users.users);
systemUser = mapAttrs (_: value: value.name)
(filterAttrs (_: value: value.isSystemUser)
config.users.users);
}
);
};
}; };
} }

View file

@ -8,19 +8,44 @@ with lib;
config = mkIf (config.components.terminal.zsh.enable) { config = mkIf (config.components.terminal.zsh.enable) {
home-manager.users = home-manager.sharedModules = [
let {
zshConfig = {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
defaultKeymap = "viins"; defaultKeymap = "viins";
}; };
# a better cat
programs.bat = {
enable = true;
config.theme = "gruvbox-light";
}; };
in home.shellAliases.cat = "${pkgs.bat}/bin/bat";
{
mainUser = zshConfig; # a better ls
root = zshConfig; programs.exa = {
enable = true;
enableAliases = true;
}; };
home.shellAliases.llt = "${pkgs.exa}/bin/exa -a --tree";
# use z instead of cd
# use zi to fuzzy search through all registered directories
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# provide better `Ctrl+r` command in terminal
programs.mcfly = {
enable = true;
keyScheme = "vim";
fuzzySearchFactor = 3;
enableZshIntegration = true;
enableBashIntegration = true;
};
}
];
programs.zsh = { programs.zsh = {

View file

@ -14,6 +14,8 @@
./hetzner.nix ./hetzner.nix
# ./screeps.nix
./borg.nix ./borg.nix
./codimd.nix ./codimd.nix
./gitea.nix ./gitea.nix
@ -86,7 +88,7 @@
security.acme.defaults.email = "contact@ingolf-wagner.de"; security.acme.defaults.email = "contact@ingolf-wagner.de";
sops.defaultSopsFile = ../../secrets/robi.yaml; sops.defaultSopsFile = ../../secrets/robi.yaml;
virtualisation.docker.enable = false; # virtualisation.docker.enable = false;
services.printing.enable = false; services.printing.enable = false;
services.smartd.enable = true; services.smartd.enable = true;

View file

@ -0,0 +1,74 @@
{ config, lib, pkgs, ... }:
with lib;
let
debug = true;
#version = "latest";
# version = "142c079"; # 2 years ago.
# version = "v1.14.0"; # 2 years ago.
version = "v1.13.2"; # 2 years ago.
in
{
virtualisation.oci-containers = {
containers.screeps = {
volumes = [
"/srv/screeps:/screeps"
(optionalString debug "/srv/screeps-tmp:/tmp")
];
environment.TZ = "Europe/Berlin";
image = "screepers/screeps-launcher:${version}";
ports = [ "21025:21025" ];
};
};
systemd.services =
let
configuration = builtins.toJSON {
steamKey = "keyFromStep3";
version = "latest";
mods = [
#"screepsmod-auth"
#"screepsmod-admin-utils"
#"screepsmod-mongo"
];
bots = {
simplebot = "screepsbot-zeswarm";
};
serverConfig = {
welcomeText = "<h1 style=\"text-align: center;\">My Cool Server</h1>";
constants = {
"TEST_CONSTANT" = 123;
};
tickRate = 1000;
};
};
unitConfig = {
StartLimitInterval = 200;
StartLimitBurst = 2;
};
serviceConfig = {
Restart = mkForce (if debug then "no" else "always");
RestartSec = 30;
ExecStartPre = [
(toString (pkgs.writers.writeDash "create-screeps-config" ''
mkdir -p /srv/screeps/
chown 1000:1000 -R /srv/screeps
${optionalString debug "mkdir -p /srv/screeps-tmp"}
${optionalString debug "chown 1000:1000 -R /srv/screeps-tmp"}
echo '${configuration}' > /srv/screeps/config.yaml
''))
];
};
in
{
podman-screeps = { inherit serviceConfig; };
docker-screeps = { inherit serviceConfig; };
};
#networking.firewall.allowedTCPPorts = [ 8123 ];
#networking.firewall.allowedUDPPorts = [ 8123 ];
#networking.firewall.interfaces.wg0.allowedTCPPorts = [ 8123 ];
#networking.firewall.interfaces.wg0.allowedUDPPorts = [ 8123 ];
}