literal-flake-input: Web service converting URLs into archived nix attrsets

[ bsd3, library, program, system ] [ Propose Tags ] [ Report a vulnerability ]

Service translates an HTTP GET path into a nix derivation that can be used as a flake input. Such a workaround provides the ability to emulate command line arguments in nix flakes.

In addtition to the web service there is a command line tool e (stands for escape/encode). The e helps with URL encoding.

Installation

Service

The service is already deployed at lficom.me

NixOS module

NixOS with flakes

Modify /etc/nixos/flake.nix as follows:

  # ...
  inputs = {
    # ...
    literal-flake-input.url = "github:yaitskov/literal-flake-input";
  };
  # ...
        modules = [
          literal-flake-input.nixosModules.${system}.default
          ({ ... }: {
            programs.literal-flake-input {
              enable = true;
              port = 3000;
          })
          ./configuration.nix
        ];
NixOS without flakes

  let
    lfi = builtins.fetchGit "htts://github.com/yaitskov/literal-flake-input.git?ref=master";
  in {
  imports =
    [ # ... ./hardware-configuration.nix
      "${lfi}/nixos/non-flake-lfi.nix"
    ];
  programs = {
    literal-flake-input = {
      port = 3000;
      enable = true;
    };
  };

How to use

The project flake is using itself. Another project using lfi is vpn-router.

Flake template

  # ...
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    utils.url = "github:numtide/flake-utils";
    c = {
      url = "https://lficom.me/name/Bill/";
      flake = false;
    };
  };
  outputs = { self, nixpkgs, utils, c }:
    utils.lib.eachDefaultSystem (sys:
      let
        pkgs = nixpkgs.legacyPackages.${sys};
        cnf = import c { inherit pkgs; };
      in
      {
        packages.hello =
          pkgs.writeShellScriptBin
            "hello"
            "echo Hello ${cnf.name}";
      });
  # ...

Overriding default values

nix build --override-input c \
  https://lficom.me/name/Bob/.tar

There is a commant line tool e, that helps with boilerplates and input validation:

nix build $(e -name Bob)

The tool supports literal keyword values (e.g. true and null), strings, numbers, arrays and attribute sets. String quotation is optional. All values are parsed and evaluated by e with nix to catch typos as soon as possible.

nix build $(e -an1 true \
              -an2 null \
              -an3 12 \
              -an4 hello world \
              -an5 [ 1 2 ] \
              -an6 "{x = 1; y = 2; }" \
              -an7 x: x + 1)

The above command generates an input link which is going to be resolved by the service into:

{...}: {
  an1 = true;
  an2 = null;
  an3 = 12;
  an4 = "hello wolrd";
  an5 = [1 2];
  an6 = {x = 1; y = 2; };
  an7 = x: x + 1;
}

If you copy an URL generated by e into a flake for default values, then drop .tar suffix.

Alternative URL prefix can be set via environment variable LFI_SITE.

Development environment

$ nix develop
$ emacs &
$ cabal build
$ cabal test
$ nix build
$ ./result/bin/literal-flake-input run
$ nix build $(./result/bin/e -static true)

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.4
Change log changelog.md
Dependencies base (>=4.7 && <5), binary (<1), ekg-core (<1), ekg-wai (<1), file-embed (<1), hnix (<1), http-types (<1), literal-flake-input, monad-logger (<1), optparse-applicative (<1), ref-tf (<1), regex-tdfa (<2), relude (>=1.2.2 && <2), tagged (<1), tar (<1), template-haskell (<3), time (<2), trace-embrace (<2), unliftio (<1), warp (<4), warp-tls (<4), wl-pprint-text (<2), yesod-core (<1.8) [details]
Tested with ghc ==9.12.2
License BSD-3-Clause
Copyright Daniil Iaitkov 2026
Author Daniil Iaitskov
Maintainer dyaitskov@gmail.com
Uploaded by DaniilIaitskov at 2026-02-14T09:54:53Z
Category System
Home page http://github.com/yaitskov/literal-flake-input
Bug tracker https://github.com/yaitskov/literal-flake-input/issues
Source repo head: git clone https://github.com/yaitskov/literal-flake-input.git
Distributions
Executables e, literal-flake-input
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]