Skip to content

Commit

Permalink
Remove dependency on flake-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jeslie0 committed Jan 26, 2024
1 parent 8a87bf9 commit e985127
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 72 deletions.
34 changes: 0 additions & 34 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 66 additions & 38 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,75 @@
description = "A very basic python flake template, providing a devshell.";

inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pyPkgs = pkgs.python310Packages;
customPython = pkgs.python39.buildEnv.override {
extraLibs = with pyPkgs; [
ipython
setuptools
requests
];
};
packageName = with builtins; head (match "^.*name[[:space:]]*=[[:space:]][\"]([^[:space:]]*)[\"][,].*$" (readFile ./setup.py));
version = with builtins; head (match "^.*version[[:space:]]*=[[:space:]][\"]([^[:space:]]*)[\"][,].*$" (readFile ./setup.py));
outputs = { self, nixpkgs }:
let
supportedSystems =
[ "aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];

forAllSystems =
nixpkgs.lib.genAttrs supportedSystems;

nixpkgsFor =
forAllSystems (system:
import nixpkgs {
inherit system;
}
);

pyPkgs = system:
nixpkgsFor.${system}.python310Packages;

packageName = with builtins;
head (match "^.*name[[:space:]]*=[[:space:]][\"]([^[:space:]]*)[\"][,].*$" (readFile ./setup.py));

version = with builtins;
head (match "^.*version[[:space:]]*=[[:space:]][\"]([^[:space:]]*)[\"][,].*$" (readFile ./setup.py));

in
{
packages =
forAllSystems (system:
let
pkgs =
nixpkgsFor.${system};

in
{
default = (pyPkgs system).buildPythonPackage {
pname = packageName;
inherit version;
src = ./.;
doCheck = false;

propagatedBuildInputs = [ (pyPkgs system).requests ];
meta = {
homepage = "https://github.com/jeslie0/npm-lockfile-fix";
description = "";
license = pkgs.lib.licenses.mit;
};
};
}
);

devShells =
forAllSystems (system:
let
pkgs =
nixpkgsFor.${system};
in
{
default =
pkgs.mkShell {
packages = with pkgs;
[ python310Packages.python-lsp-server ];

packages.default = pyPkgs.buildPythonPackage {
pname = packageName;
inherit version;
src = ./.;
doCheck = false;

propagatedBuildInputs = [ pyPkgs.requests ];
meta = {
homepage = "https://github.com/jeslie0/npm-lockfile-fix";
description = "";
license = pkgs.lib.licenses.mit;
};
};

devShell = pkgs.mkShell {
packages = with pkgs;
[ python310Packages.python-lsp-server ];
inputsFrom = [ self.packages.${system}.default ];
};
}
);
inputsFrom =
[ self.packages.${system}.default ];
};
}
);
};
}

0 comments on commit e985127

Please sign in to comment.