Compare commits

...

5 commits

Author SHA1 Message Date
Bryan Bennett
e513b6e6a6
Update flake.lock 2024-03-25 07:30:51 -04:00
Bryan Bennett
b19f5d67c5
Add very basic .build.yml 2024-03-25 07:29:29 -04:00
Bryan Bennett
a2fff9333f
Strip and pack final binary 2024-03-23 08:17:20 -04:00
Bryan Bennett
358ae864fc
Fix depends specification 2024-03-23 08:16:51 -04:00
Bryan Bennett
606d717276
Fix error message if failing to hash file 2024-03-23 07:15:16 -04:00
5 changed files with 60 additions and 40 deletions

8
.build.yml Normal file
View file

@ -0,0 +1,8 @@
image: nixos/unstable
environment:
NIX_CONFIG: "experimental-features = nix-command flakes"
packages:
- cachix
tasks:
-build: |
nix build . -vL --no-out-link

View file

@ -16,7 +16,7 @@ let main = () => {
switch (Util.hash_files(paths)) { switch (Util.hash_files(paths)) {
| Ok(hsh) => hsh | Ok(hsh) => hsh
| Error(msg) => | Error(msg) =>
Printf.eprintf("%s\n", e); Printf.eprintf("%s\n", msg);
exit(1); exit(1);
}; };

View file

@ -1,4 +1,5 @@
{ alcotest { alcotest
, bintools
, bisect_ppx , bisect_ppx
, buildDunePackage , buildDunePackage
, core , core
@ -13,6 +14,7 @@
, re , re
, reason , reason
, sha , sha
, upx
, ,
}: }:
buildDunePackage { buildDunePackage {
@ -30,7 +32,6 @@ buildDunePackage {
./flake.lock ./flake.lock
./flake_env.opam ./flake_env.opam
./direnvrc ./direnvrc
./LICENSE
]; ];
}; };
duneVersion = "3"; duneVersion = "3";
@ -40,11 +41,20 @@ buildDunePackage {
substituteInPlace tests/spit*.sh --replace "/usr/bin/env" "${coreutils}/bin/env" substituteInPlace tests/spit*.sh --replace "/usr/bin/env" "${coreutils}/bin/env"
''; '';
postInstall = '' postInstall = ''
${bintools}/bin/strip --strip-unneeded $out/bin/flake_env
${upx}/bin/upx $out/bin/flake_env
install -m400 -D direnvrc $out/share/flake_env/direnvrc install -m400 -D direnvrc $out/share/flake_env/direnvrc
''; '';
buildInputs = [
core
core_unix
ppx_yojson_conv
ppx_yojson_conv_lib
re
sha
];
checkInputs = [ alcotest bisect_ppx ]; checkInputs = [ alcotest bisect_ppx ];
nativeBuildInputs = [ reason ]; nativeBuildInputs = [ reason ];
propagatedBuildInputs = [ core core_unix findlib ocaml ppx_yojson_conv ppx_yojson_conv_lib re sha ];
meta = with lib; { meta = with lib; {
description = "Yet another flake plugin for direnv"; description = "Yet another flake plugin for direnv";

48
flake.lock generated
View file

@ -23,11 +23,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1701473968, "lastModified": 1709336216,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,11 +41,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1710146030,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -62,11 +62,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703887061, "lastModified": 1709087332,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "gitignore.nix", "repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -77,11 +77,11 @@
}, },
"nix-filter": { "nix-filter": {
"locked": { "locked": {
"lastModified": 1701697642, "lastModified": 1710156097,
"narHash": "sha256-L217WytWZHSY8GW9Gx1A64OnNctbuDbfslaTEofXXRw=", "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
"owner": "numtide", "owner": "numtide",
"repo": "nix-filter", "repo": "nix-filter",
"rev": "c843418ecfd0344ecb85844b082ff5675e02c443", "rev": "3342559a24e85fc164b295c3444e8a139924675b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -92,11 +92,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1702272962, "lastModified": 1711106783,
"narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=", "narHash": "sha256-PDwAcHahc6hEimyrgGmFdft75gmLrJOZ0txX7lFqq+I=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d", "rev": "a3ed7406349a9335cb4c2a71369b697cecd9d351",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -108,11 +108,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1704874635, "lastModified": 1710695816,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", "rev": "614b4613980a522ba49f0d194531beddbb7220d3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -124,11 +124,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1704842529, "lastModified": 1710765496,
"narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=", "narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5", "rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -147,11 +147,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1705229514, "lastModified": 1710923068,
"narHash": "sha256-itILy0zimR/iyUGq5Dgg0fiW8plRDyxF153LWGsg3Cw=", "narHash": "sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI+JMJuLo45aG3cKc=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "ffa9a5b90b0acfaa03b1533b83eaf5dead819a05", "rev": "e611897ddfdde3ed3eaac4758635d7177ff78673",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -39,19 +39,21 @@
}; };
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ]; inputsFrom = [ self'.packages.default ];
packages = [ packages = builtins.attrValues {
pkgs.just inherit (pkgs)
pkgs.rnix-lsp just
pkgs.pre-commit nil
pkgs.ocamlPackages.alcotest pre-commit
pkgs.ocamlPackages.bisect_ppx ;
pkgs.ocamlPackages.dune_3 inherit (pkgs.ocamlPackages)
pkgs.ocamlPackages.findlib dune_3
pkgs.ocamlPackages.ocaml findlib
pkgs.ocamlPackages.ocaml-lsp ocaml
pkgs.ocamlPackages.ocamlformat ocaml-lsp
pkgs.ocamlPackages.ocamlformat-rpc-lib ocamlformat
]; ocamlformat-rpc-lib
;
};
shellHook = config.pre-commit.installationScript; shellHook = config.pre-commit.installationScript;
}; };
pre-commit = { pre-commit = {