Change how overlay is used and remove devshell from template
This commit is contained in:
parent
095a81b8c1
commit
62e5b34e5d
6 changed files with 92 additions and 133 deletions
31
flake.lock
generated
31
flake.lock
generated
|
@ -1,12 +1,15 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667077288,
|
||||
"narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -17,9 +20,10 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 0,
|
||||
"narHash": "sha256-3nD7iQXd/J6KjkT8IjozTuA5p8qjiLKTxvOUmH+AzNM=",
|
||||
"path": "/nix/store/ig0dn500x8lm7mjq8sp3s2k1hpji0xxj-source",
|
||||
"lastModified": 1701389149,
|
||||
"narHash": "sha256-rU1suTIEd5DGCaAXKW6yHoCfR1mnYjOXQFOaH7M23js=",
|
||||
"path": "/nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source",
|
||||
"rev": "5de0b32be6e85dc1a9404c75131316e4ffbc634c",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
|
@ -32,6 +36,21 @@
|
|||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
29
flake.nix
29
flake.nix
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
description = "tubslatex";
|
||||
description = "tubslatex-nix";
|
||||
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
|
@ -7,23 +7,30 @@
|
|||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
default = tubslatex;
|
||||
tubslatex = pkgs.tubslatex;
|
||||
tubslatex = pkgs.callPackage ./tubslatex.nix { };
|
||||
};
|
||||
|
||||
checks = {
|
||||
format = pkgs.runCommand "format" { buildInputs = [ pkgs.nixpkgs-fmt ]; } "nixpkgs-fmt --check ${./.} && touch $out";
|
||||
testOverlay = pkgs.mkShell {
|
||||
buildInputs = [ pkgs.texliveWithTubslatex ];
|
||||
shellHook = ''Shell created'';
|
||||
};
|
||||
testOverlay =
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [
|
||||
"tubslatex"
|
||||
];
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ pkgs.texliveWithTubslatex ];
|
||||
shellHook = ''Shell created'';
|
||||
};
|
||||
};
|
||||
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
@ -54,7 +61,7 @@
|
|||
default = thesis;
|
||||
thesis = {
|
||||
path = ./template;
|
||||
description = "Thesis template";
|
||||
description = "tubslatex-nix thesis template";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -9,7 +9,4 @@ thesis.pdf: thesis.tex
|
|||
latexmk -interaction=batchmode -pdf thesis.tex
|
||||
|
||||
watch:
|
||||
while true; do \
|
||||
inotifywait -qr -e modify -e create -e delete -e move *tex; \
|
||||
$(MAKE); \
|
||||
done
|
||||
latexmk -pvc -pdf thesis.tex
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
imports = [ "git/hooks" ]
|
||||
packages = [ "texliveWithTubslatex", "inotify-tools" ]
|
||||
|
||||
[devshell]
|
||||
name = "thesis"
|
||||
|
||||
[[commands]]
|
||||
name = "format"
|
||||
command = "nix fmt"
|
||||
help = "Formats the nix files"
|
||||
category = "development"
|
||||
|
||||
[[commands]]
|
||||
name = "update"
|
||||
command = "nix flake update --commit-lock-file"
|
||||
help = "Updates the dependencies"
|
||||
category = "development"
|
||||
|
||||
[[commands]]
|
||||
name = "check"
|
||||
command = "nix flake check"
|
||||
help = "Checks if this flake is valid"
|
||||
category = "development"
|
||||
|
||||
[[commands]]
|
||||
name = "build-thesis"
|
||||
command = "make thesis.pdf"
|
||||
category = "outputs"
|
||||
help = "Builds the thesis"
|
||||
|
||||
[[commands]]
|
||||
name = "clean"
|
||||
command = "make clean"
|
||||
category = "outputs"
|
||||
help = "Cleans the build directory"
|
||||
|
||||
[git.hooks]
|
||||
enable = true
|
||||
|
||||
[git.hooks.pre-commit]
|
||||
text = """
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACMR -- *.nix| sed -e 's| |\\ |g')
|
||||
[ -z "$FILES" ] && exit 0
|
||||
echo $FILES | xargs nix fmt
|
||||
echo $FILES | xargs git add
|
||||
exit 0"""
|
80
template/flake.lock
generated
80
template/flake.lock
generated
|
@ -2,30 +2,31 @@
|
|||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1678957337,
|
||||
"narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47",
|
||||
"type": "github"
|
||||
"lastModified": 1698410321,
|
||||
"narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=",
|
||||
"path": "/nix/store/nc201gqv1qiz6nw4ldh9xrz4k41dvkg5-source",
|
||||
"rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
"id": "devshell",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1642700792,
|
||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -35,24 +36,6 @@
|
|||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"locked": {
|
||||
"lastModified": 1667077288,
|
||||
"narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=",
|
||||
|
@ -85,10 +68,10 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681269223,
|
||||
"narHash": "sha256-i6OeI2f7qGvmLfD07l1Az5iBL+bFeP0RHixisWtpUGo=",
|
||||
"path": "/nix/store/dnj69agbi6dz7985gvcbmv40wk1skvmy-source",
|
||||
"rev": "87edbd74246ccdfa64503f334ed86fa04010bab9",
|
||||
"lastModified": 1701389149,
|
||||
"narHash": "sha256-rU1suTIEd5DGCaAXKW6yHoCfR1mnYjOXQFOaH7M23js=",
|
||||
"path": "/nix/store/gjd1iiwgwv7x29b21ng2dpysbgjp6kxr-source",
|
||||
"rev": "5de0b32be6e85dc1a9404c75131316e4ffbc634c",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
|
@ -111,7 +94,7 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"tubslatex": "tubslatex"
|
||||
}
|
||||
|
@ -131,17 +114,32 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"tubslatex": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681570146,
|
||||
"narHash": "sha256-+x5huf47ecM+FCjOWB7hka/DNHg81gxjL85qaTLUE/s=",
|
||||
"lastModified": 1681572214,
|
||||
"narHash": "sha256-YMbwKED+0PKsGP9XcGw392MG5OT0k/NsWKthn7xVvYQ=",
|
||||
"owner": "dadada",
|
||||
"repo": "tubslatex-nix",
|
||||
"rev": "f1b9082f4eddffdf579f5f0c61973b6aa21844d7",
|
||||
"rev": "095a81b8c163afd01cfa2af87920e1a4114dbde5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,41 +1,26 @@
|
|||
{
|
||||
description = "Thesis";
|
||||
inputs.flake-utils.url = github:numtide/flake-utils;
|
||||
inputs.devshell.url = github:numtide/devshell;
|
||||
inputs.tubslatex.url = "github:dadada/tubslatex-nix";
|
||||
|
||||
outputs = { self, flake-utils, nixpkgs, devshell, tubslatex }@inputs:
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
tubslatexOverlay = tubslatex.overlays.default;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ tubslatexOverlay ];
|
||||
# Allow use of tubslatex although it is under an unfree license
|
||||
config.allowUnfree = true;
|
||||
overlays = [ tubslatex.overlays.default ];
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.default =
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = [
|
||||
devshell.overlays.default
|
||||
tubslatexOverlay
|
||||
];
|
||||
};
|
||||
in
|
||||
pkgs.devshell.mkShell {
|
||||
imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
|
||||
};
|
||||
|
||||
checks = {
|
||||
format = pkgs.runCommand "format" { buildInputs = [ pkgs.nixpkgs-fmt ]; } "nixpkgs-fmt --check ${./.} && touch $out";
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [ pkgs.texliveWithTubslatex ];
|
||||
shellHook = ''
|
||||
echo 'Run `make` to build the thesis.pdf or `make watch` to continuously watch for changes.'
|
||||
'';
|
||||
};
|
||||
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
packages.default = pkgs.callPackage
|
||||
({ lib, texliveWithTubslatex, stdenvNoCC, ... }: stdenvNoCC.mkDerivation {
|
||||
pname = "thesis";
|
||||
|
@ -48,8 +33,7 @@
|
|||
cp thesis.pdf $out
|
||||
'';
|
||||
meta = with lib; {
|
||||
description = "Master thesis proposal";
|
||||
maintainers = [ "dadada" ];
|
||||
description = "Master thesis";
|
||||
platforms = platforms.all;
|
||||
license = licenses.proprietary;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue