From 846f0c04835be2fe819d392e963dcc1ddae3a530 Mon Sep 17 00:00:00 2001 From: akash-akya Date: Sun, 23 Jun 2024 00:35:26 +0530 Subject: [PATCH] Rewrite flakes.nix to avoid using flake-utils --- flake.lock | 34 ---------------------------------- flake.nix | 29 +++++++++++++++-------------- 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/flake.lock b/flake.lock index 8b6cba7..0360468 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "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" - } - }, "nixpkgs": { "locked": { "lastModified": 1718835956, @@ -36,24 +18,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } - }, - "systems": { - "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 9312e99..fc0f7d1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,22 +2,23 @@ description = "Elixir Development Environment"; inputs = { - nixpkgs = { url = "github:NixOS/nixpkgs/nixos-24.05"; }; - flake-utils = { url = "github:numtide/flake-utils"; }; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem (system: - let - inherit (pkgs.lib) optional optionals; + outputs = { self, nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; - in - with pkgs; - { - devShell = pkgs.mkShell { - buildInputs = [ - elixir - ] ; - }; }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + elixir + ]; + }; + }); + }; }