From dc4f72d04e7a4e0498b25d1ddea411d83509be7f Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Sun, 5 May 2024 03:46:52 -0400 Subject: [PATCH] fix flake.nix to work on all platforms (#15) --- flake.lock | 36 +++++++++++++++++++++++++++++++++++- flake.nix | 42 ++++++++++++++++++++++-------------------- 2 files changed, 57 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 96c65d4..5110e86 100644 --- a/flake.lock +++ b/flake.lock @@ -4,6 +4,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1692799911, "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", @@ -52,13 +70,14 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -89,6 +108,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 20bedb1..f995544 100644 --- a/flake.nix +++ b/flake.nix @@ -1,34 +1,36 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { self, nixpkgs, + flake-utils, rust-overlay, - }: let - # TODO what's the correct incantation here? - system = "x86_64-linux"; + }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [rust-overlay.overlays.default]; + }; - pkgs = import nixpkgs { - inherit system; - overlays = [rust-overlay.overlays.default]; - }; + toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; - toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; - - in { - devShells.${system}.default = pkgs.mkShell { - packages = [ - toolchain - pkgs.go_1_19 - pkgs.just - pkgs.deno - pkgs.gofumpt - ]; - }; - }; + in { + devShells.default = pkgs.mkShell { + packages = [ + toolchain + pkgs.go_1_19 + pkgs.just + pkgs.deno + pkgs.gofumpt + ]; + }; + } + ); }