From 22e8f013b66a0a6ed8729118d1a3f0a1acd54436 Mon Sep 17 00:00:00 2001 From: Roshan Kumar Date: Fri, 3 Jan 2025 18:30:01 +0530 Subject: [PATCH] Added flake-utils --- flake.lock | 44 +++++++++++++++++++++++++++++++++++++++----- flake.nix | 52 +++++++++++++++++++++++++++------------------------- 2 files changed, 66 insertions(+), 30 deletions(-) diff --git a/flake.lock b/flake.lock index 369a3b3..132287b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,16 +1,34 @@ { "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": 1735291276, - "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", - "owner": "nixos", + "lastModified": 1735471104, + "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", + "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -18,8 +36,24 @@ }, "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", diff --git a/flake.nix b/flake.nix index fcc55e9..29a9f6d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,32 +3,34 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: - let - system = "aarch64-darwin"; - name = "FlexAuth"; - src = ./.; - pkgs = nixpkgs.legacyPackages.${system}; - in - { - packages.${system}.default = derivation { - - inherit name system src; - - buildInputs = with pkgs; [ - rust - cargo - ]; + outputs = { self, nixpkgs, flake-utils}: + flake-utils.lib.eachDefaultSystem (system: + let + system = "aarch64-darwin"; + name = "FlexAuth"; + src = ./.; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.${system}.default = derivation { + inherit name system src; + + buildInputs = with pkgs; [ + rust + cargo + ]; - phases = [ "buildPhase" ]; - buildPhase = '' - CARGO_TARGET_DIR=$out ${nixpkgs.cargo}/bin/cargo build --manifest-path $src/Cargo.toml --release - ${nixpkgs.binutils}/bin/strip $out/release/flakes -o /tmp/test - rm -rf $out - mv /tmp/test $out - ''; - }; - }; + phases = [ "buildPhase" ]; + buildPhase = '' + CARGO_TARGET_DIR=$out ${nixpkgs.cargo}/bin/cargo build --manifest-path $src/Cargo.toml --release + ${nixpkgs.binutils}/bin/strip $out/release/flakes -o /tmp/test + rm -rf $out + mv /tmp/test $out + ''; + }; + } + ); }