From 07c7d1fae93ba2b76474041b9396433d677b8fdf Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Wed, 25 May 2022 20:51:22 +0100 Subject: [PATCH] Add a Nix flake (no NixOS module yet) --- .gitignore | 2 ++ flake.lock | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index f8c2960..be62537 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ /.gdb_history /ca +/result + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dcffc85 --- /dev/null +++ b/flake.lock @@ -0,0 +1,74 @@ +{ + "nodes": { + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1653413650, + "narHash": "sha256-wojDHjb+eU80MPH+3HQaK0liUy8EgR95rvmCl24i58Y=", + "owner": "nix-community", + "repo": "naersk", + "rev": "69daaceebe12c070cd5ae69ba38f277bbf033695", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653326962, + "narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41cc1d5d9584103be4108c1815c350e07c807036", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1653326962, + "narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41cc1d5d9584103be4108c1815c350e07c807036", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "naersk": "naersk", + "nixpkgs": "nixpkgs_2", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1652776076, + "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c210d74 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "OliveFS"; + + inputs = { + utils.url = "github:numtide/flake-utils"; + naersk.url = "github:nix-community/naersk"; + }; + + outputs = { self, nixpkgs, utils, naersk }: + utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; + naersk-lib = naersk.lib."${system}"; + in rec { + # `nix build` + packages.olivefs = naersk-lib.buildPackage { + pname = "olivefs"; + root = ./.; + + buildInputs = with pkgs; [ + pkgconfig + fuse + ]; + nativeBuildInputs = with pkgs; [ + # Idea from https://github.com/NixOS/nixpkgs/blob/634141959076a8ab69ca2cca0f266852256d79ee/pkgs/servers/matrix-conduit/default.nix + pkgs.rust.packages.stable.rustPlatform.bindgenHook + ]; + }; + + defaultPackage = packages.olivefs; + + # NixOS Modules +# nixosModules = { +# olivefsd = import ./nixos_modules/olivefsd.nix self; +# }; + + # `nix run` +# apps.olivefs = utils.lib.mkApp { +# drv = packages.olivefs; +# }; +# defaultApp = apps.olivefs; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ rustc cargo ]; + }; + }); +}