From 1cd0b9887a33308f68bc83b751bd15f93c7a4629 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sun, 29 May 2022 17:43:03 +0100 Subject: [PATCH] Add a Nix flake --- .gitignore | 2 ++ flake.lock | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 46 +++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 9782c73..3a7f2da 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ __pycache__ /datman-helper-postgres/datman_helper_postgres.egg-info /datman-helper-mysql/datman_helper_mysql.egg-info +/result + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6aa2cdc --- /dev/null +++ b/flake.lock @@ -0,0 +1,87 @@ +{ + "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": 1653738054, + "narHash": "sha256-IaR8iLN4Ms3f5EjU1CJkXSc49ZzyS5qv03DtVAti6/s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "17b62c338f2a0862a58bb6951556beecd98ccda9", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1653738054, + "narHash": "sha256-IaR8iLN4Ms3f5EjU1CJkXSc49ZzyS5qv03DtVAti6/s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "17b62c338f2a0862a58bb6951556beecd98ccda9", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "naersk": "naersk", + "nixpkgs": "nixpkgs_2", + "src": "src", + "utils": "utils" + } + }, + "src": { + "flake": false, + "locked": { + "narHash": "sha256-MGP5pSluHmnG0XKKLGrXPWv1bYx55iw6t6TNnr9xrs0=", + "path": "./.", + "type": "path" + }, + "original": { + "path": "./.", + "type": "path" + } + }, + "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..bc6f90d --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "Yama and Datman"; + + inputs = { + utils.url = "github:numtide/flake-utils"; + naersk.url = "github:nix-community/naersk"; + src.url = "path:./."; + src.flake = false; + }; + + outputs = { self, nixpkgs, utils, naersk, src }: + utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages."${system}"; + naersk-lib = naersk.lib."${system}"; + in rec { + # `nix build` + packages.yama = naersk-lib.buildPackage { + pname = "yama"; + root = src; + + buildInputs = with pkgs; [ + openssl + pkgconfig + sqlite + ]; + }; + + defaultPackage = packages.yama; + + # NixOS Modules +# nixosModules = { +# yama = import ./nixos_modules/yama.nix self; +# }; + + # `nix run` + apps.yama = utils.lib.mkApp { + drv = packages.yama; + }; + defaultApp = apps.yama; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ rustc cargo ]; + }; + }); +}