mirror of
https://github.com/derfenix/photocatalog.git
synced 2026-03-11 21:35:34 +03:00
Update nix flake
This commit is contained in:
82
flake.nix
82
flake.nix
@@ -23,18 +23,86 @@
|
|||||||
src = ./.;
|
src = ./.;
|
||||||
vendorHash = "sha256-dj11SRRoB8ZbkcQs75HPI0DpW4c5jzY0N8MD1wKpw+4=";
|
vendorHash = "sha256-dj11SRRoB8ZbkcQs75HPI0DpW4c5jzY0N8MD1wKpw+4=";
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
nixosModules.photocatalog = { config, lib, pkgs, ... }: {
|
nixosModules.photocatalog = { config, lib, pkgs, ... }: {
|
||||||
options.photocatalog = {
|
options.photocatalog = {
|
||||||
enable = lib.mkEnableOption "Enable photocatalog";
|
enable = lib.mkEnableOption "Enable photocatalog";
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.photocatalog.enable {
|
syncs = mkOption {
|
||||||
environment.systemPackages = [ self.packages.${pkgs.system}.photocatalog ];
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Organization paths with its own params.
|
||||||
|
'';
|
||||||
|
example = {
|
||||||
|
|
||||||
|
};
|
||||||
|
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||||
|
freeformType = settingsFormat.type;
|
||||||
|
options = {
|
||||||
|
source = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = name;
|
||||||
|
description = ''
|
||||||
|
Source folder path.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
target = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Target folder path.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
overwrite = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Overwrite files, existing in target.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
watch = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Watch for new files in source path.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
skipFullSync = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Do not make full sync.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.photocatalog.enable {
|
||||||
|
environment.systemPackages = [ self.packages.${pkgs.system}.photocatalog ];
|
||||||
|
systemd.services = lib.genAttrs config.photocatalog (sync:
|
||||||
|
{
|
||||||
|
${sync.name} = {
|
||||||
|
name = "photocatalog_${sync.name}";
|
||||||
|
after = [ "local-fs.target" ];
|
||||||
|
path = [
|
||||||
|
self.packages.${pkgs.system}.photocatalog
|
||||||
|
];
|
||||||
|
preStart = lib.mkIf (!sync.skipFullSync) [
|
||||||
|
"mkdir -p ${sync.target}"
|
||||||
|
"photocatalog -source ${sync.source} -target ${sync.target}"
|
||||||
|
];
|
||||||
|
script = [
|
||||||
|
"photocatalog -source ${sync.source} -target ${sync.target} -skip-full-sync -watch"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
|
|||||||
Reference in New Issue
Block a user