From 11045e0d73592bfdef6518edb9b7242dce52594c Mon Sep 17 00:00:00 2001 From: installer Date: Wed, 22 Jan 2025 18:07:20 +0100 Subject: [PATCH] feat: add direnv + nix --- .envrc | 2 ++ .gitignore | 1 + flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 70 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..fe075fe --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +watch_file flake.lock +use flake diff --git a/.gitignore b/.gitignore index 5855fd4..75d9ba4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .godot/ /android/ dist/ +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fea8e52 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1737469691, + "narHash": "sha256-nmKOgAU48S41dTPIXAq0AHZSehWUn6ZPrUKijHAMmIk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9e4d5190a9482a1fb9d18adf0bdb83c6e506eaab", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2388051 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Simple shell for my test game"; + + # Flake inputs + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + # Flake outputs + outputs = { self, nixpkgs, ... }: + let + # Systems supported + allSystems = [ + "x86_64-linux" # 64-bit Intel/AMD Linux + "aarch64-linux" # 64-bit ARM Linux + "x86_64-darwin" # 64-bit Intel macOS + "aarch64-darwin" # 64-bit ARM macOS + ]; + + # Helper to provide system-specific attributes + forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + # Development environment output + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + # The Nix packages provided in the environment + packages = (with pkgs; [ + onefetch + godot_4 + ]); + shellHook = '' + onefetch + ''; + }; + }); + }; +}