From cdf3887f53c5798fa1c8b90543890892523367ed Mon Sep 17 00:00:00 2001 From: _cry64 Date: Sat, 14 Mar 2026 20:23:08 +1000 Subject: [PATCH] nix flake init --- flake.lock | 43 ++++++++++++++++++++++++++++++++++ flake.nix | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 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..820189c --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1773375660, + "narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "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..ccbed83 --- /dev/null +++ b/flake.nix @@ -0,0 +1,68 @@ +{ + description = "age encrypted secrets vault for Nix flakes"; + + inputs = { + systems.url = "github:nix-systems/default"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + }; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + systems = import inputs.systems; + + mkPkgs = system: repo: + import repo { + inherit system; + allowUnfree = false; + allowBroken = false; + overlays = builtins.attrValues self.overlays or {}; + }; + + forAllSystems = f: + nixpkgs.lib.genAttrs systems (system: + f rec { + inherit system; + inherit (pkgs) lib; + pkgs = mkPkgs system nixpkgs; + }); + in { + devShells = forAllSystems ( + { + pkgs, + lib, + ... + }: { + default = pkgs.mkShell rec { + name = "vaultage"; + shell = "${pkgs.bash}/bin/bash"; + + # packages we need at runtime + packages = with pkgs; [ + rustc + cargo + cargo-mommy + + rust-analyzer-unwrapped + (rustfmt.override {asNightly = true;}) + clippy + taplo + ]; + + # packages we need at build time + nativeBuildInputs = with pkgs; [ + rustPlatform.bindgenHook + pkg-config + ]; + + # packages we link against + buildInputs = []; + + env.LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs); + }; + } + ); + }; +}