refactor: pull out systems

This commit is contained in:
2025-07-17 15:21:06 +00:00
parent 20dcbdfdc4
commit 23d9db27e6
6 changed files with 128 additions and 99 deletions

View File

@@ -18,7 +18,8 @@
}@inputs: let
flake = ./.;
nixpkgs = nixpkgs-25-05;
self-lib = import ./lib { inherit flake self inputs; };
overlays = [ self.overlays.default ];
self-lib = import ./lib { inherit flake self inputs nixpkgs; };
buildPostgresqlExtension =
pkgs: pkgs.callPackage (import (builtins.path {
@@ -369,98 +370,15 @@
});
};
nixosConfigurations = {
"devvm|manual|${system}" = import "./nixos/system/devvm|manual" { inherit flake self inputs; };
"hemar-test|${system}" = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
({modulesPath, pkgs, lib, ...}: {
imports = [
self.nixosModules.hectic
(modulesPath + "/profiles/qemu-guest.nix")
];
hectic = {
archetype.dev.enable = true;
hardware.hetzner-cloud.enable = true;
};
users.users.root.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICrbBG+U07f7OKvOxYIGYCaNvyozzxQF+I9Fb5TYZErK yukkop vm-postgres''
];
services.postgresql =
let
package = pkgs.postgresql_15;
in {
enable = true;
package = package;
settings =
{
port = 64317;
listen_addresses = lib.mkForce "*";
shared_preload_libraries = "";
};
extensions = [ package.pkgs.hemar ];
authentication = builtins.concatStringsSep "\n" [
"local all all trust"
"host sameuser all 127.0.0.1/32 scram-sha-256"
"host sameuser all ::1/128 scram-sha-256"
];
initialScript = pkgs.writeText "init-sql-script" ''
SET log_min_messages TO DEBUG1;
SET client_min_messages TO DEBUG1;
ALTER DATABASE postgres SET log_min_messages TO DEBUG1;
ALTER DATABASE postgres SET client_min_messages TO DEBUG1;
CREATE EXTENSION "hemar";
\i ${./package/c/hemar/test}/mod.sql
'';
};
environment.systemPackags = with pkgs; [
gdb
hectic.nvim-pager
(writeScriptBin "check" ''
journalctl -u postgresql.service | grep postgresql-post-start | sed 's|psql:/nix/store/[^:]*:[0-9]*: ||' | sed 's|^[^:]*:[^:]*:[^:]*: ||' | grep -v '^\[.*\]' | ${hectic.prettify-log}/bin/prettify-log --color-output
'')
];
programs.zsh.shellAliases = self.lib.sharedShellAliasesForDevVm // {
conn = "sudo su postgres -c 'psql -p 64317'";
};
virtualisation = {
vmVariant = {
systemd.services.fix-root-perms = {
description = "Fix root directory permissions";
after = [ "local-fs.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/chmod 755 /";
};
};
virtualisation = {
diskSize = 1024*6;
diskImage = null;
forwardPorts = [ ];
};
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [
80
];
};
})
];
pkgs = import nixpkgs {inherit system; overlays = [ self.overlays.default ];};
};
"devvm-manual|${system}" = import ./nixos/system/devvm-manual/default.nix { inherit flake self inputs system; };
"devvm-hemar|${system}" = import ./nixos/system/devvm-hemar/default.nix { inherit flake self inputs system; };
};
}) //
{
legacyPackages = self.lib.forAllSystems (system: import nixpkgs {
inherit system overlays;
});
lib = self-lib;
overlays.default = import ./overlay { inherit flake self inputs nixpkgs; };
nixosModules = import ./nixos/module { inherit flake self inputs nixpkgs; };