module fix

This commit is contained in:
Robin Appelman 2025-06-09 18:58:46 +02:00
commit 6ab675c3d0
3 changed files with 15 additions and 11 deletions

View file

@ -20,6 +20,10 @@
"x86_64-unknown-linux-musl" "x86_64-unknown-linux-musl"
]; ];
overlays = {
default = import ./nix/overlay.nix;
};
nixosModules = {outputs, ...}: { nixosModules = {outputs, ...}: {
default = { default = {
pkgs, pkgs,

View file

@ -16,10 +16,15 @@ in {
example = "INFO"; example = "INFO";
description = "log level"; description = "log level";
}; };
package = mkOption {
type = types.package;
description = "package to use";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.dbus.packages = [self.packages.${pkgs.system}.default]; services.dbus.packages = [cfg.package];
users.users.shortcutd = { users.users.shortcutd = {
isSystemUser = true; isSystemUser = true;
@ -34,12 +39,10 @@ in {
RUST_LOG = cfg.log; RUST_LOG = cfg.log;
}; };
serviceConfig = let serviceConfig = {
pkg = self.packages.${pkgs.system}.default;
in {
User = "shortcutd"; User = "shortcutd";
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${pkg}/bin/shortcutd"; ExecStart = getExe cfg.package;
PrivateTmp = true; PrivateTmp = true;
ProtectSystem = "strict"; ProtectSystem = "strict";
ProtectHome = true; ProtectHome = true;

View file

@ -11,17 +11,14 @@ in
src = sourceByRegex ../server ["Cargo.*" "(src)(/.*)?"]; src = sourceByRegex ../server ["Cargo.*" "(src)(/.*)?"];
postPatch = ''
cp ${../Cargo.lock} Cargo.lock
chmod 0755 Cargo.lock
'';
postInstall = '' postInstall = ''
mkdir -p $out/etc/dbus-1/system.d/ mkdir -p $out/etc/dbus-1/system.d/
cp ${../nixos-nl.icewind.shortcutd.conf} $out/etc/dbus-1/system.d/nl.icewind.shortcutd.conf cp ${../nixos-nl.icewind.shortcutd.conf} $out/etc/dbus-1/system.d/nl.icewind.shortcutd.conf
''; '';
cargoLock = { cargoLock = {
lockFile = ../Cargo.lock; lockFile = ../server/Cargo.lock;
}; };
meta.mainProgram = "shortcutd";
} }