From 66a1f6833464bbb121b6d94247ad769f277351f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 28 Feb 2023 19:56:32 +0100 Subject: convert to flake --- flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++++++++++++ lib/default.nix | 3 +-- pkgs/default.nix | 6 +++--- 4 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..353d3b9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677608380, + "narHash": "sha256-k82O23qBAK+43X0KSBjsMYXG2x4kWWXeAmpPTc2KRGY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4aba90e89f6d4ac6138939961f62842bd94ec929", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..265ce00 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "nix library extension, containing sophisticated script and code generator functions"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = inputs @ { + self, + nixpkgs, + flake-utils, + }: let + nix-writersOverlay = import ./pkgs; + in + { + overlays = { + nix-writers = nix-writersOverlay; + default = nix-writersOverlay; + }; + } + // flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system;}; + nix-writers = nix-writersOverlay pkgs pkgs; + in { + legacyPackages = nix-writers; + }); +} diff --git a/lib/default.nix b/lib/default.nix index 01d43f7..bf634b6 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,3 +1,4 @@ +{ nixpkgs }: let { body = lib; @@ -19,6 +20,4 @@ let { testString = re: x: match re x != null; types = nixpkgs.lib.types // import ./types.nix { lib = body; }; }); - - nixpkgs.lib = import ; } diff --git a/pkgs/default.nix b/pkgs/default.nix index b0c8638..1c616bb 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -17,9 +17,9 @@ # nix-build hello_world.nix. # -with import ../lib; - -pkgs: oldpkgs: { +pkgs: oldpkgs: +with import ../lib { nixpkgs = pkgs; }; +{ exec = name: { filename, argv ? null, envp ? null, destination ? "" }: pkgs.writeC name { inherit destination; } /* c */ '' #include -- cgit v1.2.3