diff --git a/.gitignore b/.gitignore index a806510..778d660 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -# ---> Nix # Ignore build outputs from performing a nix-build or `nix build` command result result-* diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..c395567 --- /dev/null +++ b/default.nix @@ -0,0 +1,31 @@ +{ pkgs, lib, config, ... }: +{ + options = { + scripts.output = lib.mkOption { + type = lib.types.package; + }; + + requestParams = lib.mkOption { + type = lib.types.listOf lib.types.str; + }; + }; + + config = { + scripts.output = pkgs.writeShellApplication { + name = "map"; + runtimeInputs = with pkgs; [ + curl + imagemagick + ]; + + text = '' + convert <(${./map} ${lib.concatStringsSep " " config.requestParams}) sixel:- + ''; + }; + + requestParams = [ + "size=640x300" + "scale=2" + ]; + }; +} diff --git a/eval.nix b/eval.nix new file mode 100644 index 0000000..c1d0e93 --- /dev/null +++ b/eval.nix @@ -0,0 +1,10 @@ +let + nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11"; + pkgs = import nixpkgs { config = {}; overlays = []; }; +in + pkgs.lib.evalModules { + modules = [ + ({ config, ... }: { config._module.args = { inherit pkgs; }; }) + ./default.nix + ]; + }