From da5fe9b6579d2df6943aa40dcc153edb2ba354e9 Mon Sep 17 00:00:00 2001 From: dzdidi Date: Sat, 7 Oct 2023 16:20:21 +0200 Subject: [PATCH] flake intermediate Signed-off-by: dzdidi --- default.nix | 32 ++++++++ flake.lock | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 51 ++++-------- 3 files changed, 281 insertions(+), 34 deletions(-) create mode 100644 default.nix create mode 100644 flake.lock diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..d80820d --- /dev/null +++ b/default.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + dream2nix, + ... +}: { + imports = [ + # dream2nix.modules.dream2nix.nodejs-package-lock + # dream2nix.modules.dream2nix.nodejs-granular + dream2nix.modules.dream2nix.mkDerivation + ]; + + mkDerivation = { + src = config.deps.fetchFromGitHub { + owner = "dzdidi"; + repo = "gitpear"; + rev = "v1.0.0"; + sha256 = lib.fakeHash; + }; + }; + + deps = {nixpkgs, ...}: { + inherit + (nixpkgs) + fetchFromGitHub + stdenv + ; + }; + + name = "gitpear"; + version = "1.0.0"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5778fce --- /dev/null +++ b/flake.lock @@ -0,0 +1,232 @@ +{ + "nodes": { + "devshell": { + "flake": false, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dream2nix": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nix-unit": "nix-unit", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1696675950, + "narHash": "sha256-OpVXrW36oozXHd//IIFjzXO5cjnJhN9ooErIvLbBGJk=", + "owner": "nix-community", + "repo": "dream2nix", + "rev": "e9fac8985cb7de31bc91edb934b8245b3945a67e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "dream2nix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675933616, + "narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "47478a4a003e745402acf63be7f9a092d51b83d7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "dream2nix", + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-unit": { + "inputs": { + "flake-parts": [ + "dream2nix", + "flake-parts" + ], + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1694670962, + "narHash": "sha256-HvMq0TJGYSx37zHm4j2d+JUZx4/6X7xKEt/0DeCiwjQ=", + "owner": "adisbladis", + "repo": "nix-unit", + "rev": "3ed2378bddad85257fc508a291408f9ed9673d01", + "type": "github" + }, + "original": { + "owner": "adisbladis", + "repo": "nix-unit", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1694767346, + "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1646153636, + "narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "dream2nix": "dream2nix", + "nixpkgs": [ + "dream2nix", + "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" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "dream2nix", + "nix-unit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689620039, + "narHash": "sha256-BtNwghr05z7k5YMdq+6nbue+nEalvDepuA7qdQMAKoQ=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "719c2977f958c41fa60a928e2fbc50af14844114", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index f215238..cff4b5a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,42 +1,25 @@ -# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.6) { - # A helpful description of your flake description = "pear to pear git transport"; - # Flake inputs inputs = { - flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; - - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + dream2nix.url = "github:nix-community/dream2nix"; + nixpkgs.follows = "dream2nix/nixpkgs"; }; - # Flake outputs that other flakes can use - outputs = { self, flake-schemas, nixpkgs }: - let - # Helpers for producing system-specific outputs - supportedSystems = [ "x86_64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit system; }; - }); - in { - # Schemas tell Nix about the structure of your flake's outputs - schemas = flake-schemas.schemas; - - # Development environments - devShells = forEachSupportedSystem ({ pkgs }: { - default = pkgs.mkShell { - # Pinned packages available in the environment - packages = with pkgs; [ - nodejs-18_x - git - nixpkgs-fmt - ]; - - # Environment variables - env = { - GIT_PEAR = "~/.gitpear"; - }; - }; - }); + outputs = inputs @ { + self, + dream2nix, + nixpkgs, + ... + }: let + system = "x86_64-darwin"; + in { + packages.${system} = dream2nix.lib.importPackages { + projectRoot = ./.; + # can be changed to ".git" or "flake.nix" to get rid of .project-root + projectRootFile = "flake.nix"; + packagesDir = ./def; + packageSets.nixpkgs = nixpkgs.legacyPackages.${system}; }; + }; }