diff --git a/Cargo.lock b/Cargo.lock index 852b126..76d4169 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler" diff --git a/flake.nix b/flake.nix index 045c4e9..2f60c79 100644 --- a/flake.nix +++ b/flake.nix @@ -3,22 +3,18 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; }; - outputs = - { - self, - nixpkgs, - }@inputs: + outputs = { self, nixpkgs }@inputs: let supportedSystems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - # I improved how you call in packages - pkgs = forAllSystems ( - system: + #v I improved how you call in packages + pkgs = forAllSystems (system: import nixpkgs { inherit system; #v this can be adjusted to read args passed without impure later - config = { - allowUnfree = true; + config = { allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ + "unrar" + ]; }; } ); @@ -31,8 +27,8 @@ default = pkgs.${system}.callPackage ./nix/devshell.nix { }; }); nixConfig = { - # I would have like this to work but it requires the nix user to set an option. + #v I would have like this to work but it requires the nix user to set an option. allowUnfree = true; }; }; -} +} \ No newline at end of file diff --git a/nix/default.nix b/nix/default.nix index 2cc0815..72061d5 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,23 +1,11 @@ -{ - unrar, - xz, - pkg-config, - rustPlatform, - lib, -}: +{ pkgs ? import { }, lib }: -rustPlatform.buildRustPackage { +pkgs.rustPlatform.buildRustPackage rec { pname = "sk_extract"; version = "0.1.0"; cargoLock.lockFile = ../Cargo.lock; - src = lib.cleanSource ../.; - buildInputs = [ - xz - unrar - ]; - nativeBuildInputs = [ - xz - pkg-config - ]; - doCheck = false; -} + src = pkgs.lib.cleanSource ../.; + buildInputs = [ pkgs.xz pkgs.unrar ]; + nativeBuildInputs = [ pkgs.xz pkgs.pkg-config ]; +# doCheck = false; +} \ No newline at end of file diff --git a/src/lib/extractors.rs b/src/lib/extractors.rs index bd64e86..cb7cd09 100644 --- a/src/lib/extractors.rs +++ b/src/lib/extractors.rs @@ -396,7 +396,7 @@ pub fn extract_deb(input_path: &Path,) -> Result<(),io::Error>{ let mut entry = entry_result.unwrap(); // Create a new file with the same name as the archive entry: let mut file = File::create( - std::str::from_utf8(entry.header().identifier()).unwrap(), + str::from_utf8(entry.header().identifier()).unwrap(), ).unwrap(); // The Entry object also acts as an io::Read, so we can easily copy the // contents of the archive entry into the file: