give go module proper name
This commit is contained in:
66
flake.nix
66
flake.nix
@@ -23,5 +23,71 @@
|
||||
tailwindcss
|
||||
];
|
||||
};
|
||||
|
||||
packages.zineshop = nixpkgs.legacyPackages.x86_64-linux.buildGoModule {
|
||||
pname = "zineshop";
|
||||
version = "1.0";
|
||||
vendorHash = "sha256-0M/xblZXVw4xIFZeDewYrFu7VGUCsPTPG13r9ZpTGJo=";
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
nixosModules.zineshop = { config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.zineshop;
|
||||
zineshop-pkg = self.packages.x86_64-linux.zineshop;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.zineshop = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
description = lib.mdDoc ''
|
||||
Enables zineshop
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ zineshop-pkg ];
|
||||
|
||||
users = {
|
||||
groups.zineshop = {};
|
||||
users.zineshop = {
|
||||
description = "zineshop user";
|
||||
group = "zineshop";
|
||||
isNormalUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.zineshop = {
|
||||
description = "zineshop daemon";
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${zineshop-pkg}/bin/main";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
environment = {
|
||||
SQLITE_DB = "/var/lib/zineshop/zineshop.db";
|
||||
SECRET = "secretforjwt"; #TODO: BAD!
|
||||
PORT = "8080";
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
mkdir -m 0770 -p "/var/lib/zineshop"
|
||||
chown zineshop:zineshop "/var/lib/zineshop"
|
||||
'';
|
||||
|
||||
wantedBy = [ "default.target" ];
|
||||
|
||||
environment = {
|
||||
USER = "zineshop";
|
||||
HOME = "/var/lib/zineshop";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})) {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user