diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b42106 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv/ diff --git a/dhallToNix.nix b/dhallToNix.nix index d043238..384017a 100644 --- a/dhallToNix.nix +++ b/dhallToNix.nix @@ -1,7 +1,9 @@ -{ pkgs ? import {} }: code: -let +{pkgs ? import {}}: code: let codeString = builtins.toString code; - file = if builtins.isPath code then code else builtins.toFile "dhall-expr" codeString; + file = + if builtins.isPath code + then code + else builtins.toFile "dhall-expr" codeString; drv = pkgs.stdenvNoCC.mkDerivation { name = "dhall-expr-as-nix"; src = ./.; @@ -10,6 +12,7 @@ let dhall-to-nix < ${file} > $out ''; - nativeBuildInputs = [ pkgs.dhall-nix ]; + nativeBuildInputs = [pkgs.dhall-nix]; }; -in import "${drv}" (import ./runtime.nix) +in + import "${drv}" (import ./runtime.nix) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..084921b --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "dhall-haskell": { + "flake": false, + "locked": { + "lastModified": 1662555889, + "narHash": "sha256-+MUDk6Wa3KaVaVBH0u4esfV9h9fYSuGuEaNXSmep1vI=", + "ref": "nix-hotfix", + "rev": "452fd3adabca14e4ec9ff80eee9b6f84489902e5", + "revCount": 1918, + "submodules": true, + "type": "git", + "url": "https://github.com/darkkirb/dhall-haskell" + }, + "original": { + "ref": "nix-hotfix", + "submodules": true, + "type": "git", + "url": "https://github.com/darkkirb/dhall-haskell" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1662556621, + "narHash": "sha256-9K/E3k261ksOje0SsSug2AiykuEwu8BaLgHFhTHr3+w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c66b76594310df647f99a653e98e8e59e842d0c6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dhall-haskell": "dhall-haskell", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ccbce47 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + dhall-haskell = { + url = "https://github.com/darkkirb/dhall-haskell"; + flake = false; + type = "git"; + submodules = true; + ref = "nix-hotfix"; + }; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + dhall-haskell, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system; overlays = [ self.overlays.${system}.default ];}; + in { + formatter = pkgs.alejandra; + packages = rec { + inherit (import "${dhall-haskell}/nix/shared.nix" { inherit system; }) dhall dhall-nix; + }; + overlays.default = (_: _: self.packages.${system}); + devShells.default = pkgs.mkShell { + nativeBuildInputs = [ self.packages.${system}.dhall self.packages.${system}.dhall-nix]; + }; + lib.dhallToNix = import ./dhallToNix.nix {inherit pkgs;}; + }); +}