From 0b727ee65d8b1428f104b964c3d6c6dac62edc0f Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:20:42 +1000 Subject: [PATCH] flake: add nix-community/flake-compat --- default.nix | 16 ++++++++++++++++ flake.lock | 16 ++++++++++++++++ flake.nix | 1 + 3 files changed, 33 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..897740c --- /dev/null +++ b/default.nix @@ -0,0 +1,16 @@ +# This file provides backward compatibility to nix < 2.4 clients +{ system ? builtins.currentSystem }: +let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + + root = lock.nodes.${lock.root}; + inherit (lock.nodes.${root.inputs.flake-compat}.locked) owner repo rev narHash; + + flake-compat = fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; + sha256 = narHash; + }; + + flake = import flake-compat { inherit system; src = ./.; }; +in +flake.defaultNix diff --git a/flake.lock b/flake.lock index 3c1a34a..3135c5e 100644 --- a/flake.lock +++ b/flake.lock @@ -110,6 +110,21 @@ "type": "github" } }, + "flake-compat": { + "locked": { + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -248,6 +263,7 @@ "comin": "comin", "disko": "disko", "empty": "empty", + "flake-compat": "flake-compat", "flake-parts": "flake-parts", "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index 340851c..24b42a1 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ disko.inputs.nixpkgs.follows = "nixpkgs"; disko.url = "github:nix-community/disko"; empty.url = "github:nix-systems/empty"; + flake-compat.url = "github:nix-community/flake-compat"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs";