diff --git a/README.md b/README.md deleted file mode 100644 index 8added0..0000000 --- a/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# flake-compat - -## Usage - -To use, add the following to your `flake.nix`: - -```nix -inputs.flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; -}; -``` - -Afterwards, create a `default.nix` file containing the following: - -```nix -(import - ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { src = ./.; } -).defaultNix -``` - -If you would like a `shell.nix` file, create one containing the above, replacing `defaultNix` with `shellNix`. diff --git a/default.nix b/default.nix index 3fef1dd..c6557f9 100644 --- a/default.nix +++ b/default.nix @@ -33,7 +33,6 @@ let ({ url = info.url; } // (if info ? rev then { inherit (info) rev; } else {}) // (if info ? ref then { inherit (info) ref; } else {}) - // (if info ? submodules then { inherit (info) submodules; } else {}) ); lastModified = info.lastModified; lastModifiedDate = formatSecondsSinceEpoch info.lastModified; @@ -167,7 +166,8 @@ let outputs = flake.outputs (inputs // { self = result; }); - result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; }; + result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; _type = "flake"; }; + in if node.flake or true then assert builtins.isFunction flake.outputs; @@ -189,12 +189,10 @@ let in rec { defaultNix = - (builtins.removeAttrs result ["__functor"]) - // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) - // (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {}); + result + // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}); shellNix = defaultNix - // (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}) - // (if result ? devShells.${system}.default then { default = result.devShells.${system}.default; } else {}); + // (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}); }