This commit is contained in:
Ivan Dimitrov 2023-09-20 13:38:25 +03:00
parent d83427101d
commit b5e5477924
5 changed files with 20 additions and 141 deletions

View File

@ -32,49 +32,6 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": [
"idimitrov-dev",
"systems"
]
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"idimitrov-dev": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1695141374,
"narHash": "sha256-BgUELqnj4PU1ITuUWcW8gm2XhWaFTNvibeYBshzneaI=",
"ref": "refs/heads/master",
"rev": "7246dcd67eb881a43bfd318c912d1ba6146a2d8d",
"revCount": 43,
"type": "git",
"url": "ssh://git@gitlab.com/ivandimitrov8080/idimitrov.dev.git"
},
"original": {
"type": "git",
"url": "ssh://git@gitlab.com/ivandimitrov8080/idimitrov.dev.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1694948089,
@ -121,9 +78,9 @@
},
"root": {
"inputs": {
"idimitrov-dev": "idimitrov-dev",
"nixpkgs": "nixpkgs",
"simple-nixos-mailserver": "simple-nixos-mailserver"
"simple-nixos-mailserver": "simple-nixos-mailserver",
"vpsadminos": "vpsadminos"
}
},
"simple-nixos-mailserver": {
@ -151,21 +108,6 @@
"type": "gitlab"
}
},
"systems": {
"locked": {
"lastModified": 1680978846,
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
"owner": "nix-systems",
"repo": "x86_64-linux",
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "x86_64-linux",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1605370193,
@ -180,6 +122,21 @@
"repo": "flake-utils",
"type": "github"
}
},
"vpsadminos": {
"locked": {
"lastModified": 1695118083,
"narHash": "sha256-3QCCbdELfwJSQesI5UCAjYXsmolRbnTVoviE5t/IE5M=",
"owner": "vpsfreecz",
"repo": "vpsadminos",
"rev": "4f35e4859adb98f67ccbcb261b92ae635c004039",
"type": "github"
},
"original": {
"owner": "vpsfreecz",
"repo": "vpsadminos",
"type": "github"
}
}
},
"root": "root",

View File

@ -5,17 +5,14 @@
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs";
};
"idimitrov-dev" = {
url = "git+ssh://git@gitlab.com/ivandimitrov8080/idimitrov.dev.git";
inputs.nixpkgs.follows = "nixpkgs";
};
vpsadminos.url = "github:vpsfreecz/vpsadminos";
};
outputs =
{ self
, nixpkgs
, simple-nixos-mailserver
, idimitrov-dev
, vpsadminos
, ...
}: {
nixosConfigurations = {
@ -23,7 +20,7 @@
system = "x86_64-linux";
modules = [
simple-nixos-mailserver.nixosModule
idimitrov-dev.nixosModules.x86_64-linux.default
vpsadminos.nixosConfigurations.container
./mailserver
];
};

View File

@ -1,9 +1,5 @@
{ config, pkgs, ... }:
{
imports = [
./vpsadminos.nix
];
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
#users.extraUsers.root.openssh.authorizedKeys.keys =

View File

@ -1,67 +0,0 @@
# This file provides compatibility for NixOS to run in a container on vpsAdminOS
# hosts.
#
# If you're experiencing issues, try updating this file to the latest version
# from vpsAdminOS repository:
#
# https://github.com/vpsfreecz/vpsadminos/blob/staging/os/lib/nixos-container/vpsadminos.nix
{ config, pkgs, lib, ... }:
with lib;
let
nameservers = [
"1.1.1.1"
"2606:4700:4700::1111"
];
in {
networking.nameservers = mkDefault nameservers;
services.resolved = mkDefault { fallbackDns = nameservers; };
networking.dhcpcd.extraConfig = "noipv4ll";
systemd.services.systemd-sysctl.enable = false;
systemd.services.systemd-oomd.enable = false;
systemd.sockets."systemd-journald-audit".enable = false;
systemd.mounts = [ {where = "/sys/kernel/debug"; enable = false;} ];
systemd.services.rpc-gssd.enable = false;
# Due to our restrictions in /sys, the default systemd-udev-trigger fails
# on accessing PCI devices, etc. Override it to match only network devices.
# In addition, boot.isContainer prevents systemd-udev-trigger.service from
# being enabled at all, so add it explicitly.
systemd.additionalUpstreamSystemUnits = [
"systemd-udev-trigger.service"
];
systemd.services.systemd-udev-trigger.serviceConfig.ExecStart = [
""
"-udevadm trigger --subsystem-match=net --action=add"
];
boot.isContainer = true;
boot.enableContainers = mkDefault true;
boot.loader.initScript.enable = true;
boot.specialFileSystems."/run/keys".fsType = mkForce "tmpfs";
boot.systemdExecutable = mkDefault "/run/current-system/systemd/lib/systemd/systemd systemd.unified_cgroup_hierarchy=0";
# Overrides for <nixpkgs/nixos/modules/virtualisation/container-config.nix>
documentation.enable = mkOverride 500 true;
documentation.nixos.enable = mkOverride 500 true;
networking.useHostResolvConf = mkOverride 500 false;
services.openssh.startWhenNeeded = mkOverride 500 false;
# Bring up the network, /ifcfg.{add,del} are supplied by the vpsAdminOS host
systemd.services.networking-setup = {
description = "Load network configuration provided by the vpsAdminOS host";
before = [ "network.target" ];
wantedBy = [ "network.target" ];
after = [ "network-pre.target" ];
path = [ pkgs.iproute2 ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.bash}/bin/bash /ifcfg.add";
ExecStop = "${pkgs.bash}/bin/bash /ifcfg.del";
};
unitConfig.ConditionPathExists = "/ifcfg.add";
restartIfChanged = false;
};
}

View File

@ -51,8 +51,4 @@
allowedTCPPorts = [ 80 443 ];
};
idimitrov-dev = {
enable = true;
};
}