diff options
-rw-r--r-- | flake.lock | 42 | ||||
-rw-r--r-- | flake.nix | 28 | ||||
-rw-r--r-- | lib/default.nix | 3 | ||||
-rw-r--r-- | pkgs/default.nix | 6 |
4 files changed, 74 insertions, 5 deletions
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 <nixpkgs/lib>; } 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 <unistd.h> |