Skip to content

Commit adbef3b

Browse files
committed
Make toolbox installable with a flake template.
1 parent 0bd98ac commit adbef3b

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.nix/shellHook.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ genNixActions (){
180180
addNixCommand genNixActions
181181

182182
initNixConfig (){
183-
Orig=$toolboxDir/template-config.nix
183+
Orig=$toolboxDir/template/.nix/config.nix
184184
F=$configDir/config.nix;
185185
if [[ -f $F ]]; then
186186
echo "$F already exists"
187187
else if [[ -n "$1" ]]; then
188188
mkdir -p $configDir
189189
cat $Orig > $F
190-
sed -i "s/template/$1/" $F
190+
sed -i "s/YOUR_PACKAGE_NAME/$1/" $F
191191
else echo "usage: initNixConfig pname"
192192
fi
193193
fi

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
}
4444
);
4545
};
46+
templates.default = {
47+
path = ./template;
48+
description = "Initialize the Rocq Nix Toolbox in a new project";
49+
};
4650
packages = lib.allPackages ./.;
4751
};
4852
}

template-config.nix renamed to template/.nix/config.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
## either using nixpkgs data or the overlays located in `.nix/rocq-overlays`
99
## and `.nix/coq-overlays`
1010
## Will determine the default main-job of the bundles defined below
11-
attribute = "template";
11+
attribute = "YOUR_PACKAGE_NAME";
1212

1313
## The attribute for coq compat shim, default to attribute
1414
## set this when you need both to differ
1515
## (for instance "rocq-elpi" and "coq-elpi")
16-
# coq-attribute = "template";
16+
# coq-attribute = "YOUR_PACKAGE_NAME";
1717

1818
## Set this when the package has no rocqPackages version yet
1919
## (either in nixpkgs or in .nix/rocq-overlays)

template/flake.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
description = "A Nix flake for my Rocq project using the Rocq Nix Toolbox";
3+
inputs = {
4+
rocq-nix-toolbox.url = "github:rocq-community/coq-nix-toolbox";
5+
};
6+
outputs =
7+
{ rocq-nix-toolbox, ... }:
8+
{
9+
packages = rocq-nix-toolbox.lib.allPackages ./.;
10+
};
11+
}

0 commit comments

Comments
 (0)