mirror of
https://github.com/apricote/hcloud-upload-image.git
synced 2026-01-13 13:21:01 +00:00
Merge 40c06556a1 into b7a29b2bee
This commit is contained in:
commit
dfb20d92f6
6 changed files with 191 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
dist/
|
dist/
|
||||||
completions/
|
completions/
|
||||||
|
result
|
||||||
|
|
|
||||||
57
README.md
57
README.md
|
|
@ -58,6 +58,63 @@ If you already have a recent Go toolchain installed, you can build & install the
|
||||||
go install github.com/apricote/hcloud-upload-image@latest
|
go install github.com/apricote/hcloud-upload-image@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Nix/NixOS
|
||||||
|
|
||||||
|
To run directly without installing (assumes flakes are enabled):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Run the application directly
|
||||||
|
nix run github:apricote/hcloud-upload-image
|
||||||
|
|
||||||
|
# Start a shell with `hcloud-upload-image` in $PATH
|
||||||
|
nix shell github:apricote/hcloud-upload-image
|
||||||
|
```
|
||||||
|
|
||||||
|
To install on your system (assumes flakes are enabled):
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# flake.nix
|
||||||
|
{
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
inputs.hcloud-upload-image.url = "github:apricote/hcloud-upload-image";
|
||||||
|
inputs.hcloud-upload-image.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, hcloud-upload-image }: {
|
||||||
|
nixosConfigurations.my-system = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
hcloud-upload-image.packages.x86_64-linux.default
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
To install on your system (using a non-flake version manager):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Using npins
|
||||||
|
npins add github apricote hcloud-upload-image
|
||||||
|
|
||||||
|
# Using niv
|
||||||
|
niv add apricote/hcloud-upload-image
|
||||||
|
```
|
||||||
|
|
||||||
|
Then in your Nix expressions:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
sources = import ./npins; # For npins
|
||||||
|
# sources = import ./nix/sources.nix; # For niv
|
||||||
|
in
|
||||||
|
(pkgs.callPackage sources.hcloud-upload-image {})
|
||||||
|
```
|
||||||
|
|
||||||
#### Docker
|
#### Docker
|
||||||
|
|
||||||
There is a docker image published at `ghcr.io/apricote/hcloud-upload-image`.
|
There is a docker image published at `ghcr.io/apricote/hcloud-upload-image`.
|
||||||
|
|
|
||||||
29
default.nix
Normal file
29
default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
buildGoModule,
|
||||||
|
}:
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "hcloud-upload-image";
|
||||||
|
version =
|
||||||
|
builtins.head (builtins.match ".*version = \"([0-9.]+)\".*"
|
||||||
|
(builtins.readFile ./internal/version/version.go));
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
vendorHash = "sha256-HPskDotHX5GnbuL2KkoqRiY4G1MxOvwJBMBPDCIzHvE=";
|
||||||
|
env.GOWORK = "off";
|
||||||
|
subPackages = ["."];
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
"-s"
|
||||||
|
"-w"
|
||||||
|
"-X main.version=${version}"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Quickly upload any raw disk images into your Hetzner Cloud projects";
|
||||||
|
homepage = "https://github.com/apricote/hcloud-upload-image";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
maintainers = [];
|
||||||
|
mainProgram = "hcloud-upload-image";
|
||||||
|
};
|
||||||
|
}
|
||||||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751413152,
|
||||||
|
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1752480373,
|
||||||
|
"narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751159883,
|
||||||
|
"narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
34
flake.nix
Normal file
34
flake.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
description = "hcloud-upload-image - Quickly upload any raw disk images into your Hetzner Cloud projects";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs @ {flake-parts, ...}:
|
||||||
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
perSystem = {pkgs, ...}: let
|
||||||
|
pkg = pkgs.callPackage ./default.nix {};
|
||||||
|
app = {
|
||||||
|
type = "app";
|
||||||
|
program = "${pkg}/bin/hcloud-upload-image";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
packages.default = pkg;
|
||||||
|
packages.hcloud-upload-image = pkg;
|
||||||
|
|
||||||
|
apps.default = app;
|
||||||
|
apps.hcloud-upload-image = app;
|
||||||
|
|
||||||
|
devShells.default = pkgs.callPackage ./shell.nix {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
9
shell.nix
Normal file
9
shell.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{pkgs ? import <nixpkgs> {}}:
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
go
|
||||||
|
gopls
|
||||||
|
gotools
|
||||||
|
go-tools
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue