Initial flake commit

This commit is contained in:
Niten 2021-08-04 12:37:55 -07:00
parent 3b11040922
commit a5a6a02929
10 changed files with 122 additions and 46 deletions

View File

@ -33,17 +33,17 @@ in {
secret-paths = [ "/state/secrets" ];
};
systemd.tmpfiles.rules = [
"L /root/.gnupg - - - - ${state-dir}/user/root/gnupg"
# "L /root/.emacs.d - - - - ${state-dir}/user/root/emacs.d"
"L /root/.ssh/id_rsa - - - - ${state-dir}/user/root/ssh/id_rsa"
"L /root/.ssh/id_rsa.pub - - - - ${state-dir}/user/root/ssh/id_rsa.pub"
"L /root/.ssh/known_hosts - - - - ${state-dir}/user/root/ssh/known_hosts"
fudo.games.valheim = {
enable = true;
state-directory = "/state/games/valheim";
password = "silkymilky";
};
# "L /etc/ssh/ssh_host_rsa_key - - - - ${state-dir}/ssh/ssh_host_rsa_key"
# "L /etc/ssh/ssh_host_rsa_key.pub - - - - ${state-dir}/ssh/ssh_host_rsa_key.pub"
# "L /etc/ssh/ssh_host_ed25519_key - - - - ${state-dir}/ssh/ssh_host_ed25519_key"
# "L /etc/ssh/ssh_host_ed25519_key.pub - - - - ${state-dir}/ssh/ssh_host_ed25519_key.pub"
systemd.tmpfiles.rules = [
"L /root/.gnupg - - - - ${state-dir}/user/root/gnupg"
"L /root/.ssh/id_rsa - - - - ${state-dir}/user/root/ssh/id_rsa"
"L /root/.ssh/id_rsa.pub - - - - ${state-dir}/user/root/ssh/id_rsa.pub"
"L /root/.ssh/known_hosts - - - - ${state-dir}/user/root/ssh/known_hosts"
];
services.openssh.hostKeys = [

View File

@ -2,7 +2,7 @@
{
system.stateVersion = "20.09";
# TODO: remove?
nixpkgs.config.permittedInsecurePackages = [
"openssh-with-gssapi-8.4p1" # CVE-2021-28041
@ -10,6 +10,8 @@
fudo.slynk.enable = true;
environment.systemPackages = with pkgs; [ opencv-java worther ];
networking = {
interfaces = {
eno1.useDHCP = false;

View File

@ -43,13 +43,6 @@ in {
# };
};
emacs = {
enable = true;
install = true;
package = pkgs.emacs;
defaultEditor = true;
};
trezord.enable = true;
};

View File

@ -52,16 +52,7 @@ in {
networking.networkmanager.enable = mkForce false;
services = {
xserver.enable = false;
emacs = {
enable = true;
install = true;
package = pkgs.emacs;
defaultEditor = true;
};
};
services = { xserver.enable = false; };
sound.enable = false;
hardware.pulseaudio.enable = false;

View File

@ -1,7 +1,7 @@
let target-version = "21.05";
in {
description = "A very basic flake";
description = "Fudo Host Configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-${target-version}";
@ -20,10 +20,20 @@ in {
hosts = map hostname-from-file (attrNames (filterAttrs is-nix-file
(filterAttrs is-regular-file (builtins.readDir ./config/hosts))));
in {
nixConfigurations = mapAttrs (host: hostOpts:
lib.nixosSystem {
pkgs = import nixpkgs { };
in {
nixConfigurations = mapAttrs (hostname: hostOpts:
lib.nixosSystem {
inherit system;
modules = [
(import ./initialize.nix {
hostname = hostname;
home-manager-package = home-manager;
pkgs = pkgs;
include-secrets = true;
})
];
}) host-configs;
};
}

View File

@ -18,8 +18,8 @@ let
doom-emacs = pkgs.callPackage (pkgs.fetchgit {
url = "https://github.com/vlaci/nix-doom-emacs.git";
rev = "3893c50877a9d2d5d4aeee524ba1539f22115f1f";
sha256 = "1jz8mxh143a4470mq303ng6dh3bxi6mcppqli4z0m13qhqssh4fx";
rev = "fee14d217b7a911aad507679dafbeaa8c1ebf5ff";
sha256 = "1g0izscjh5nv4n0n1m58jc6z27i9pkbxs17mnb05a83ffdbmmva6";
}) {
doomPrivateDir = "${pkgs.doom-emacs-config}";
extraPackages = with pkgs.emacsPackages; [ elpher use-package ];
@ -70,6 +70,7 @@ let
cdrtools
cargo
clojure
clj2nix
cmake
curl
doom-emacs
@ -158,7 +159,17 @@ in {
"Xft.lcdfilter" = "lcddefault";
};
services.gpg-agent.enable = true;
services = {
emacs = {
enable = true;
package = doom-emacs;
client = {
enable = true;
arguments = [ "-t" ];
};
};
gpg-agent.enable = true;
};
home = {
packages =
@ -194,23 +205,15 @@ in {
'';
};
".fonts.conf" = { source = ../static/fonts.conf; };
# ".fonts.conf" = { source = ../static/fonts.conf; };
};
sessionVariables = {
EDITOR = "emacsclient -t";
# EDITOR = "${doom-emacs}/bin/emacsclient -t";
ALTERNATE_EDITOR = "";
HISTCONTROL = "ignoredups:ignorespace";
};
# activation = let
# ensure-dir-script = dir: ''
# $DRY_RUN_CMD [[ -d "${dir}" ]] || mkdir -p "${dir}"
# '';
# ensure-dirs-script =
# concatStringsSep "\n" (map ensure-dir-script ensure-directories);
# in hm.dag.entryAfter [ "writeBoundary" ] ensure-dirs-script;
};
systemd.user.tmpfiles.rules =

View File

@ -43,6 +43,8 @@ with lib; {
./fudo/webmail.nix
./fudo/wireless-networks.nix
./fudo/games/valheim.nix
./informis/cl-gemini.nix
];
}

View File

@ -0,0 +1,5 @@
{ ... }:
{
imports = [ ./valheim.nix ];
}

View File

@ -0,0 +1,63 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.fudo.games.valheim;
in {
options.fudo.games.valheim = with types; {
enable = mkEnableOption "Enable dedicated Valheim server.";
state-directory = mkOption {
type = str;
description = "Directory at which to store Valheim state data.";
default = "/var/lib/valheim";
};
port = mkOption {
type = port;
description = "Port on which to listen for connections.";
default = 2456;
};
password = mkOption {
type = str;
description = "Password required by connecting users.";
};
};
config = mkIf cfg.enable {
users.users.valheim = {
home = cfg.state-directory;
createHome = true;
isSystemUser = true;
};
systemd.services.fudo-valheim = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStartPre = ''
[[ -d ${cfg.state-directory}/state ]] || mkdir ${cfg.state-directory}/state
${pkgs.steamcmd}/bin/steamcmd \
+login anonymous \
+force_install_dir ${cfg.state-directory}/state \
+app_update 896660 \
+quit
'';
ExecStart = ''
${pkgs.glibc}/lib/ld-linux-x86-64.so.2 ./valheim_server.x86_64 \
-name "CoCo Valheim" \
-port ${toString cfg.port} \
-world "Dedicated" \
-password ${cfg.password} \
-public 1
'';
Nice = -5;
Restart = "always";
User = "valheim";
StateDirectory = "${cfg.state-directory}/state";
WorkingDirectory = cfg.state-directory;
};
environment = { LD_LIBRARY_PATH = "linux64:${pkgs.glibc}/lib"; };
};
};
}

View File

@ -68,8 +68,9 @@ in {
opencv-java = pkgs.opencv.overrideAttrs (oldAttrs: rec {
# buildInputs = oldAttrs.buildInputs ++ [ pkgs.ant ];
pname = "opencv-java";
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ pkgs.jdk11 pkgs.ant ];
# cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DWITH_JAVA=ON" ];
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DWITH_JAVA=ON" ];
});
hll2380dw-cups = import ./hll2380dw-cups.nix {
@ -176,5 +177,11 @@ in {
rev = "278a90f7ce219e36e5de0a80b540e469a9bce912";
sha256 = "06qns3ayc84mamdgn0jw652rvx60wy9km1vxm2361mzmx2zk89iw";
};
clj2nix = pkgs.callPackage (pkgs.fetchgit {
url = "https://github.com/hlolli/clj2nix.git";
rev = "e6d09dd8c5cda68eb0534bd8501f2d5dcd7b2e95";
sha256 = "0v0q6iglr0lx13j1snzd8mjxids1af1p2h7bkvmsyk2bfp36naqx";
}) { };
};
}