add nix flake and stuff

This commit is contained in:
ihaveahax 2024-02-10 21:23:36 -06:00
parent d492069e27
commit c96f0a29ae
No known key found for this signature in database
GPG Key ID: 90725113CA578EAA
7 changed files with 133 additions and 0 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ __pycache__/
*.pyd *.pyd
# dll and dylib are not here, since libcrypto needs to be included # dll and dylib are not here, since libcrypto needs to be included
Thumbs.db Thumbs.db
result
result-*

6
default.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs ? import <nixpkgs> {} }:
rec {
haccrypto = pkgs.python3Packages.callPackage ./haccrypto.nix {};
ninfs = pkgs.python3Packages.callPackage ./ninfs.nix { haccrypto = haccrypto; };
}

61
flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1707451808,
"narHash": "sha256-UwDBUNHNRsYKFJzyTMVMTF5qS4xeJlWoeyJf+6vvamU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "442d407992384ed9c0e6d352de75b69079904e4e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

21
flake.nix Normal file
View File

@ -0,0 +1,21 @@
{
description = "ninfs";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs@{ self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in {
packages = rec {
haccrypto = pkgs.python3Packages.callPackage ./haccrypto.nix {};
ninfs = pkgs.python3Packages.callPackage ./ninfs.nix { haccrypto = haccrypto; };
default = ninfs;
};
}
);
}

18
haccrypto.nix Normal file
View File

@ -0,0 +1,18 @@
{ lib, buildPythonPackage, pythonOlder, fetchPypi }:
buildPythonPackage rec {
pname = "haccrypto";
version = "0.1.3";
format = "setuptools";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
hash = "sha256-PHkAxy0lq7SsdQlKSq2929Td8UDFVMleCYnq2t1xg44=";
};
pythonImportsCheck = [
"haccrypto"
];
}

20
ninfs.nix Normal file
View File

@ -0,0 +1,20 @@
{ lib, callPackage, buildPythonApplication, fetchPypi, pyctr, pycryptodomex, pypng, tkinter, setuptools, fusepy, haccrypto, pip }:
buildPythonApplication rec {
pname = "ninfs";
version = "2.0a11";
format = "setuptools";
srcs = builtins.path { path = ./.; name = "ninfs"; };
propagatedBuildInputs = [
pyctr
pycryptodomex
pypng
tkinter
setuptools # missing from requirements.txt
fusepy # despite ninfs including its own copy of fuse.py, it can't find it for some reason
pip
haccrypto
];
}

View File

@ -7,6 +7,11 @@
from os.path import dirname, realpath from os.path import dirname, realpath
from sys import argv, exit, path from sys import argv, exit, path
if 'nix_run_setup' in argv:
# I don't understand why this gets called with nix build!
print('nix build is calling me!')
exit(0)
# path fun times # path fun times
path.insert(0, dirname(realpath(__file__))) path.insert(0, dirname(realpath(__file__)))