1
0
Fork 0

Setup hera

This commit is contained in:
Malte Brandy 2018-06-02 13:13:13 +02:00
parent 1803ca2f6e
commit 67bdab2107
10 changed files with 58 additions and 43 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
configuration.nix
local

View file

@ -28,4 +28,5 @@
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = "ondemand";
security.rngd.enable = true;
}

View file

@ -4,9 +4,11 @@
{ config, lib, pkgs, ... }:
{
imports = [ ];
imports = [
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
@ -16,7 +18,7 @@
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/A8E7-3962";
{ device = "/dev/disk/by-uuid/3D8A-20F0";
fsType = "vfat";
};

View file

@ -5,8 +5,4 @@ imports = [
../../home-manager
];
m-0.rustdev.enable = true;
m-0.taskwarrior.enable = true;
m-0.eventd.enable = true;
}

BIN
hosts/hera/secret/boot_rsa Normal file

Binary file not shown.

View file

@ -7,6 +7,7 @@
../common/secret
../common/private-options.nix
./modules/laptop.nix
./modules/server.nix
./admin.nix
./syncthing.nix
./modules/cdarknet
@ -18,8 +19,6 @@
time.timeZone = "Europe/Berlin";
security.rngd.enable = true;
# So that boot does not fill up with old kernels
boot.loader.grub.configurationLimit = 5;
@ -32,7 +31,10 @@
Defaults timestamp_type=global, timestamp_timeout=15
";
networking.firewall.allowPing = true;
networking = {
firewall.allowPing = true;
useDHCP = false;
};
services = {
sshd.enable = true;

View file

@ -1,16 +0,0 @@
{ config, pkgs, ... }:
{
boot.initrd.network = {
enable = true;
ssh = {
enable = true;
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
# generate file with
# dropbearkey -t rsa -f /etc/nixos/boot_rsa
# nix-env -iA nixos.dropbear
hostRSAKey = /etc/nixos/local/boot_rsa;
};
};
}

View file

@ -0,0 +1,23 @@
{ config, pkgs, lib, ... }:
with lib;
{
config = mkIf config.m-0.server.enable {
boot.initrd = {
network = {
enable = true;
ssh = {
enable = true;
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
# generate file with
# dropbearkey -t rsa -f /etc/nixos/boot_rsa
# nix-env -iA nixos.dropbear
hostRSAKey = ../../local/secret/boot_rsa;
};
};
postMountCommands = "ip link set eth0 down";
};
};
}

View file

@ -4,6 +4,7 @@ with lib;
options = {
m-0.laptop.enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.m-0.laptop.enable {

View file

@ -1,21 +1,26 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
with lib;
{
options = {
m-0.server.enable = mkOption {
type = types.bool;
};
};
config = mkIf config.m-0.server.enable {
nix = {
gc = {
automatic = true;
options = "--delete-older-than 5d";
};
optimise.automatic = true;
};
system.autoUpgrade.enable = true;
system.autoUpgrade.dates = "22:00";
imports = [ ./init_ssh.nix ];
options = {
m-0.server.enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.m-0.server.enable {
nix = {
gc = {
automatic = true;
options = "--delete-older-than 5d";
};
optimise.automatic = true;
};
system.autoUpgrade.enable = true;
system.autoUpgrade.dates = "22:00";
};
}