wip: module

This commit is contained in:
shimun 2022-11-30 23:48:12 +01:00
parent c29a99e6c4
commit 93337a9b46
Signed by: shimun
GPG Key ID: E0420647856EA39E

View File

@ -15,7 +15,8 @@
root = inputs.source or self;
pname = (builtins.fromTOML (builtins.readFile (root + "/Cargo.toml"))).package.name;
# toolchains: stable, beta, default(nightly)
toolchain = pkgs: if inputs ? fenix then inputs.fenix.packages."${pkgs.system}".complete.toolchain
toolchain = pkgs:
if inputs ? fenix then inputs.fenix.packages."${pkgs.system}".complete.toolchain
else with pkgs; symlinkJoin { name = "rust-toolchain"; paths = [ rustc cargo ]; };
forSystem = system:
let
@ -98,6 +99,54 @@
};
};
nixosModules.default = { config, pkgs, lib, ... }: with lib; let cfg = config.services.ssh-cert-dist; in {
options.services.ssh-cert-dist = {
enable = mkEnableOption "ssh-cert-dist";
host = mkOption {
type = types.str;
default = "127.0.0.1";
};
port = mkOption {
type = types.port;
default = 6877;
};
package = mkOption {
type = types.package;
default = pkgs.ssh-cert-dist;
};
dataDir = mkOption {
type = types.path;
default = "/var/lib/ssh-cert-dist";
};
user = mkOption {
type = types.str;
default = "cert-dist";
};
group = mkOption {
type = types.str;
default = "cert-dist";
};
};
config = mkIf {
users = {
users.${cfg.user} = {
isSystemUser = true;
group = cfg.group;
};
groups.${cfg.group} = { };
};
systemd.services.ssh-cert-dist = {
preStart = ''
chown ${cfg.user}:${cfg.group} ${cfg.dataDir}
'';
serviceConfig.User = cfg.user;
serviceConfig.ExecStart = "${cfg.package}/bin/ssh-cert-dist server --address ${cfg.host}:${toString cfg.port} -c ${cfg.dataDir} --ca ${cfg.ca}";
};
};
};
homeManagerModules.default = { config, pkgs, lib, ... }: with lib; let cfg = config.services.ssh-cert-dist; in { };
};
}