From e2ac9aa4e67dfb4bbfefce48a8a5200b3b8990cb Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Tue, 13 Feb 2024 19:20:24 +0100 Subject: [PATCH] add flake with direnv support --- .envrc | 1 + .gitignore | 1 + flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 63 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 eadc128..cf48717 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target/ .ccls-cache/ +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e79b649 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1707824078, + "narHash": "sha256-Au3wLi2d06bU7TDvahP2jIEeKwmjAxKHqi8l2uiBkGA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "99d7b32e4cfdaf763d9335b4d9ecf4415cbdc405", + "type": "github" + }, + "original": { + "owner": "NixOS", + "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..1deeff3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "modular fetch"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = { + nixpkgs, + ... + }: let + systems = [ "x86_64-linux" "aarch64-linux" ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + pkgsForEach = nixpkgs.legacyPackages; + in { + devShells = forEachSystem (system: + let + pkgs = pkgsForEach.${system}; + in { + default = pkgs.mkShell { + name = "modfetch"; + + nativeBuildInputs = with pkgs; [ + gcc + gnumake + ]; + + buildInputs = with pkgs; [ + curl.dev + ]; + }; + } + ); + }; +}