Restructure everything
This commit is contained in:
parent
81ca8af870
commit
a8a26921b4
19 changed files with 227 additions and 67 deletions
3
python/nixpkgs/.envrc
Normal file
3
python/nixpkgs/.envrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
use flake ..#python
|
||||
4
python/nixpkgs/bin/soe
Executable file
4
python/nixpkgs/bin/soe
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import soe
|
||||
soe.main()
|
||||
43
python/nixpkgs/flake.lock
generated
Normal file
43
python/nixpkgs/flake.lock
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722141560,
|
||||
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
||||
17
python/nixpkgs/flake.nix
Normal file
17
python/nixpkgs/flake.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, systems, ... }:
|
||||
let eachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
in {
|
||||
packages = eachSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
soe = pkgs.callPackage ./package.nix {};
|
||||
default = self.packages.${system}.soe;
|
||||
});
|
||||
};
|
||||
}
|
||||
9
python/nixpkgs/package.nix
Normal file
9
python/nixpkgs/package.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ python3 }:
|
||||
|
||||
python3.pkgs.buildPythonApplication {
|
||||
pname = "soe";
|
||||
version = "1.0";
|
||||
src = ./.;
|
||||
|
||||
doCheck = false;
|
||||
}
|
||||
7
python/nixpkgs/setup.py
Normal file
7
python/nixpkgs/setup.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="soe",
|
||||
version="1.0.0",
|
||||
scripts=["bin/soe"]
|
||||
)
|
||||
3
python/nixpkgs/shell.nix
Normal file
3
python/nixpkgs/shell.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{ python3 }:
|
||||
|
||||
python3.buildEnv.env
|
||||
1
python/nixpkgs/soe/__init__.py
Normal file
1
python/nixpkgs/soe/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from .main import *
|
||||
26
python/nixpkgs/soe/main.py
Normal file
26
python/nixpkgs/soe/main.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
|
||||
def sieve_of_eratosthenes(n):
|
||||
nums = list(range(2, n))
|
||||
while nums:
|
||||
prime = nums[0]
|
||||
nums = [i for i in nums if i % prime]
|
||||
yield prime
|
||||
|
||||
def main():
|
||||
num = 0
|
||||
another = True
|
||||
while another:
|
||||
try:
|
||||
num = int(input("Primes up to: "))
|
||||
another = False
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
print()
|
||||
for i in sieve_of_eratosthenes(num):
|
||||
print(i)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue