-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathflake.nix
50 lines (44 loc) · 1.63 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
description = "F-klubben sangbog";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
deps = with pkgs; [ ghostscript texliveFull psutils gnumake which perl ];
booklet = pkgs.stdenv.mkDerivation rec {
name = "F-klubbens sangbog booklet";
src = ./.;
nativeBuildInputs = deps;
installPhase = ''
mkdir -p $out/{bin,share}
${pkgs.gnumake}/bin/make booklet
mv main_book.pdf $out/share
echo "${pkgs.xdg-utils}/bin/xdg-open $out/share/main_book.pdf" > $out/bin/${builtins.replaceStrings [" "] ["-"] name}
chmod +x $out/bin/${builtins.replaceStrings [" "] ["-"] name}
'';
};
pdf = pkgs.stdenv.mkDerivation rec{
name = "F-klubbens sangbog continuous";
src = ./.;
nativeBuildInputs = deps;
installPhase = ''
mkdir -p $out/{bin,share}
${pkgs.gnumake}/bin/make pdf
mv main.pdf $out/share
echo "${pkgs.xdg-utils}/bin/xdg-open $out/share/main.pdf" > $out/bin/${builtins.replaceStrings [" "] ["-"] name}
chmod +x $out/bin/${builtins.replaceStrings [" "] ["-"] name}
'';
};
in {
devShells.${system}.default = pkgs.mkShell {
packages = deps;
};
packages.${system} = {
default = booklet;
pdf = pdf;
booklet = booklet;
};
};
}