From a22a6347a997979ce96a6e1a9edc809aa39b7b52 Mon Sep 17 00:00:00 2001 From: James Andariese Date: Sun, 27 Apr 2025 14:09:34 -0500 Subject: [PATCH] add nix flake --- .gitignore | 1 + flake.lock | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 31 +++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 9b67b8b..fd3eba9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ \#*# *~ /target +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a041818 --- /dev/null +++ b/flake.lock @@ -0,0 +1,100 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1745822598, + "narHash": "sha256-GIBS6zFO3J3rxUKkIaiy+sFvWzUMlz8iWweM7BsC7KY=", + "owner": "nix-community", + "repo": "fenix", + "rev": "6a955576b9f03bfa6a1caddba3ac29cfe98d5978", + "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": 1745742390, + "narHash": "sha256-1rqa/XPSJqJg21BKWjzJZC7yU0l/YTVtjRi0RJmipus=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "26245db0cb552047418cfcef9a25da91b222d6c7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1745694049, + "narHash": "sha256-fxvRYH/tS7hGQeg9zCVh5RBcSWT+JGJet7RA8Ss+rC0=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "d8887c0758bbd2d5f752d5bd405d4491e90e7ed6", + "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..fc6fc9c --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = {self, nixpkgs, fenix, flake-utils}@inputs: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + lib = pkgs.lib; + in + rec { + defaultPackage = (pkgs.makeRustPlatform { + inherit (fenix.packages.${system}.complete) cargo rustc; + }).buildRustPackage { + pname = "shq"; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + }; + packages.shq = defaultPackage; + devShells.default = pkgs.mkShell { + buildInputs = [ fenix.packages.${system}.complete.toolchain ]; + }; + }); +}