diff --git a/.envrc b/.envrc index 51410ba..ef7c6ab 100644 --- a/.envrc +++ b/.envrc @@ -1,6 +1,5 @@ # https://nixos.wiki/wiki/Flakes#Direnv_integration -watch_file flake.nix -watch_file flake.lock -watch_file shell.nix +strict_env +watch_file flake.{nix,lock} nix/shell.nix use flake diff --git a/.gitattributes b/.gitattributes index 30c7db1..327e147 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,4 @@ *.sh text eof=lf + +# Tell tools that these files weren't written by hand. +nix/elm/** linguist-generated=true diff --git a/flake.nix b/flake.nix index 039c41d..2a75e8d 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,7 @@ (fileset.fileFilter (file: file.hasExt "elm") ./.) ./dist ./elm.json - ./registry.dat - ./versions.dat + ./nix/elm/registry.dat ]; }; @@ -38,7 +37,7 @@ jq . --sort-keys < ${ pkgs.writeText "elmSrcsNixFlattened.json" (builtins.toJSON (builtins.mapAttrs (k: value: value.version) - (import ./elm-srcs.nix))) + (import ./nix/elm/elm-srcs.nix))) } > flat-nix-deps.json if diff flat-elm-deps.json flat-nix-deps.json; then @@ -55,7 +54,7 @@ ''; }; - elm2nix = import ./default.nix { inherit pkgs minimalElmSrc; }; + elm2nix = import ./nix/default.nix { inherit pkgs minimalElmSrc; }; built = stdenv.mkDerivation { name = "tulars"; @@ -99,7 +98,7 @@ }; }; checks = { inherit built failIfDepsOutOfSync; }; - devShells.default = import ./shell.nix { inherit pkgs; }; + devShells.default = import ./nix/shell.nix { inherit pkgs; }; apps.default = { type = "app"; program = "${pkgs.writeScript "tularsApp" '' diff --git a/default.nix b/nix/default.nix similarity index 89% rename from default.nix rename to nix/default.nix index edb99b4..e37f52a 100644 --- a/default.nix +++ b/nix/default.nix @@ -8,8 +8,9 @@ with pkgs; let - mkDerivation = { srcs ? ./elm-srcs.nix, src, name, srcdir ? "./src" - , targets ? [ ], registryDat ? ./registry.dat, outputJavaScript ? false }: + mkDerivation = { srcs ? ./elm/elm-srcs.nix, src, name, srcdir ? "../src" + , targets ? [ ], registryDat ? ./elm/registry.dat, outputJavaScript ? false + }: stdenv.mkDerivation { inherit name src; @@ -43,7 +44,7 @@ let }; in mkDerivation { name = "tulars-elm2nix-0.1.0"; - srcs = ./elm-srcs.nix; + srcs = ./elm/elm-srcs.nix; src = minimalElmSrc; targets = [ "Main" ]; srcdir = "./app"; diff --git a/elm-srcs.nix b/nix/elm/elm-srcs.nix similarity index 100% rename from elm-srcs.nix rename to nix/elm/elm-srcs.nix diff --git a/registry.dat b/nix/elm/registry.dat similarity index 88% rename from registry.dat rename to nix/elm/registry.dat index 91839ab..d07a53e 100644 Binary files a/registry.dat and b/nix/elm/registry.dat differ diff --git a/shell.nix b/nix/shell.nix similarity index 63% rename from shell.nix rename to nix/shell.nix index b7e4cb0..43fa9f7 100644 --- a/shell.nix +++ b/nix/shell.nix @@ -3,12 +3,16 @@ let updateElmNixDeps = pkgs.writeScriptBin "update-elm-nix-deps" '' set -e cd "$(git rev-parse --show-toplevel)" - elm2nix convert > elm-srcs.nix - # "Snapshot only outputs any data when redirected to the registry.dat file" - # - elm2nix snapshot > registry.dat - nixfmt elm-srcs.nix - echo elm-srcs.nix has been updated. + echo working in "$(realpath $PWD)" + + echo creating registry snapshot at "$(realpath ./nix/elm/registry.dat)" + elm2nix snapshot + mv -f ./registry.dat ./nix/elm/registry.dat + + echo "Generating Nix expressions from elm.json..." + elm2nix convert > ./nix/elm/elm-srcs.nix + nixfmt ./nix/elm/elm-srcs.nix + echo $(realpath ./nix/elm/elm-srcs.nix) has been updated. ''; in pkgs.mkShell { name = "tulars"; @@ -31,7 +35,7 @@ in pkgs.mkShell { shellHook = '' export CYPRESS_INSTALL_BINARY=0 export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress - export PATH=$PATH:${toString ./node_modules/.bin} + export PATH=$PATH:${toString ../node_modules/.bin} echo "" echo "This is the dev shell for the Tulars project. Coming Soon: Run 'tu --help' to see available commands." diff --git a/versions.dat b/versions.dat deleted file mode 100644 index e69de29..0000000