diff --git a/flake.lock b/flake.lock index 61299bf..a6ca46e 100644 --- a/flake.lock +++ b/flake.lock @@ -46,25 +46,12 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1668629939, - "narHash": "sha256-MEh5T0wZ1oaoUn84odShFvIObwSIbZ+NEZ5Q2ff83nc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b85c2a060f6223e869493a8397ca47223ee2458a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "type": "github" - } - }, "poetry2nix": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1668394823, @@ -75,8 +62,9 @@ "type": "github" }, "original": { - "id": "poetry2nix", - "type": "indirect" + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 69abba8..8b0f527 100644 --- a/flake.nix +++ b/flake.nix @@ -2,23 +2,46 @@ description = "A Python API for various tools I use at work."; inputs = { nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05; - flake-utils.url = github:numtide/flake-utils; + flake-utils = { + url = github:numtide/flake-utils; + }; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, flake-utils, poetry2nix }: - flake-utils.lib.eachDefaultSystem (system: + { + # Nixpkgs overlay providing the application + overlay = nixpkgs.lib.composeManyExtensions [ + poetry2nix.overlay + (final: prev: { + # The application + network_inventory = prev.poetry2nix.mkPoetryApplication { + projectDir = ./.; + }; + }) + ]; + } // (flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; in { + apps = { + network_inventory = pkgs.network_inventory; + }; + + defaultApp = pkgs.network_inventory; + devShell = pkgs.mkShell { buildInputs = [ pkgs.gnumake - pkgs.python39 pkgs.python39Packages.poetry + pkgs.network_inventory ]; }; - shellHook = '' - export DJANGO_SETTINGS_MODULE=network_inventory.settings.local - ''; - }); + })); }