From 207cd4d0dfc5aba1cc77290e7b09402af18aa7d7 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 3 Nov 2021 19:35:06 +0100 Subject: [PATCH] mach-nix: Remove as dependency. --- flake.lock | 69 +----------------------------------------------------- flake.nix | 65 ++++++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 98 deletions(-) diff --git a/flake.lock b/flake.lock index ff9846b..08f5b72 100644 --- a/flake.lock +++ b/flake.lock @@ -31,57 +31,7 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1601282935, - "narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "588973065fce51f4763287f0fda87a174d78bf48", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "mach-nix": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs", - "pypi-deps-db": "pypi-deps-db" - }, - "locked": { - "lastModified": 1635348539, - "narHash": "sha256-SXrwF/KPz8McBN8kN+HTfGphE1hiRSr1mtXSVjPJr8o=", - "owner": "DavHau", - "repo": "mach-nix", - "rev": "98d001727542bb6142d0ab554fc30bd591b07c73", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "mach-nix", - "type": "github" - } - }, "nixpkgs": { - "locked": { - "lastModified": 1622797669, - "narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1635336330, "narHash": "sha256-EPrCZTmuOEY1KLjUCu7rXCBxNemggIFJMDdfEqXQKGo=", @@ -97,28 +47,11 @@ "type": "github" } }, - "pypi-deps-db": { - "flake": false, - "locked": { - "lastModified": 1622970040, - "narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=", - "owner": "DavHau", - "repo": "pypi-deps-db", - "rev": "be6591698c67a86a69c81fef72167e38d038a9fc", - "type": "github" - }, - "original": { - "owner": "DavHau", - "repo": "pypi-deps-db", - "type": "github" - } - }, "root": { "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", - "mach-nix": "mach-nix", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 5ede8e5..4017c5e 100644 --- a/flake.nix +++ b/flake.nix @@ -8,42 +8,47 @@ flake = false; }; flake-utils.url = "github:numtide/flake-utils"; - mach-nix.url = "github:DavHau/mach-nix"; }; - outputs = { self, nixpkgs, flake-utils, mach-nix, ... }: { + outputs = { self, nixpkgs, flake-utils, ... }: { nixosModules.peerix = import ./module.nix; overlay = import ./overlay.nix { inherit self; }; } // flake-utils.lib.eachDefaultSystem (system: - let pkgs = nixpkgs.legacyPackages.${system}; in { - packages.peerix = mach-nix.lib.${system}.buildPythonApplication { - pname = "peerix"; - python = "python39"; - src = ./.; - version = builtins.replaceStrings [ " " "\n" ] [ "" "" ] (builtins.readFile ./VERSION); - requirements = builtins.readFile ./requirements.txt; - propagatedBuildInputs = with pkgs; [ - nix - nix-serve - ]; - }; + let + pkgs = nixpkgs.legacyPackages.${system}; + python = pkgs.python39; + packages = map (pkg: python.pkgs.${pkg}) (builtins.filter (v: builtins.isString v && (builtins.stringLength v) > 0) (builtins.split "\n" (builtins.readFile ./requirements.txt))); + in { + packages = rec { + peerix-unwrapped = python.pkgs.buildPythonApplication { + pname = "peerix"; + version = builtins.replaceStrings [ " " "\n" ] [ "" "" ] (builtins.readFile ./VERSION); + src = ./.; - defaultPackage = self.packages.${system}.peerix; + doCheck = false; + + propagatedBuildInputs = with pkgs; [ + nix + nix-serve + ] ++ packages; + }; - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ - nix-serve - niv - (mach-nix.lib.${system}.mkPython { - python = "python39"; - requirements = '' - ${builtins.readFile ./requirements.txt} - ipython - ''; - }) - ]; - }; + peerix = pkgs.writeShellScriptBin "peerix" '' + PATH=${pkgs.nix}/bin:${pkgs.nix-serve}:$PATH + exec ${peerix-unwrapped}/bin/peerix "$@" + ''; + }; - defaultApp = { type = "app"; program = "${self.packages.${system}.peerix}/bin/peerix"; }; - }); + defaultPackage = self.packages.${system}.peerix; + + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + nix-serve + niv + (python.withPackages (ps: packages)) + ]; + }; + + defaultApp = { type = "app"; program = "${self.packages.${system}.peerix}/bin/peerix"; }; + }); }