From 60da4fb943aeb3b6f2a2507e9e00c3752487ebde Mon Sep 17 00:00:00 2001 From: jmug Date: Sun, 27 Apr 2025 23:17:04 -0700 Subject: [PATCH] Add a dev flake. Signed-off-by: jmug --- .envrc | 1 + .gitignore | 3 +++ flake.lock | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 29 +++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 4092b8c..5971c85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Envrc +.direnv + # ---> Go # If you prefer the allow list template instead of the deny list, see community template: # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..86ec3a7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1741310760, + "narHash": "sha256-aizILFrPgq/W53Jw8i0a1h1GZAAKtlYOrG/A5r46gVM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "de0fe301211c267807afd11b12613f5511ff7433", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "de0fe301211c267807afd11b12613f5511ff7433", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "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", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e1cdd9c --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "A dev shell flake for go"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/de0fe301211c267807afd11b12613f5511ff7433"; # Go 1.24.1 + systems.url = "github:nix-systems/default"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + go + gotools + gopls + ]; + }; + } + ); +}