mirror of
https://codeberg.org/icewind/shelve.git
synced 2026-06-03 12:04:09 +02:00
cli
This commit is contained in:
parent
d3d50bfb2c
commit
2370cab1f2
11 changed files with 1189 additions and 10 deletions
21
nix/cli.nix
Normal file
21
nix/cli.nix
Normal 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
47
nix/hm-module.nix
Normal 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];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
final: prev: {
|
||||
shelve = final.callPackage ./package.nix {};
|
||||
shelve-cli = final.callPackage ./cli.nix {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
lib,
|
||||
}: let
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue