Add devenv, add env vars to README, and delete chart
This commit is contained in:
parent
878339ad18
commit
ceb764934f
|
@ -5,7 +5,7 @@ tmp_dir = "tmp"
|
||||||
[build]
|
[build]
|
||||||
args_bin = ["-l", "0.0.0.0"]
|
args_bin = ["-l", "0.0.0.0"]
|
||||||
bin = "./out/ytdl-web"
|
bin = "./out/ytdl-web"
|
||||||
cmd = "task build"
|
cmd = "build"
|
||||||
delay = 1000
|
delay = 1000
|
||||||
exclude_dir = [
|
exclude_dir = [
|
||||||
"assets",
|
"assets",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
|
||||||
|
|
||||||
|
use devenv
|
|
@ -4,3 +4,13 @@
|
||||||
dist/
|
dist/
|
||||||
config.yaml
|
config.yaml
|
||||||
cookies.txt
|
cookies.txt
|
||||||
|
|
||||||
|
# Devenv
|
||||||
|
.devenv*
|
||||||
|
devenv.local.nix
|
||||||
|
|
||||||
|
# direnv
|
||||||
|
.direnv
|
||||||
|
|
||||||
|
# pre-commit
|
||||||
|
.pre-commit-config.yaml
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
project_name: ytdl-web
|
project_name: ytdl-web
|
||||||
env:
|
env:
|
||||||
- BASE_PKG=go.fifitido.net/ytdl-web
|
- BASE_PKG=go.fifitido.net/ytdl-web
|
||||||
|
@ -6,7 +7,7 @@ gitea_urls:
|
||||||
download: https://git.fifitido.net
|
download: https://git.fifitido.net
|
||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
- go mod tidy
|
- tidy
|
||||||
builds:
|
builds:
|
||||||
- id: ytdl-web_linux
|
- id: ytdl-web_linux
|
||||||
env:
|
env:
|
||||||
|
@ -85,7 +86,8 @@ docker_manifests:
|
||||||
- *armv6_image
|
- *armv6_image
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- format: tar.gz
|
||||||
# this name template makes the OS and Arch compatible with the results of uname.
|
# this name template makes the OS and Arch
|
||||||
|
# compatible with the results of uname.
|
||||||
name_template: >-
|
name_template: >-
|
||||||
{{ .ProjectName }}_
|
{{ .ProjectName }}_
|
||||||
{{- title .Os }}_
|
{{- title .Os }}_
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
rules:
|
|
||||||
quoted-strings:
|
|
||||||
required: only-when-needed
|
|
||||||
extra-allowed: ["{|}"]
|
|
||||||
empty-values:
|
|
||||||
forbid-in-block-mappings: true
|
|
||||||
forbid-in-flow-mappings: true
|
|
||||||
key-duplicates: {}
|
|
||||||
octal-values:
|
|
||||||
forbid-implicit-octal: true
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
version: 0.1
|
version: 0.1
|
||||||
cli:
|
cli:
|
||||||
version: 1.7.0
|
version: 1.7.0
|
||||||
|
@ -15,12 +16,6 @@ lint:
|
||||||
- hadolint@2.12.0
|
- hadolint@2.12.0
|
||||||
- prettier@2.8.7
|
- prettier@2.8.7
|
||||||
- taplo@0.7.0
|
- taplo@0.7.0
|
||||||
- yamllint@1.30.0
|
|
||||||
ignore:
|
|
||||||
- linters:
|
|
||||||
- yamllint
|
|
||||||
paths:
|
|
||||||
- charts
|
|
||||||
runtimes:
|
runtimes:
|
||||||
enabled:
|
enabled:
|
||||||
- go@1.19.5
|
- go@1.19.5
|
||||||
|
|
49
README.md
49
README.md
|
@ -15,6 +15,28 @@ Available options:
|
||||||
- -p, --port int port to listen on (default 8080)
|
- -p, --port int port to listen on (default 8080)
|
||||||
- -y, --ytdlp-path string the path to the yt-dlp binary, used when it is not in $PATH (default "yt-dlp")
|
- -y, --ytdlp-path string the path to the yt-dlp binary, used when it is not in $PATH (default "yt-dlp")
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Environment variables
|
||||||
|
|
||||||
|
You can configure the application using environment variables
|
||||||
|
|
||||||
|
| Variable Name | Description | Default Value | Accepted Values |
|
||||||
|
| ---------------------------------- | ----------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------------ |
|
||||||
|
| YTDL_ENV | The application environment | `Production` | `Development`, `Staging`, `Production` |
|
||||||
|
| YTDL_BINARYPATH | The path to the yt-dlp binary | `yt-dlp` | |
|
||||||
|
| YTDL_HTTP_PORT | The tcp port for the web server to listen on | `8080` | |
|
||||||
|
| YTDL_HTTP_LISTEN | The address for the web server to listen on | `127.0.0.1` | `0.0.0.0`, `127.0.0.1`, etc. |
|
||||||
|
| YTDL_HTTP_BASEPATH | The base path of the application, useful for reverse proxies | `/` | |
|
||||||
|
| YTDL_CACHE_TTL | How long to keep cached metadata | `1h` | `1h`, `30s`, `2m`, etc. |
|
||||||
|
| YTDL_CACHE_DIRPATH | The path to the directory of where to store the cache | `/tmp/ytdl-web` | |
|
||||||
|
| YTDL_COOKIES_ENABLED | Whether to use cookies when using yt-dlp | `true` | `true` or `false` |
|
||||||
|
| YTDL_COOKIES_FILEPATH | The path to the netscape format cookies file | `./cookies.txt` | |
|
||||||
|
| YTDL_COOKIES_FROMBROWSER_BROWSER | The name of the browser to load cookies from. (if specified, it disables YTDL_COOKIES_FILEPATH) | `` | `brave`, `chrome`, `chromium`, `edge`, `firefox`, `opera`, `safari`, `vivaldi` |
|
||||||
|
| YTDL_COOKIES_FROMBROWSER_KEYRING | The name of the keyring for decrypting cookies for the chromium browser on linux | `` | `basictext`, `gnomekeyring`, `kwallet` |
|
||||||
|
| YTDL_COOKIES_FROMBROWSER_PROFILE | The browser profile to load cookies from | `` | |
|
||||||
|
| YTDL_COOKIES_FROMBROWSER_CONTAINER | The container name (if firefox) top load the cookies from | `` | |
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
@ -40,42 +62,17 @@ task build
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
|
|
||||||
- [go v1.20](https://go.dev/doc/install)
|
- [devenv](https://devenv.sh/getting-started/)
|
||||||
- [goreleaser](https://goreleaser.com/install/)
|
|
||||||
- [task cli](https://taskfile.dev/installation/)
|
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
|
|
||||||
1. Ensure gitea access token is in `~/.config/goreleaser/gitea_token`
|
1. Ensure gitea access token is in `~/.config/goreleaser/gitea_token`
|
||||||
|
|
||||||
2. Run release task
|
2. Run release task
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
task release
|
task release
|
||||||
```
|
```
|
||||||
|
|
||||||
## Publishing Chart
|
|
||||||
|
|
||||||
Prerequisites:
|
|
||||||
|
|
||||||
- [helm cli](https://helm.sh/docs/intro/install/)
|
|
||||||
- [cm-push helm plugin](https://github.com/chartmuseum/helm-push/).
|
|
||||||
- [task cli](https://taskfile.dev/installation/)
|
|
||||||
|
|
||||||
Steps:
|
|
||||||
|
|
||||||
1. Add the helm repo
|
|
||||||
|
|
||||||
```sh
|
|
||||||
helm repo add --username {username} --password {password} gitea-apps https://git.fifitido.net/api/packages/apps/helm
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Publish the chart
|
|
||||||
|
|
||||||
```sh
|
|
||||||
task publish-chart
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
|
||||||
|
|
41
Taskfile.yml
41
Taskfile.yml
|
@ -1,41 +0,0 @@
|
||||||
version: "3"
|
|
||||||
|
|
||||||
vars:
|
|
||||||
OUT: ./out/ytdl-web
|
|
||||||
VERSION: 1.0.3
|
|
||||||
VERSION_PKG: go.fifitido.net/ytdl-web/version
|
|
||||||
BUILD:
|
|
||||||
sh: git rev-parse --short HEAD
|
|
||||||
DATE:
|
|
||||||
sh: date -Iseconds
|
|
||||||
DOCKER_IMAGE: git.fifitido.net/apps/ytdl-web
|
|
||||||
DOCKER_IMAGE_TAG: latest
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
deps: go mod download
|
|
||||||
tidy: go mod tidy
|
|
||||||
check: goreleaser check
|
|
||||||
build: >
|
|
||||||
go build -ldflags="
|
|
||||||
-X {{.VERSION_PKG}}.Version={{.VERSION}}
|
|
||||||
-X {{.VERSION_PKG}}.Build={{.BUILD}}
|
|
||||||
-X {{.VERSION_PKG}}.BuildDate={{.DATE}}
|
|
||||||
-X {{.VERSION_PKG}}.BuiltBy=taskfile
|
|
||||||
"
|
|
||||||
-o {{.OUT}} .
|
|
||||||
dev: air
|
|
||||||
clean:
|
|
||||||
cmds:
|
|
||||||
- rm -rf ./dist/ ./out/ ./tmp/
|
|
||||||
- go clean
|
|
||||||
release:
|
|
||||||
deps:
|
|
||||||
- clean
|
|
||||||
cmds:
|
|
||||||
- goreleaser release
|
|
||||||
chart:deps:
|
|
||||||
cmds:
|
|
||||||
- helm repo add bjw-s https://bjw-s.github.io/helm-charts
|
|
||||||
- helm dependency build
|
|
||||||
dir: charts/ytdl-web
|
|
||||||
chart:publish: helm cm-push charts/ytdl-web/ gitea-apps
|
|
|
@ -1,23 +0,0 @@
|
||||||
# Patterns to ignore when building packages.
|
|
||||||
# This supports shell glob matching, relative path matching, and
|
|
||||||
# negation (prefixed with !). Only one pattern per line.
|
|
||||||
.DS_Store
|
|
||||||
# Common VCS dirs
|
|
||||||
.git/
|
|
||||||
.gitignore
|
|
||||||
.bzr/
|
|
||||||
.bzrignore
|
|
||||||
.hg/
|
|
||||||
.hgignore
|
|
||||||
.svn/
|
|
||||||
# Common backup files
|
|
||||||
*.swp
|
|
||||||
*.bak
|
|
||||||
*.tmp
|
|
||||||
*.orig
|
|
||||||
*~
|
|
||||||
# Various IDEs
|
|
||||||
.project
|
|
||||||
.idea/
|
|
||||||
*.tmproj
|
|
||||||
.vscode/
|
|
|
@ -1,6 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- name: common
|
|
||||||
repository: https://bjw-s.github.io/helm-charts
|
|
||||||
version: 1.4.0
|
|
||||||
digest: sha256:4b75202a3971677362052bcee21a023ea42a0c18991800ae62a8890d4655b699
|
|
||||||
generated: "2023-05-23T21:17:36.487449972-04:00"
|
|
|
@ -1,14 +0,0 @@
|
||||||
apiVersion: v2
|
|
||||||
description: A web-based frontend for yt-dlp
|
|
||||||
name: ytdl-web
|
|
||||||
version: 1.0.8
|
|
||||||
kubeVersion: ">=1.22.0-0"
|
|
||||||
type: application
|
|
||||||
appVersion: 1.0.7
|
|
||||||
maintainers:
|
|
||||||
- name: fifitido
|
|
||||||
email: me@fifitido.net
|
|
||||||
dependencies:
|
|
||||||
- name: common
|
|
||||||
repository: https://bjw-s.github.io/helm-charts
|
|
||||||
version: 1.4.0
|
|
|
@ -1,9 +0,0 @@
|
||||||
{{- define "custom.custom.configuration.header" -}}
|
|
||||||
## Custom configuration
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- define "custom.custom.configuration" -}}
|
|
||||||
{{ template "custom.custom.configuration.header" . }}
|
|
||||||
|
|
||||||
N/A
|
|
||||||
{{- end -}}
|
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
||||||
---
|
|
||||||
{{- include "bjw-s.common.loader.init" . }}
|
|
||||||
|
|
||||||
{{- define "ytdlp-web.hardcodedValues" -}}
|
|
||||||
# Set the nameOverride based on the release name if no override has been set
|
|
||||||
{{ if not .Values.global.nameOverride }}
|
|
||||||
global:
|
|
||||||
nameOverride: "{{ .Release.Name }}"
|
|
||||||
{{ end }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- $_ := mergeOverwrite .Values (include "ytdlp-web.hardcodedValues" . | fromYaml) -}}
|
|
||||||
|
|
||||||
{{/* Render the templates */}}
|
|
||||||
{{ include "bjw-s.common.loader.generate" . }}
|
|
|
@ -1,39 +0,0 @@
|
||||||
image:
|
|
||||||
repository: git.fifitido.net/apps/ytdl-web
|
|
||||||
pullPolicy: IfNotPresent
|
|
||||||
tag: 1.0.7
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
type: Recreate
|
|
||||||
|
|
||||||
env:
|
|
||||||
# YTDL_ENV: Production
|
|
||||||
# YTDL_BINARY_PATH: yt-dlp
|
|
||||||
YTDL_HTTP_LISTEN: 0.0.0.0
|
|
||||||
YTDL_HTTP_PORT: 8080
|
|
||||||
# YTDL_HTTP_BASEPATH: /example
|
|
||||||
# YTDL_HTTP_TRUSTED_PROXIES: 127.0.0.1 10.0.0.0/8
|
|
||||||
# YTDL_CACHE_TTL: 1h
|
|
||||||
# YTDL_CACHE_DIRPATH: /tmp/ytdl-web
|
|
||||||
YTDL_COOKIES_ENABLED: true
|
|
||||||
YTDL_COOKIES_FILEPATH: /etc/ytdl-web/cookies.txt
|
|
||||||
|
|
||||||
service:
|
|
||||||
main:
|
|
||||||
ports:
|
|
||||||
http:
|
|
||||||
port: 8080
|
|
||||||
|
|
||||||
persistence:
|
|
||||||
config:
|
|
||||||
enabled: false
|
|
||||||
mountPath: /etc/ytdl-web
|
|
||||||
|
|
||||||
ingress:
|
|
||||||
main:
|
|
||||||
enabled: false
|
|
||||||
hosts:
|
|
||||||
- host: ytdl-web.local
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
|
@ -54,12 +54,13 @@ type ConfigCookiesFromBrowser struct {
|
||||||
|
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
|
Env: "Production",
|
||||||
|
BinaryPath: "yt-dlp",
|
||||||
HTTP: ConfigHTTP{
|
HTTP: ConfigHTTP{
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
Listen: "127.0.0.1",
|
Listen: "127.0.0.1",
|
||||||
BasePath: "/",
|
BasePath: "/",
|
||||||
},
|
},
|
||||||
BinaryPath: "yt-dlp",
|
|
||||||
Cache: ConfigCache{
|
Cache: ConfigCache{
|
||||||
TTL: time.Hour,
|
TTL: time.Hour,
|
||||||
DirPath: "/tmp/ytdl-web",
|
DirPath: "/tmp/ytdl-web",
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"devenv": {
|
||||||
|
"locked": {
|
||||||
|
"dir": "src/modules",
|
||||||
|
"lastModified": 1689175844,
|
||||||
|
"narHash": "sha256-+ZAcAnogqNXz5P2/NiZonmgUiv+vCC7/swiSepyTulc=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "devenv",
|
||||||
|
"rev": "db59403d5bdad71dce137705ed7cb926681e5f95",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"dir": "src/modules",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "devenv",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673956053,
|
||||||
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1685518550,
|
||||||
|
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1660459072,
|
||||||
|
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1689168768,
|
||||||
|
"narHash": "sha256-mCw3LPg2jJkapvJpkd1IZ8k0IJlSG2ECvz3vcOAu+Uo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "6fd9edc94426a3c050ad589c8f033b5ca55454c7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1685801374,
|
||||||
|
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-23.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1688596063,
|
||||||
|
"narHash": "sha256-9t7RxBiKWHygsqXtiNATTJt4lim/oSYZV3RG8OjDDng=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "c8d18ba345730019c3faf412c96a045ade171895",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"devenv": "devenv",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# https://devenv.sh/basics/
|
||||||
|
env.NAME = "ytdl-web";
|
||||||
|
env.BINARY_OUT = "./out/ytdl-web";
|
||||||
|
env.VERSION = "1.0.3";
|
||||||
|
env.VERSION_PKG = "go.fifitido.net/ytdl-web/version";
|
||||||
|
|
||||||
|
env.YTDL_ENV = "Development";
|
||||||
|
|
||||||
|
|
||||||
|
# https://devenv.sh/packages/
|
||||||
|
packages = with pkgs; [
|
||||||
|
git
|
||||||
|
air
|
||||||
|
goreleaser
|
||||||
|
docker
|
||||||
|
docker-compose
|
||||||
|
trunk-io
|
||||||
|
yt-dlp
|
||||||
|
];
|
||||||
|
|
||||||
|
# https://devenv.sh/scripts/
|
||||||
|
scripts.deps.exec = "go mod download";
|
||||||
|
scripts.tidy.exec = "go mod tidy";
|
||||||
|
scripts.check.exec = "goreleaser check";
|
||||||
|
scripts.build.exec = ''
|
||||||
|
go build -ldflags="
|
||||||
|
-X $VERSION_PKG.Version=$VERSION
|
||||||
|
-X $VERSION_PKG.Build=$(git rev-parse --short HEAD)
|
||||||
|
-X $VERSION_PKG.BuildDate=$(date -Iseconds)
|
||||||
|
-X $VERSION_PKG.BuiltBy=taskfile
|
||||||
|
" -o $BINARY_OUT .
|
||||||
|
'';
|
||||||
|
scripts.clean.exec = ''
|
||||||
|
rm -rf ./dist/ ./out/ ./tmp/
|
||||||
|
go clean
|
||||||
|
'';
|
||||||
|
scripts.release.exec = ''
|
||||||
|
clean
|
||||||
|
goreleaser release
|
||||||
|
'';
|
||||||
|
scripts.lint.exec = "trunk check";
|
||||||
|
scripts.fmt.exec = "trunk fmt";
|
||||||
|
|
||||||
|
enterShell = ''
|
||||||
|
echo "Welcome to the $NAME development environment."
|
||||||
|
echo -n "Golang version: $(go version | cut -d ' ' -f 3), "
|
||||||
|
echo -n "Goreleaser version: $(goreleaser --version | tail -n 9 | head -n 1 | cut -c 16-), "
|
||||||
|
echo -n "yt-dlp version: $(yt-dlp --version), "
|
||||||
|
echo "Trunk version: $(trunk --version)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# https://devenv.sh/languages/
|
||||||
|
languages.go.enable = true;
|
||||||
|
|
||||||
|
# https://devenv.sh/pre-commit-hooks/
|
||||||
|
pre-commit.hooks.staticcheck.enable = true;
|
||||||
|
pre-commit.hooks.hadolint.enable = true;
|
||||||
|
pre-commit.hooks.yamllint.enable = true;
|
||||||
|
|
||||||
|
# https://devenv.sh/processes/
|
||||||
|
processes.web.exec = "air";
|
||||||
|
|
||||||
|
# See full reference at https://devenv.sh/reference/options/
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
allowUnfree: true
|
||||||
|
inputs:
|
||||||
|
nixpkgs:
|
||||||
|
url: github:NixOS/nixpkgs/nixpkgs-unstable
|
Loading…
Reference in New Issue