1
0
Fork 0

Make syncthing optional, and opt-into standalone systems

This commit is contained in:
Malte Brandy 2018-06-08 22:14:08 +02:00
parent e46a65e05c
commit 2e60af5b0b
8 changed files with 78 additions and 51 deletions

View file

@ -11,6 +11,7 @@ imports = [
<nixos-hardware/common/pc/ssd>
./hardware-configuration.nix
../../system
./syncthing.nix
];
networking = {
@ -19,6 +20,7 @@ networking = {
m-0 = {
laptop.enable = true;
standalone.enable = true;
};
home-manager.users."${me.user}" = (import ./home.nix);

View file

@ -0,0 +1,18 @@
{config, lib, ...}:
with lib;
let
me = config.m-0.private.me;
in {
boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 204800; };
services = mkIf config.m-0.standalone.enable {
syncthing = {
dataDir = "/home/${me.user}/.config/syncthing";
enable = true;
group = "users";
user = me.user;
openDefaultPorts = true;
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, lib, ... }:
{
# channel = 18.03
@ -7,56 +7,25 @@
../common/secret
../common/private-options.nix
./modules/laptop.nix
./modules/server.nix
./admin.nix
./syncthing.nix
./modules/server
./modules/standalone
./modules/cdarknet
./modules/loginctl-linger.nix
];
i18n = {
defaultLocale = "en_US.UTF-8";
};
time.timeZone = "Europe/Berlin";
# So that boot does not fill up with old kernels
boot.loader.grub.configurationLimit = 5;
users = {
defaultUserShell = pkgs.zsh;
mutableUsers = false;
};
security.sudo.extraConfig = "
Defaults timestamp_type=global, timestamp_timeout=15
";
networking = {
firewall.allowPing = true;
useDHCP = false;
};
services = {
sshd.enable = true;
};
environment = {
# Put these into an extra file so the essential packages can also be included on non selfadminstrated systems from home-manager
systemPackages = let essentials = import ../common/essentials.nix;
in (essentials.core pkgs) ++ (essentials.extra pkgs);
sessionVariables = {
TERMINFO = "/run/current-system/sw/share/terminfo";
};
};
programs = {
mtr.enable = true;
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
};
users = {
mutableUsers = false;
};
}

View file

@ -1,8 +1,9 @@
{config, ...}:
{config, lib, ...}:
with lib;
let
me = config.m-0.private.me;
in {
users.users = {
users.users = mkIf config.m-0.standalone.enable {
"${me.user}" = {
linger = true;
description = me.name;

View file

@ -0,0 +1,49 @@
{ pkgs, config, lib, ... }:
with lib;
{
imports = [ ./admin.nix ];
options.m-0.standalone.enable = mkOption {
type = types.bool;
default = false;
};
config = mkIf config.m-0.standalone.enable {
# So that boot does not fill up with old kernels
boot.loader.grub.configurationLimit = 5;
users = {
defaultUserShell = pkgs.zsh;
mutableUsers = false;
};
security.sudo.extraConfig = "
Defaults timestamp_type=global, timestamp_timeout=15
";
services = {
sshd.enable = true;
};
environment = {
# Put these into an extra file so the essential packages can also be included on non selfadminstrated systems from home-manager
systemPackages = let essentials = import ../../../common/essentials.nix;
in (essentials.core pkgs) ++ (essentials.extra pkgs);
sessionVariables = {
TERMINFO = "/run/current-system/sw/share/terminfo";
};
};
programs = {
mtr.enable = true;
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
};
};
};
}

View file

@ -1,12 +0,0 @@
{
boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 204800; };
services = {
syncthing = {
dataDir = "/home/maralorn/.config/syncthing";
enable = true;
group = "users";
user = "maralorn";
openDefaultPorts = true;
};
};
}