service: napcat

This commit is contained in:
Sky
2026-01-27 13:27:18 +00:00
parent 1463b7fe63
commit db50babceb
6 changed files with 105 additions and 5 deletions

66
flake.lock generated
View File

@@ -18,6 +18,42 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"napcat": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1769429623,
"narHash": "sha256-Qy1E2TfAw+bL/8/KaRGN0uo768fYJCDf0GQQ4m4oOhE=",
"owner": "initialencounter",
"repo": "napcat.nix",
"rev": "4116701d2fc1ccb6705d2f9c23e282170731fe1d",
"type": "github"
},
"original": {
"owner": "initialencounter",
"repo": "napcat.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1769018530,
@@ -35,6 +71,18 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 0,
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
"path": "/nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1769170682,
"narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=",
@@ -53,7 +101,8 @@
"root": {
"inputs": {
"catppuccin": "catppuccin",
"nixpkgs": "nixpkgs_2",
"napcat": "napcat",
"nixpkgs": "nixpkgs_3",
"secrets": "secrets"
}
},
@@ -72,6 +121,21 @@
"type": "git",
"url": "ssh://git@git.colorsky.fun/Sky/secrets"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@@ -2,6 +2,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
catppuccin.url = "github:catppuccin/nix";
napcat.url = "github:initialencounter/napcat.nix";
secrets.url = "git+ssh://git@git.colorsky.fun/Sky/secrets?shallow=1";
};

View File

@@ -8,6 +8,7 @@
./hardware-configuration.nix
../modules/services/ddns-go.nix
../modules/services/napcat.nix
../modules/services/nignx.nix
../modules/services/gitea.nix

View File

@@ -0,0 +1,32 @@
{ inputs, config, ... }:
let
Napcat = inputs.napcat.lib.${config.nixpkgs.system}.buildNapcat {
qq_config_dir = "/var/lib/napcat/qq/";
nc_config_dir = "/var/lib/napcat/napcat/";
};
in
{
systemd.services.napcat = {
enable = true;
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
description = "Napcat Service";
serviceConfig = {
Type = "simple";
ExecStart = "${Napcat.script}/bin/NapCat";
User = "napcat";
Group = "napcat";
WorkingDirectory = "/var/lib/napcat/";
StateDirectory = "napcat";
StateDirectoryMode = "0750";
};
};
users.users.napcat = {
isNormalUser = true;
home = "/var/lib/napcat/";
extraGroups = [ "napcat" ];
};
users.groups.napcat = { };
}

View File

@@ -1,4 +0,0 @@
{ inputs, ... }:
{
}

View File

@@ -4,4 +4,10 @@
"nix-command"
"flakes"
];
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/user/my-nixos-config"; # sets NH_OS_FLAKE variable for you
};
}