From cedc5db744f5ec122c00e55f29221c93fc1776e0 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 18 Sep 2024 18:43:08 -0700 Subject: [PATCH] darwin shell --- flake.lock | 34 ++++++++++++++++++++++++++++++++++ flake.nix | 31 ++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 7035cfb..f03f853 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1708407374, @@ -18,8 +36,24 @@ }, "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 fbbbf9f..884acc3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,28 @@ { description = "A basic flake with a shell"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; - outputs = { nixpkgs, ... }: - let pkgs = nixpkgs.legacyPackages."x86_64-linux"; - in { - devShells."x86_64-linux".default = - pkgs.mkShell { packages = with pkgs; [ go sqlite nodejs pigeon ]; }; - }; + outputs = { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + go + pigeon + nodejs + sqlite + ]; + + shellHook = '' + echo "System: ${system}" + ''; + }; + } + ); }