From ca4f4f3f45a46a1c954fdc90c55addf913026aa8 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Sat, 12 Nov 2022 20:58:59 +0530 Subject: [PATCH] Fix nix build second attempt --- default.nix | 10 ++++++ flake.lock | 91 +++++++++++++++++++++++++++++++++++++++++++++++------ flake.nix | 40 +++++++++++++---------- 3 files changed, 115 insertions(+), 26 deletions(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..2cccff2 --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +(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 diff --git a/flake.lock b/flake.lock index 6727cdd..3514f1b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,91 @@ { "nodes": { - "flake-utils": { + "flake-compat": { + "flake": false, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1667849540, + "narHash": "sha256-kqo8PTE3i21Z0pnxJwcwCQRZKKC15Y8xFTEN6qko3M8=", + "owner": "domenkozar", + "repo": "nix", + "rev": "3dcbdd412592413f34552a50403daf58656d43e6", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", "type": "github" } }, "nixpkgs": { + "locked": { + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1668199800, "narHash": "sha256-qnEeVo88H8an0Wds9kBSxWlGCa0vY5EgEswnQUZnXmc=", @@ -32,8 +102,9 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "flake-compat": "flake-compat", + "nix": "nix", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index feba818..31e1fb9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,25 +2,33 @@ description = "xplr - A hackable, minimal, fast TUI file explorer"; inputs = { - flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "github:nixos/nixpkgs"; + nix.url = "github:domenkozar/nix/relaxed-flakes"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: - let pkgs = nixpkgs.legacyPackages.${system}; in - rec { - packages = flake-utils.lib.flattenTree { - xplr = pkgs.rustPlatform.buildRustPackage rec { - name = "xplr"; - src = ./.; - cargoLock = { - lockFile = ./Cargo.lock; - }; + outputs = { self, nixpkgs, nix, ... }: + let + systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems); + in + { + packages = forAllSystems (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + xplr = pkgs.rustPlatform.buildRustPackage rec { + name = "xplr"; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; }; }; - defaultPackage = packages.xplr; - } - ); + }); + defaultPackage = forAllSystems (system: self.packages.${system}.xplr); + }; }