Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Nix-Test

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # write required for action-gh-release
id-token: write
packages: write # write required for pushing docker
steps:
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Checkout
uses: actions/checkout@v4
- name: Run `nix fmt`
run: nix fmt -- --check *
- name: Run `flake checks`
run: nix flake check -L
- name: Create AppImage
run: nix build .#audible-cli-AppImage
- name: Test appimage
run: ./result decrypt --help
- name: Rename AppImage
if: startsWith(github.ref, 'refs/tags/')
run: cp ./result audible-cli.AppImage
- name: Release-AppImage
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: audible-cli.AppImage
- name: Release Docker
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
nix run .#docker-pusher
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/src/audible_cli/*.bak
library.csv

result
*.AppImage

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
175 changes: 175 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
description = "Nix related tooling for a command line interface for audible. With the CLI you can download your Audible books, cover, chapter files & conver them.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/x86_64-linux";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
nix-filter.url = "github:numtide/nix-filter";
nix-appimage = {
url = "github:ralismark/nix-appimage";
};
};
outputs = {
self,
nixpkgs,
systems,
nix-appimage,
flake-compat,
nix-filter,
} @ inputs: let
eachSystem = nixpkgs.lib.genAttrs (import systems);
pkgsFor = eachSystem (system: (nixpkgs.legacyPackages.${system}.extend self.overlays.default));
in {
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
checks = eachSystem (system: self.packages.${system});
overlays = import ./nix/overlays.nix {
inherit inputs;
lib = nixpkgs.lib; # TODO: Understand this construct
};

packages = eachSystem (system: let
pkgs = pkgsFor.${system};
in rec {
audible-cli = pkgs.audible-cli;
audible-cli-full = pkgs.audible-cli-full;
isbntools = pkgs.python3Packages.isbntools;
audible-cli-AppImage = inputs.nix-appimage.mkappimage.${system} {
drv = audible-cli-full;
name = audible-cli-full.name;
entrypoint = pkgs.lib.getExe audible-cli-full;
};
audible-cli-docker = pkgs.dockerTools.buildLayeredImage {
name = audible-cli-full.pname; # `.name` has illegal docker tag format
tag = "latest";
contents = [audible-cli-full];
config = {
Entrypoint = [
"${pkgs.lib.getExe audible-cli-full}"
];
};
};
default = audible-cli-full;
docker-pusher = pkgs.writeShellApplication {
name = "docker-pusher";
runtimeInputs = [pkgs.skopeo];
text = ''
nix build .#audible-cli-docker
DOCKER_REPOSITORY="docker://ghcr.io/mkb79/audible-cli"
skopeo --insecure-policy copy "docker-archive:result" "$DOCKER_REPOSITORY"
'';
};
});
};
}
Loading