From a6625827cf8780ea63b30cb84d18176723948a27 Mon Sep 17 00:00:00 2001 From: Kevin Robert Stravers Date: Sun, 11 May 2025 09:30:44 -0400 Subject: [PATCH] Add flake.nix file for Nix/NixOS users This flake defines a development shell for developing argbash. It ensures that all dependencies used to build this project are pinned to a specific version (via a lock file). In this case, make, m4, and autoconf, and sphinx. This guarantees deterministic build behavior; builds always use the same exact dependencies until the lock file is updated. Any updates to the dependencies on a system level will not be able to break our build if an API or a behavior of such a dependency has changed. The nixpkgs repository already has a build script for argbash here: https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/ar/argbash But that is just for building the tool so it can be used. A devshell can be defined and used from there, but this patch allows it to be updated when new dependencies come in, allowing us to keep the flake in sync with development of this tool. --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 24 +++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0952e14 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "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": 1746663147, + "narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-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/flake.nix b/flake.nix new file mode 100644 index 0000000..b4831ad --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + nixConfig.bash-prompt-suffix = "\[nix\] "; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs: + inputs.flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import inputs.nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + autoconf + gnumake + sphinx + ]; + }; + } + ); +}