108 lines
3.0 KiB
Nix
108 lines
3.0 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
system,
|
|
...
|
|
}:
|
|
let
|
|
nivSources = import ./nix/sources.nix;
|
|
asGithubRef = src: "github:${src.owner}/${src.repo}/${src.rev}";
|
|
|
|
build_target =
|
|
let
|
|
env_host = builtins.getEnv "NIXOS_TARGET_HOST";
|
|
in
|
|
if env_host != "" then
|
|
env_host
|
|
else
|
|
builtins.replaceStrings [ "\n" ] [ "" ] (lib.toLower (builtins.readFile /proc/sys/kernel/hostname));
|
|
|
|
host_modules = {
|
|
grimmauld-nixos = [ ./specific/grimm-nixos-laptop/configuration.nix ];
|
|
|
|
grimmauld-nixos-server = [
|
|
./specific/grimmauld-nixos-server/configuration.nix
|
|
./modules/letsencrypt.nix
|
|
|
|
./modules/matrix.nix
|
|
./modules/puffer.nix
|
|
./modules/gitea.nix
|
|
./modules/grafana.nix
|
|
./modules/nextcloud.nix
|
|
./modules/prometheus.nix
|
|
# ./modules/mjolnir.nix
|
|
./modules/fail2ban.nix
|
|
./modules/email.nix
|
|
./modules/discord-matrix-bridge.nix
|
|
./modules/mastodon.nix
|
|
];
|
|
};
|
|
|
|
nixpkgs_patches = [
|
|
{
|
|
# tlpui
|
|
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305278.patch";
|
|
hash = "sha256-vmzj7gF8jwHdqxN+dQiJ4MRxKpHvBTzbrUvFgt1DK8I=";
|
|
}
|
|
];
|
|
in
|
|
{
|
|
imports = [
|
|
"${nivSources.agenix}/modules/age.nix"
|
|
(import "${nivSources.lix-module}/module.nix" { lix = nivSources.lix-pkg; })
|
|
"${nivSources.nixos-mailserver}/default.nix"
|
|
"${nivSources.nixos-matrix-modules}/module.nix"
|
|
|
|
# fixme: ideally we'd not rely on the flake syntax to load the module
|
|
(builtins.getFlake (asGithubRef nivSources.chaotic)).nixosModules.default
|
|
# (builtins.getFlake (asGithubRef nivSources.nixos-matrix-modules)).nixosModules.default
|
|
# (builtins.getFlake "git+${nivSources.nixos-mailserver.repo}").nixosModules.default
|
|
] ++ lib.optionals (builtins.hasAttr build_target host_modules) host_modules.${build_target};
|
|
|
|
nixpkgs.hostPlatform = system;
|
|
|
|
# system.nixos = {
|
|
# distroId = "lixos";
|
|
# distroName = "LixOS";
|
|
# };
|
|
|
|
environment.sessionVariables = with config.system.nixos; {
|
|
distro = "${distroName} ${version} (${codeName}) ${system}";
|
|
};
|
|
|
|
nixpkgs.pkgs =
|
|
let
|
|
src = nivSources.nixpkgs;
|
|
config = {
|
|
allowUnfree = true;
|
|
};
|
|
unpatched = import src { inherit config system; };
|
|
inherit (unpatched) applyPatches fetchpatch;
|
|
in
|
|
import (applyPatches {
|
|
name = "nixpkgs-patched";
|
|
inherit src;
|
|
patches = map fetchpatch nixpkgs_patches;
|
|
}) { inherit config; };
|
|
|
|
nixpkgs.overlays = lib.singleton (
|
|
final: prev: { agenix = final.callPackage "${nivSources.agenix}/pkgs/agenix.nix" { }; }
|
|
);
|
|
|
|
_module.args = {
|
|
system = "x86_64-linux";
|
|
};
|
|
|
|
nix.settings.extra-substituters = [
|
|
"https://cache.lix.systems"
|
|
"https://nyx.chaotic.cx/"
|
|
];
|
|
|
|
nix.settings.trusted-public-keys = [
|
|
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
|
|
"nyx.chaotic.cx-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
|
|
"chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
|
|
];
|
|
}
|