add nix flake files

This commit is contained in:
tuxcoder 2023-11-19 23:26:56 +01:00
parent f58b77207b
commit eb8544ba7b
3 changed files with 150 additions and 1 deletions

3
.gitignore vendored
View file

@ -8,4 +8,5 @@
*.py[co] *.py[co]
.DS_Store .DS_Store
.webassets-cache .webassets-cache
build /source/build
result

44
flake.lock Normal file
View file

@ -0,0 +1,44 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

104
flake.nix Normal file
View file

@ -0,0 +1,104 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
#nixpkgs.url = "github:NixOS/nixpkgs";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: let
pkgs_system = pkgs.${system};
stdenv = nixpkgs.legacyPackages.${system}.stdenv;
python = pkgs_system.python3;
whitenoise = with python.pkgs; buildPythonPackage rec {
pname = "whitenoise";
version = "4.1.4";
src = fetchPypi {
inherit pname version;
sha256 = "22f79cf8f1f509639330f93886acaece8ec5ac5e9600c3b981d33c34e8a42dfd";
};
doCheck = false;
propagatedBuildInputs = [
setuptools
django
];
};
multipart = with python.pkgs; buildPythonPackage rec {
pname = "multipart";
version = "0.2.4";
src = fetchPypi {
inherit pname version;
sha256 = "06ba205360bc7096fefe618e4f1e9b2cdb890b4f2157053a81f386912a2522cb";
};
doCheck = true;
propagatedBuildInputs = [
setuptools
];
};
proper-cli = with python.pkgs; buildPythonPackage rec {
pname = "proper-cli";
version = "1.0";
format = "pyproject";
src = fetchPypi {
inherit pname version;
sha256 = "67313e8ed5a2519ca224fe5f0e9237898960b7bb964ea4024e20ed8ee9773b67";
};
doCheck = true;
propagatedBuildInputs = [
setuptools
];
};
clay = with python.pkgs; buildPythonPackage rec {
pname = "clay";
version = "4.6.2";
format = "pyproject";
src = fetchPypi {
inherit pname version;
sha256 = "e822c67532895b4f03aa5ae8270ab52b59ba55b492d446c51b28d1ed7f839514";
};
doCheck = true;
propagatedBuildInputs = [
setuptools
pyyaml
whitenoise
gunicorn
proper-cli
multipart
jinja2
];
};
my_python = python.withPackages (ps: [clay]);
in{
clay = clay;
my_python = my_python;
default = stdenv.mkDerivation {
name = "milliways";
unpackPhase = "";
src = ./.;
buildPhase = ''
${clay}/bin/clay build source
'';
installPhase = ''
cp source/build/ $out/ -r
'';
};
});
devShells = forAllSystems (system: {
default = pkgs.${system}.mkShellNoCC {
packages = [
(pkgs.${system}.python3.withPackages (ps: [self.packages.${system}.clay]))
];
};
});
};
}