add flake.nix for devshell

This commit is contained in:
Julian Mutter 2023-03-10 18:02:40 +01:00
parent 8323bd059c
commit 02c12576f7
6 changed files with 147 additions and 4 deletions

107
flake.lock generated Normal file
View File

@ -0,0 +1,107 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 1654084003,
"narHash": "sha256-j/XrVVistvM+Ua+0tNFvO5z83isL+LBgmBi9XppxuKA=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "7e14360bde07dcae32e5e24f366c83272f52923f",
"type": "github"
},
"original": {
"id": "mach-nix",
"ref": "3.5.0",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1643805626,
"narHash": "sha256-AXLDVMG+UaAGsGSpOtQHPIKB+IZ0KSd9WS77aanGzgc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "554d2d8aa25b6e583575459c297ec23750adb6cb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1678298120,
"narHash": "sha256-iaV5xqgn29xy765Js3EoZePQyZIlLZA3pTYtTnKkejg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1e383aada51b416c6c27d4884d2e258df201bc11",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"pypi-deps-db": {
"flake": false,
"locked": {
"lastModified": 1643877077,
"narHash": "sha256-jv8pIvRFTP919GybOxXE5TfOkrjTbdo9QiCO1TD3ZaY=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "da53397f0b782b0b18deb72ef8e0fb5aa7c98aa3",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

36
flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "Dvd ripper and transcoder";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.mach-nix.url = "github:mach-nix/3.5.0";
outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# Manage dependencies via requirements.txt file
# !! Did not work for playsound, since gst-python no python package??
# (mach-nix.lib.${system}.mkPython {
# requirements = builtins.readFile ./requirements.txt;
# })
# Python dependencies
(python3.withPackages
(p: with p; [ gst-python pygobject3 playsound python-dotenv ]))
# Playsound dependencies
gobject-introspection
gst_all_1.gst-devtools
# Script dependencies
dvdbackup
handbrake
rsync
libnotify
];
};
});
}

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
# playsound
# pygobject # dependency of playsound
python-dotenv

View File

@ -1,2 +0,0 @@
playsound==1.3.0
python-dotenv==1.0

View File

@ -43,9 +43,9 @@ def main():
success = rip_to_tmp_dir(args)
program_execution_time_str = get_program_execution_time_str(program_start_time)
if success:
mv_ripped_from_tmp_to_ripped_dir(args)
write_to_logfile(args, "Success")
notify_ripping_success(args, program_execution_time_str)
mv_ripped_from_tmp_to_ripped_dir(args)
else:
write_to_logfile(args, "FAILURE")
notify_ripping_error(args, program_execution_time_str)

View File

@ -1 +0,0 @@
python-dotenv==1.0