1
0
Fork 0
mirror of https://codeberg.org/icewind/shelve.git synced 2026-06-03 12:04:09 +02:00
This commit is contained in:
Robin Appelman 2025-10-05 13:38:48 +02:00
commit 2370cab1f2
11 changed files with 1189 additions and 10 deletions

21
nix/cli.nix Normal file
View file

@ -0,0 +1,21 @@
{
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../cli ["Cargo.*" "(src|templates)(/.*)?"];
cargoPackage = (fromTOML (readFile ../cli/Cargo.toml)).package;
in
rustPlatform.buildRustPackage rec {
pname = cargoPackage.name;
inherit (cargoPackage) version;
inherit src;
meta.mainProgram = "shelve";
cargoLock = {
lockFile = ../cli/Cargo.lock;
};
}

47
nix/hm-module.nix Normal file
View file

@ -0,0 +1,47 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.shelve;
format = pkgs.formats.toml {};
configFile = format.generate "client.toml" {
upload = {
inherit (cfg) host expire;
token_file = cfg.tokenFile;
};
};
in {
options.programs.shelve = {
enable = mkEnableOption "shelve";
host = mkOption {
type = types.str;
description = "Shelve server address";
};
expire = mkOption {
type = types.str;
default = "3 days";
description = "Default upload expiration";
};
tokenFile = mkOption {
type = types.str;
description = "File containing the upload token";
};
package = mkOption {
type = types.package;
defaultText = literalExpression "pkgs.shelve-cli";
description = "package to use";
};
};
config = mkIf cfg.enable {
xdg.configFile."shelve/client.toml".source = configFile;
home.packages = [cfg.package];
};
}

View file

@ -1,3 +1,4 @@
final: prev: {
shelve = final.callPackage ./package.nix {};
shelve-cli = final.callPackage ./cli.nix {};
}

View file

@ -1,5 +1,4 @@
{
stdenv,
rustPlatform,
lib,
}: let