Compare commits

...

3 Commits

6 changed files with 24 additions and 68 deletions

View File

@ -58,6 +58,7 @@ x -> y -> z
- sketch
- force-appendix
- center
- animated-interval
# Limitation

3
default.nix Normal file
View File

@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix

View File

@ -15,73 +15,26 @@
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1679281263,
"narHash": "sha256-neMref1GTruSLt1jBgAw+lvGsZj8arQYfdxvSi5yp4Q=",
"lastModified": 1680487167,
"narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8276a165b9fa3db1a7a4f29ee29b680e0799b9dc",
"rev": "53dad94e874c9586e71decf82d972dfb640ef044",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1678875422,
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"tools": "tools"
}
},
"tools": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1679320952,
"narHash": "sha256-L7x8BwHWGFILwvXTluKJkfkSYZQxPbSXrzDc/HC80Oc=",
"ref": "refs/heads/main",
"rev": "88e2a5beb95722b454f081e5b766eef8f908eeb3",
"revCount": 30,
"type": "git",
"url": "https://git.pleshevski.ru/mynix/tools"
},
"original": {
"type": "git",
"url": "https://git.pleshevski.ru/mynix/tools"
"nixpkgs": "nixpkgs"
}
}
},

View File

@ -1,20 +1,11 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
tools.url = "git+https://git.pleshevski.ru/mynix/tools";
};
outputs = { self, nixpkgs, flake-utils, tools, ... }:
let
inherit (builtins) readFile;
mkWd2 = { writeShellApplication, symlinkJoin, d2, ... }:
writeShellApplication {
name = "wd2";
runtimeInputs = [ d2 ];
text = (readFile ./wd2);
};
in
outputs = { nixpkgs, flake-utils, ... }:
let mkWd2 = import ./wd2.nix; in
{
overlays = {
default = final: prev: {
@ -27,9 +18,7 @@
inherit (builtins) mapAttrs;
pkgs = import nixpkgs { inherit system; };
wd2 = pkgs.callPackage mkWd2 {
d2 = tools.packages.${system}.d2;
};
wd2 = pkgs.callPackage mkWd2 { };
mkApp = drv: flake-utils.lib.mkApp { inherit drv; };
packages = {

5
wd2
View File

@ -24,6 +24,7 @@ cli and overwrite cli parameters with the same name.
- sketch
- force-appendix
- center
- animated-interval
-------------------------------------------------------------------------------
@ -82,6 +83,7 @@ d2_sketch=$(get_attr_value "sketch")
d2_port=$(get_attr_value "port")
d2_force_appendix=$(get_attr_value "force-appendix")
d2_center=$(get_attr_value "center")
d2_animated_interval=$(get_attr_value "animated-interval")
set -e
d2 "${d2_args[@]}" \
@ -92,5 +94,6 @@ d2 "${d2_args[@]}" \
${d2_sketch:+--sketch=${d2_sketch}} \
${d2_port:+--port=${d2_port}} \
${d2_force_appendix:+--force-appendix=${d2_force_appendix}}
${d2_center:+--center=${d2_center}}
${d2_center:+--center=${d2_center}} \
${d2_animated_interval:+--animated-interval=${d2_animated_interval}}

7
wd2.nix Normal file
View File

@ -0,0 +1,7 @@
{ writeShellApplication, d2, ... }:
writeShellApplication {
name = "wd2";
runtimeInputs = [ d2 ];
text = builtins.readFile ./wd2;
}