diff --git a/default.nix b/default.nix index 4c3bcc2..85e7613 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,8 @@ -{ system ? builtins.currentSystem -, nixpkgs ? import { inherit system; } -}: { + system ? builtins.currentSystem, + nixpkgs ? import { inherit system; }, +}: +rec { nar-serve = nixpkgs.buildGoModule { pname = "nar-serve"; version = "latest"; @@ -10,5 +11,7 @@ doCheck = false; }; + default = nar-serve; + devShell = import ./shell.nix { inherit nixpkgs; }; } diff --git a/flake.lock b/flake.lock index 09dba7b..8223d5d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,40 +1,25 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, + "nixpkgs": { "locked": { - "lastModified": 1709126324, - "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "lastModified": 1722062969, + "narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", "type": "github" } }, - "nixpkgs": { - "locked": { - "lastModified": 1707689078, - "narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=", - "path": "/nix/store/8zgn73r04imfsn9sjynvp0nkkwppxngf-source", - "rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems" } }, "systems": { diff --git a/flake.nix b/flake.nix index 41b0370..31e366d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,29 @@ { description = "NAR serve"; - inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + systems.url = "github:nix-systems/default"; + }; - outputs = { self, nixpkgs, flake-utils }: + outputs = + { + self, + nixpkgs, + systems, + }: + let + eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); + in { overlay = import ./overlay.nix; - } - // - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - rec { - packages = import ./. { nixpkgs = pkgs; }; - defaultPackage = packages.nar-serve; - devShell = packages.devShell; - } - ); + + packages = eachSystem (pkgs: import ./. { nixpkgs = pkgs; }); + + formatter = eachSystem (pkgs: pkgs.nixfmt-rfc-style); + + devShells = eachSystem (pkgs: { + default = self.packages.${pkgs.system}.devShell; + }); + }; } diff --git a/overlay.nix b/overlay.nix index dc59aff..d54df73 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,3 +1 @@ -final: prev: { - nar-serve = import ./. { nixpkgs = final; }; -} +final: prev: { nar-serve = import ./. { nixpkgs = final; }; } diff --git a/shell.nix b/shell.nix index 005ac1d..9a92443 100644 --- a/shell.nix +++ b/shell.nix @@ -1,5 +1,6 @@ -{ system ? builtins.currentSystem -, nixpkgs ? import { inherit system; } +{ + system ? builtins.currentSystem, + nixpkgs ? import { inherit system; }, }: nixpkgs.mkShell { buildInputs = with nixpkgs; [