From 217cddfa96b6fd0ec9df71f8de53f507bc831776 Mon Sep 17 00:00:00 2001 From: "Robert K. Bell" Date: Sat, 27 Jul 2024 21:20:39 +1000 Subject: [PATCH] build: tidy up the root folder a little --- .envrc | 5 ++--- .gitattributes | 3 +++ flake.nix | 9 ++++----- default.nix => nix/default.nix | 7 ++++--- elm-srcs.nix => nix/elm/elm-srcs.nix | 0 registry.dat => nix/elm/registry.dat | Bin 137952 -> 138893 bytes shell.nix => nix/shell.nix | 18 +++++++++++------- versions.dat | 0 8 files changed, 24 insertions(+), 18 deletions(-) rename default.nix => nix/default.nix (89%) rename elm-srcs.nix => nix/elm/elm-srcs.nix (100%) rename registry.dat => nix/elm/registry.dat (88%) rename shell.nix => nix/shell.nix (63%) delete mode 100644 versions.dat 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 91839abc383646d5c5414720defaf38cf79c9ba3..d07a53ee2e3632a0b096048f02e290cbb25b7e8d 100644 GIT binary patch delta 1591 zcmYLJU1%It6h7z9oz2Yd&i?PF+hnl`w$V0I6G}^pC{lj{twe2o&Ce6r=@3P*=TJD5xkDDH1#AErKo9C-Y(jEhrT8VDVM+U=>>H-QCRedzqgzbIy0Z z@0`2(rSj%CN(Q=kBC2@+uiBxVdj_V=lYp1_0w$E?9 zla(NRDM5+KQKNqUNP$pz3H01e_UKF+c#a^ zZCSc!*uLYnf80`NUzyZ`k0*CZskA_}(>q$MxP>DW$Ydw9%^jmhU)qc5+p4;Kgf`?Xz9Q!$gT^X*a5&ii&nS%~$`OhzyAKQPF-Z z6o&FMV>qQ2qB4*m6nf(D)!o=s`%6`4# z=Pbs%Ghn#2Rx@-#REfgrdtrUnaclQFLu7v+#Q@Q`+OtCJkJQwhrRL5D7tu#J@MNOb6q2XVIK)&F$E^iyk)`b&Qe` zU90IwI`XSa_==Jp3`xSs0FVJdw)YgiRS@>9Bd-8H| zDe$q=cp{Ta*p^;%bVsjQcB(^vi9I$dn*Qv4oRFejLN3?P4jkoRP^{}ary+kIp}oJJv3kwfeqA6Cfa F-2bytLjeE) delta 808 zcmYLHOK4L;6rD5gz2v=2@|tf=tn{Z=t47p{C~DEz8nqP!L5zz^KY~~*Eh-d)idYJQ ziWthHi-HJ(3m4TvZa4mluA){DT4sqHIcG^g<7?q!o@8gKbor9^goVZt`S&GQz zyUDF)E|a&ND+xs9nfx+cn93{j%ZF2ILP9eX-;!dw&hWYJJ#s@~9M04(QesX(U{4>oK541QOA1hwW!d7{akpUY$WJ>8qIT^U>Cl) z5irB4?8Xk^cSEajPIhCkOz@J~gM?10gYa-+F{Kx$J%`Y$f#)84h?4BXD$O~21Tm-B zkBNX1{bvtU96+x{SF^~PqRQRcLTC99E(y~ugz51RHtRkWCJRvQIh+X6{ZXvd)CY0e z#}JPk?deT+9XQshX-dkXrZGH=Qo}7wRZwCQy5ITr1aWG9imXAepCc1+Bhsm58W~t> snkKsO7P~_(j*<9=nUJqab#I`b1|KPB%$+g8>%`xkmyVaF1iu^p13*HODF6Tf 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