Initial commit

This commit is contained in:
Michael Smith 2024-07-26 22:48:08 +02:00
commit 3ca3139b0e
4 changed files with 64 additions and 0 deletions

27
flake.lock generated Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1721949857,
"narHash": "sha256-DID446r8KsmJhbCzx4el8d9SnPiE8qa6+eEQOJ40vR0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1cc729dcbc31d9b0d11d86dc7436163548a9665",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

35
flake.nix Normal file
View File

@ -0,0 +1,35 @@
{
description = "A Python project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
};
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
my-python = pkgs.python3.withPackages (ps: [ps.numpy]);
in {
formatter.${system} = pkgs.alejandra;
devShells.${system} = {
default = self.devShells.${system}.foo;
foo = pkgs.mkShell {
packages = with pkgs; [
my-python
];
};
};
packages.${system} = {
default = self.packages.${system}.hello;
hello = pkgs.writeShellScriptBin "hello" ''
${pkgs.python3}/bin/python ${./main.py}
'';
};
};
}

1
main.py Normal file
View File

@ -0,0 +1 @@
print('Hello from Python')

1
result Symbolic link
View File

@ -0,0 +1 @@
/nix/store/zln9b7yardd69mvqb9fap5wh1hkkdgp2-hello