From 385d14f03bdb22568072b4ad42edf5b5fd2c9fab Mon Sep 17 00:00:00 2001 From: Juanperias <136520331+Juanperias@users.noreply.github.com> Date: Sat, 12 Apr 2025 12:26:13 -0400 Subject: [PATCH] feat: add minimal nix flake --- flake.lock | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 31 +++++++++++++ 2 files changed, 161 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..5b96406 --- /dev/null +++ b/flake.lock @@ -0,0 +1,130 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1744386647, + "narHash": "sha256-DXwQEJllxpYeVOiSlBhQuGjfvkoGHTtILLYO2FvcyzQ=", + "owner": "ipetkov", + "repo": "crane", + "rev": "d02c1cdd7ec539699aa44e6ff912e15535969803", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1744231114, + "narHash": "sha256-60gLl2rJFt6SRwqWimsTAeHgfsIE1iV0zChdJFOvx8w=", + "owner": "nix-community", + "repo": "fenix", + "rev": "0ccfe532b1433da8e5a23cd513ff6847e0f6a8c2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "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": 1742288794, + "narHash": "sha256-Txwa5uO+qpQXrNG4eumPSD+hHzzYi/CdaM80M9XRLCo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b6eaf97c6960d97350c584de1b6dcff03c9daf42", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744232761, + "narHash": "sha256-gbl9hE39nQRpZaLjhWKmEu5ejtQsgI5TWYrIVVJn30U=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1742296961, + "narHash": "sha256-gCpvEQOrugHWLimD1wTFOJHagnSEP6VYBDspq96Idu0=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "15d87419f1a123d8f888d608129c3ce3ff8f13d4", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "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..7fb3da5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "Apic crate flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + crane.url = "github:ipetkov/crane"; + flake-utils.url = "github:numtide/flake-utils"; + fenix.url = "github:nix-community/fenix"; + }; + + outputs = { + flake-utils, + nixpkgs, + fenix, + ... + } @ inputs: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + crane = inputs.crane.mkLib pkgs; + toolchain = fenix.packages.${system}.fromToolchainFile { + file = ./rust-toolchain; + sha256 = "sha256-3bAD7erEALKbg6tqraZbgnUo6QXocekG7M7WSWlwHdE="; + }; + craneLib = crane.overrideToolchain toolchain; + in { + formatter = pkgs.alejandra; + devShells.default = craneLib.devShell { + packages = [toolchain]; + }; + }); +}