grimm-nixos-laptop/fake_flake.nix

108 lines
3.0 KiB
Nix
Raw Permalink Normal View History

2024-05-07 23:31:41 +02:00
{
pkgs,
lib,
config,
system,
...
}:
2024-05-07 12:19:14 +02:00
let
nivSources = import ./nix/sources.nix;
asGithubRef = src: "github:${src.owner}/${src.repo}/${src.rev}";
2024-05-07 13:41:59 +02:00
2024-05-08 21:50:08 +02:00
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));
2024-05-08 20:00:00 +02:00
host_modules = {
2024-05-08 21:50:08 +02:00
grimmauld-nixos = [ ./specific/grimm-nixos-laptop/configuration.nix ];
2024-05-08 21:49:37 +02:00
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
];
2024-05-08 20:00:00 +02:00
};
2024-05-07 13:41:59 +02:00
nixpkgs_patches = [
{
# tlpui
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305278.patch";
2024-05-08 23:08:25 +02:00
hash = "sha256-vmzj7gF8jwHdqxN+dQiJ4MRxKpHvBTzbrUvFgt1DK8I=";
2024-05-07 13:41:59 +02:00
}
];
2024-05-07 12:19:14 +02:00
in
{
imports = [
"${nivSources.agenix}/modules/age.nix"
(import "${nivSources.lix-module}/module.nix" { lix = nivSources.lix-pkg; })
2024-05-08 21:49:37 +02:00
"${nivSources.nixos-mailserver}/default.nix"
"${nivSources.nixos-matrix-modules}/module.nix"
2024-05-08 21:50:08 +02:00
# fixme: ideally we'd not rely on the flake syntax to load the module
2024-05-08 21:49:37 +02:00
(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
2024-05-08 21:50:08 +02:00
] ++ lib.optionals (builtins.hasAttr build_target host_modules) host_modules.${build_target};
2024-05-07 12:19:14 +02:00
2024-05-07 20:47:08 +02:00
nixpkgs.hostPlatform = system;
2024-05-07 12:19:14 +02:00
2024-05-08 23:08:25 +02:00
# system.nixos = {
# distroId = "lixos";
# distroName = "LixOS";
# };
2024-05-07 15:14:12 +02:00
environment.sessionVariables = with config.system.nixos; {
2024-05-07 20:47:08 +02:00
distro = "${distroName} ${version} (${codeName}) ${system}";
2024-05-07 15:14:12 +02:00
};
2024-05-07 13:41:59 +02:00
nixpkgs.pkgs =
let
src = nivSources.nixpkgs;
2024-05-07 23:31:41 +02:00
config = {
allowUnfree = true;
};
2024-05-07 20:47:08 +02:00
unpatched = import src { inherit config system; };
2024-05-07 13:41:59 +02:00
inherit (unpatched) applyPatches fetchpatch;
in
2024-05-07 23:31:41 +02:00
import (applyPatches {
name = "nixpkgs-patched";
inherit src;
patches = map fetchpatch nixpkgs_patches;
}) { inherit config; };
2024-05-07 13:13:37 +02:00
2024-05-07 13:41:59 +02:00
nixpkgs.overlays = lib.singleton (
final: prev: { agenix = final.callPackage "${nivSources.agenix}/pkgs/agenix.nix" { }; }
);
2024-05-07 12:19:14 +02:00
2024-05-07 23:31:41 +02:00
_module.args = {
system = "x86_64-linux";
2024-05-07 20:47:08 +02:00
};
2024-05-07 12:19:14 +02:00
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="
];
}