Skip to content

Linux: Create Nix flake #10

Description

@tadg-paul

Overview

Create a Nix flake for NixOS and Nix package manager users.

Parent issue: #2

Requirements

  • Create flake.nix at project root
  • Define package with all dependencies
  • Support both CLI and GUI
  • Include devShell for development
  • Test on NixOS and nix-darwin

Flake Template

{
  description = "Convert documents to audiobooks using Piper TTS";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        python = pkgs.python312;
      in {
        packages.default = python.pkgs.buildPythonApplication {
          pname = "make-audiobook";
          version = "2.0.0";
          src = ./.;
          
          format = "other";
          
          propagatedBuildInputs = with pkgs; [
            ffmpeg
            pandoc
            fzf
            fd
            piper-tts
          ] ++ (with python.pkgs; [
            pyside6
            requests
          ]);
          
          installPhase = ''
            mkdir -p $out/bin
            cp make-audiobook $out/bin/
            cp make-audiobook-gui $out/bin/
            cp -r gui $out/lib/python${python.version}/site-packages/
          '';
        };
        
        devShells.default = pkgs.mkShell {
          packages = with pkgs; [
            python
            python.pkgs.pyside6
            python.pkgs.pytest
            python.pkgs.pytest-qt
            ffmpeg
            pandoc
          ];
        };
      });
}

Usage

# Run without installing
nix run github:tigger04/make-audiobook

# Install to profile
nix profile install github:tigger04/make-audiobook

# Development shell
nix develop github:tigger04/make-audiobook

Acceptance Criteria

  • nix run launches GUI
  • nix build produces working package
  • Works on NixOS 24.05+
  • Works with nix-darwin on macOS
  • All dependencies resolved by Nix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions