Compare commits

..

No commits in common. "a22747bb666788d8cd72966b94c0e98896b428c1" and "2010556643e14cab72837cbc0ed17d8b1e81d907" have entirely different histories.

4 changed files with 6 additions and 36 deletions

8
flake.lock generated
View File

@ -190,11 +190,11 @@
]
},
"locked": {
"lastModified": 1755204441,
"narHash": "sha256-f1wkq/RxfjFPnAriK7KhrFQ8x+Wet7OrJTaTd9YPAXU=",
"lastModified": 1752865540,
"narHash": "sha256-VYLXcV8FsaMTsmxISOejvBq76eA41yi7BCRNW1qGbV0=",
"ref": "refs/heads/main",
"rev": "7070a12e16b9a25b61212194e7683b059c3c2c96",
"revCount": 503,
"rev": "f732582d0d1389721ea2c91ab370ba2fb824d644",
"revCount": 496,
"type": "git",
"url": "https://git.pvv.ntnu.no/Projects/nettsiden.git"
},

View File

@ -11,8 +11,7 @@ in
systemd.services.gitea-import-users = lib.mkIf cfg.enable {
enable = true;
preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /run/gitea-import-users/passwd'';
environment.PASSWD_FILE_PATH = "/run/gitea-import-users/passwd";
preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /tmp/passwd-import'';
serviceConfig = {
ExecStart = pkgs.writers.writePython3 "gitea-import-users" {
flakeIgnore = [
@ -26,7 +25,6 @@ in
];
DynamicUser="yes";
EnvironmentFile=config.sops.secrets."gitea/import-user-env".path;
RuntimeDirectory = "gitea-import-users";
};
};

View File

@ -17,10 +17,6 @@ GITEA_API_URL = os.getenv('GITEA_API_URL')
if GITEA_API_URL is None:
GITEA_API_URL = 'https://git.pvv.ntnu.no/api/v1'
PASSWD_FILE_PATH = os.getenv('PASSWD_FILE_PATH')
if PASSWD_FILE_PATH is None:
PASSWD_FILE_PATH = '/tmp/passwd-import'
def gitea_list_all_users() -> dict[str, dict[str, any]] | None:
r = requests.get(
@ -191,8 +187,7 @@ def main():
if existing_users is None:
exit(1)
print(f"Reading passwd entries from {PASSWD_FILE_PATH}")
for username, name in passwd_file_parser(PASSWD_FILE_PATH):
for username, name in passwd_file_parser("/tmp/passwd-import"):
print(f"Processing {username}")
add_or_patch_gitea_user(username, name, existing_users)
for org, team_name in COMMON_USER_TEAMS:

View File

@ -1,23 +0,0 @@
{ pkgs, ... }:
{
users.users.alb = {
isNormalUser = true;
extraGroups = [ "wheel" "drift" "nix-builder-users" ];
packages = with pkgs; [
htop
neovim
ripgrep
fd
tmux
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICheSCAxsYc/6g8hq2lXXHoUWPjWvntzzTA7OhG8waMN albert@Arch"
];
};
}