commit 3ca3139b0e403ccbcb9c8f5b5891d0dfc0baba0f Author: Michael Smith Date: Fri Jul 26 22:48:08 2024 +0200 Initial commit diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f4bcb6f --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ee71d53 --- /dev/null +++ b/flake.nix @@ -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} + ''; + }; + }; +} diff --git a/main.py b/main.py new file mode 100644 index 0000000..7440310 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +print('Hello from Python') diff --git a/result b/result new file mode 120000 index 0000000..e41320c --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/zln9b7yardd69mvqb9fap5wh1hkkdgp2-hello \ No newline at end of file