From 49c3a5b3b80ecb133c8365b2da5e460563e3c790 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Thu, 14 Mar 2024 09:32:25 +0100 Subject: [PATCH] chore: add nix flake --- .envrc | 9 ++++++++ .nix/flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ .nix/flake.nix | 24 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 .envrc create mode 100644 .nix/flake.lock create mode 100644 .nix/flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..db72d2a --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +use flake .nix +dotenv_if_exists + +if on_git_branch; then + echo + git status --short --branch + echo + git fetch +fi diff --git a/.nix/flake.lock b/.nix/flake.lock new file mode 100644 index 0000000..93d270d --- /dev/null +++ b/.nix/flake.lock @@ -0,0 +1,61 @@ +{ + "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": 1710222005, + "narHash": "sha256-irXySffHz7b82dZIme6peyAu+8tTJr1zyxcfUPhqUrg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a9a7552431c4f1a3b2eee9398641babf7c30d0e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "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", + "version": 7 +} diff --git a/.nix/flake.nix b/.nix/flake.nix new file mode 100644 index 0000000..ac7a6c0 --- /dev/null +++ b/.nix/flake.nix @@ -0,0 +1,24 @@ +{ + description = "A basic flake with a shell"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShell = pkgs.mkShell { + nativeBuildInputs = [ pkgs.bashInteractive ]; + buildInputs = with pkgs; [ + # building + gcc + cmake + ninja + sccache + ]; + }; + } + ); +}