diff --git a/flake.lock b/flake.lock index e62f023..266523b 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index ac9c219..563141d 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; }; diff --git a/host/macmini.nix b/host/macmini.nix index 6904958..50e5692 100644 --- a/host/macmini.nix +++ b/host/macmini.nix @@ -8,6 +8,7 @@ ./hardware-configuration.nix ../modules/services/ddns-go.nix + ../modules/services/napcat.nix ../modules/services/nignx.nix ../modules/services/gitea.nix diff --git a/modules/services/napcat.nix b/modules/services/napcat.nix new file mode 100644 index 0000000..feb3004 --- /dev/null +++ b/modules/services/napcat.nix @@ -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 = { }; +} diff --git a/modules/services/qqbot.nix b/modules/services/qqbot.nix deleted file mode 100644 index f0cb62c..0000000 --- a/modules/services/qqbot.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ inputs, ... }: -{ - -} diff --git a/modules/system/nix.nix b/modules/system/nix.nix index c2d2eb2..0569e37 100644 --- a/modules/system/nix.nix +++ b/modules/system/nix.nix @@ -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 + }; }