run alejandra on nix code

This commit is contained in:
Solene Rapenne 2022-09-05 00:42:02 +02:00
parent 3b76016f9b
commit 0a051682b0
2 changed files with 30 additions and 24 deletions

View File

@ -1,26 +1,30 @@
{ lib, pkgs, ... }:
let
create_users = host:
{
users.users."${host.username}" = {
createHome = false;
home = "/home/chroot/" + host.username;
isNormalUser = false;
isSystemUser = true;
group = "sftp_users";
openssh.authorizedKeys.keys = [ host.key ];
shell = null;
};
{
lib,
pkgs,
...
}: let
create_users = host: {
users.users."${host.username}" = {
createHome = false;
home = "/home/chroot/" + host.username;
isNormalUser = false;
isSystemUser = true;
group = "sftp_users";
openssh.authorizedKeys.keys = [host.key];
shell = null;
};
};
users = [
{ username = "router"; key = "ssh-ed25519 AAAAC3NzaC2aZGI1OTE5AAAAOIOZKLFCZLM67viQXHYRjraE6WLfvETMkjjgSz0mxMzS root@router"; }
{
username = "router";
key = "ssh-ed25519 AAAAC3NzaC2aZGI1OTE5AAAAOIOZKLFCZLM67viQXHYRjraE6WLfvETMkjjgSz0mxMzS root@router";
}
];
in
{
in {
imports = builtins.map create_users users;
users.groups = { sftp_users = {}; };
users.groups = {sftp_users = {};};
services.openssh.extraConfig = ''
Match Group sftp_users
@ -29,5 +33,4 @@ in
ChrootDirectory %h
ForceCommand internal-sftp
'';
}

View File

@ -1,20 +1,23 @@
{ lib, pkgs, ... }:
let
timer = "*:0/5";
in
{
lib,
pkgs,
...
}: let
timer = "*:0/15";
in {
systemd.timers.bento-upgrade = {
enable = true;
timerConfig = {
OnCalendar = "${timer}";
Unit = "bento-upgrade.service";
};
wantedBy = [ "timers.target" ];
wantedBy = ["timers.target"];
after = ["network-online.target"];
};
systemd.services.bento-upgrade = {
enable = true;
path = with pkgs; [ openssh git nixos-rebuild nix gzip ];
path = with pkgs; [openssh git nixos-rebuild nix gzip];
serviceConfig.Type = "oneshot";
script = ''
cd /var/bento