forked from Nike-Inc/gimme-aws-creds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
58 lines (54 loc) · 1.61 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
description = "Gimme AWS Creds";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
mach-nix.url = "github:davhau/mach-nix";
flake-utils.url = "github:numtide/flake-utils";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
};
outputs = {
self,
nixpkgs,
flake-utils,
mach-nix,
...
} @ inputs: let
pythonVersion = "python310";
packageName = "gimme-aws-creds";
in
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = nixpkgs.legacyPackages.${system};
mach = mach-nix.lib.${system};
pythonApp = mach.buildPythonPackage {
pname = packageName;
src = ./.;
python = pythonVersion;
requirements = builtins.readFile ./requirements.txt;
#version =; gets automatically detected
};
pythonAppEnv = mach.mkPython {
python = pythonVersion;
requirements = builtins.readFile ./requirements.txt;
};
in rec {
# nix build '.#gimme-aws-creds'
packages.${packageName} = pythonApp;
legacyPackages = self.packages.${system}.${packageName};
defaultPackage = self.packages.${system}.${packageName};
# nix run '.#default'
defaultApp = flake-utils.lib.mkApp {
drv = packages.${packageName};
exePath = "/bin/${packageName}";
};
devShells.default = pkgs.mkShellNoCC {
packages = [pythonAppEnv defaultPackage];
shellHook = ''
export PYTHONPATH="${pythonAppEnv}/bin/python"
'';
};
}
);
}