diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d6c2c5a --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1661353537, + "narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0e304ff0d9db453a4b230e9386418fd974d5804a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fd61e4b --- /dev/null +++ b/flake.nix @@ -0,0 +1,23 @@ +{ + description = "Dibbler samspleisebod"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + packages = rec { + dibbler = pkgs.callPackage ./nix/dibbler.nix { }; + # dibblerCross = pkgs.pkgsCross.aarch64-multiplatform.callPackage ./nix/dibbler.nix { }; + default = dibbler; + }; + apps = rec { + dibbler = flake-utils.lib.mkApp { + drv = self.packages.${system}.dibbler; + }; + default = dibbler; + }; + } + ); +} diff --git a/nix/dibbler.nix b/nix/dibbler.nix index 80c3282..12e7c16 100644 --- a/nix/dibbler.nix +++ b/nix/dibbler.nix @@ -1,50 +1,7 @@ -{ lib, python3Packages, fetchFromGitHub }: +{ lib, python3Packages, fetchFromGitHub +, conf ? ../conf.py +}: -let - packbits = python3Packages.buildPythonPackage rec { - pname = "packbits"; - version = "0.6"; - - src = python3Packages.fetchPypi { - inherit pname version; - sha256 = "0d7hzxxhyv6x160dnfjrdpyaz0239300cpl3za6aq12fnc5kfsxw"; - }; - }; - brother-ql = python3Packages.buildPythonPackage rec { - pname = "brother-ql"; - version = "0.9.4"; - - src = python3Packages.fetchPypi { - pname = "brother_ql"; - inherit version; - sha256 = "0q469rhkrjyhhplvs7j2hdsbnvpp0404fzrr0k1cj4ph76h5fp0z"; - }; - - propagatedBuildInputs = with python3Packages; [ - click - future - packbits - pillow - pyusb - attrs - ]; - }; - python-barcode = python3Packages.buildPythonPackage rec { - pname = "python-barcode"; - version = "0.13.1"; - - src = python3Packages.fetchPypi { - inherit pname version; - sha256 = "0lmj4cp9g38hyb15yfyndarw5xhqzyac48g5gdvnkng94jma9yzs"; - }; - - propagatedBuildInputs = with python3Packages; [ pillow setuptools_scm ]; - - doCheck = false; - - #checkInputs = with python3Packages; [ tox ]; - }; -in python3Packages.buildPythonApplication { pname = "dibbler"; version = "unstable-2021-09-07"; @@ -70,8 +27,10 @@ python3Packages.buildPythonApplication { libdir=$out/lib/${python3Packages.python.libPrefix}/site-packages mv * $libdir + + cp ${conf} $libdir/ - mv $libdir/text_based.py $out/bin/text_based.py + mv $libdir/text_based.py $out/bin/dibbler runHook postInstall '';