Skip to content

Commit

Permalink
feat: include in Justfile generation
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Oct 16, 2023
1 parent d42b26a commit 0c5dd9e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .config/flakebox/id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7d46a5d09b677bf4fa6b615add26f532346ddc11c93cdb6e36a1f3e420cf57ba5eca7f90f9eecd5398085100b76e3ebffbec1ddca58371489d2c74ee9df7f83e
9b50de84d7163e218869f1d1952621ad514c3a239ad7e9d4b75da9f9ffaaa8440a5c064eff9c447d9c9ea09a78edd8ce03787c53117795cc419e6299b61fd22e
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@
(final: prev: {
rblake2sum = pkgs-unstable.rblake2sum;

just = pkgs-unstable.just.overrideAttrs (prev: rec {
pname = "just";
version = "1.15.0";

src = pkgs-unstable.fetchFromGitHub {
owner = "casey";
repo = "just";
rev = "refs/tags/${version}";
hash = "sha256-r1YJ7L98aLAwBd3g+WlW/UijceR7t9z7aXSZZjlMNnM=";
};

cargoHash = "sha256-Fx2BdSHo+W43ZM/SX1ccddXG9QHlftrupT2cbyT4KM0=";
cargoDeps = prev.cargoDeps.overrideAttrs (prevDeps: {
name = "${pname}-vendor.tar.gz";
inherit src;
outputHash = "sha256-h8l4af/FMsOSqBf1V1tbniS6r1dQos7JM1215o1pmTA=";
});
});

# TODO: waiting for nixpkgs to have https://github.com/crate-ci/typos/commit/35a8bc67870d6c0b7407683319ae175577e24261
typos = pkgs-unstable.rustPlatform.buildRustPackage {
pname = "typos";
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION

alias b := build
alias c := check
alias t := test
Expand Down
2 changes: 2 additions & 0 deletions lib/mkDevShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ let
pkgs.darwin.apple_sdk.frameworks.Security
];

JUST_UNSTABLE = "true";

shellHook = ''
# set the root dir
git_root="$(git rev-parse --show-toplevel)"
Expand Down
13 changes: 13 additions & 0 deletions lib/modules/just.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ in
default = true;
};

includePaths = lib.mkOption {
type = types.listOf types.str;
default = [ ];
description = lib.mdDoc "List of files to generate `include ...` statement for (as a strings in `include` Justfile directive)";
};

rules = lib.mkOption {
type = types.attrsOf (types.submodule
({ config, options, ... }: {
Expand Down Expand Up @@ -159,10 +165,17 @@ in
content = pathDeref v.content;
})
config.just.rules))));

includes_content = builtins.concatStringsSep "\n" (map
(pathStr: ''
!include ${pathStr}
'')
config.just.includePaths);
in
{
source = pkgs.writeText "flakebox-justfile" ''
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
${includes_content}
${raw_content}
# THIS FILE IS AUTOGENERATED FROM FLAKEBOX CONFIGURATION
'';
Expand Down

0 comments on commit 0c5dd9e

Please sign in to comment.