Skip to content

Commit a698b2d

Browse files
committed
flake.nix: init
1 parent 08041cc commit a698b2d

File tree

5 files changed

+151
-74
lines changed

5 files changed

+151
-74
lines changed

default.nix

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
{ nixpkgs ? import (import ./pkgs.nix).nixpkgs {} }:
2-
let
3-
inherit (nixpkgs) pkgs;
4-
inherit (pkgs) lib;
5-
tex = pkgs.texlive.combine {
6-
inherit (pkgs.texlive) scheme-basic booktabs ec lm preprint titling xcolor;
7-
};
8-
filter = ls: src: name: type: let
9-
relPath = lib.removePrefix (toString src + "/") (toString name);
10-
in lib.cleanSourceFilter name type && (builtins.any (lib.flip lib.hasPrefix relPath) ls);
11-
src = builtins.filterSource (filter [ "resume.md" "templates" ] ./.) ./.;
12-
in rec {
13-
html = pkgs.runCommand "html" {
14-
inherit src;
15-
buildInputs = [ pkgs.haskellPackages.pandoc-cli ];
16-
} ''
17-
mkdir -p $out
18-
pandoc $src/resume.md -s -H $src/templates/header.css -A $src/templates/tracking.html -t html -o $out/index.html
19-
'';
20-
pdf = pkgs.runCommand "pdf" {
21-
inherit src;
22-
buildInputs = [ pkgs.haskellPackages.pandoc-cli tex ];
23-
} ''
24-
mkdir -p $out
25-
pandoc $src/resume.md -H $src/templates/header.tex -o $out/Vaibhav_Sagar_resume.pdf
26-
'';
27-
readme = pkgs.runCommand "readme" {
28-
inherit src;
29-
buildInputs = [ pkgs.haskellPackages.pandoc-cli ];
30-
} ''
31-
mkdir -p $out
32-
pandoc $src/resume.md -t gfm -o $out/readme.md
33-
'';
34-
travis = pkgs.buildEnv {
35-
name = "travis";
36-
paths = [ html readme ];
37-
};
38-
}
1+
(import
2+
(
3+
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
4+
fetchTarball {
5+
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
6+
sha256 = lock.nodes.flake-compat.locked.narHash;
7+
}
8+
)
9+
{ src = ./.; }
10+
).defaultNix

flake.lock

Lines changed: 93 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
3+
inputs.flake-utils.url = "github:numtide/flake-utils";
4+
inputs.nix-filter.url = "github:numtide/nix-filter";
5+
inputs.flake-compat.url = "github:edolstra/flake-compat";
6+
7+
outputs = {self, nixpkgs, flake-utils, nix-filter, ...}:
8+
flake-utils.lib.eachDefaultSystem (system: let
9+
pkgs = import nixpkgs { inherit system; };
10+
inherit (pkgs) lib;
11+
src = nix-filter {
12+
root = ./.;
13+
include = [ "resume.md" "templates"];
14+
};
15+
tex = pkgs.texlive.combine {
16+
inherit (pkgs.texlive) scheme-basic booktabs ec lm preprint titling xcolor;
17+
};
18+
in {
19+
packages = rec {
20+
html = pkgs.runCommand "html" {
21+
inherit src;
22+
buildInputs = [ pkgs.haskellPackages.pandoc-cli ];
23+
} ''
24+
mkdir -p $out
25+
pandoc $src/resume.md -s -H $src/templates/header.css -A $src/templates/tracking.html -t html -o $out/index.html
26+
'';
27+
pdf = pkgs.runCommand "pdf" {
28+
inherit src;
29+
buildInputs = [ pkgs.haskellPackages.pandoc-cli tex ];
30+
} ''
31+
mkdir -p $out
32+
pandoc $src/resume.md -H $src/templates/header.tex -o $out/Vaibhav_Sagar_resume.pdf
33+
'';
34+
readme = pkgs.runCommand "readme" {
35+
inherit src;
36+
buildInputs = [ pkgs.haskellPackages.pandoc-cli ];
37+
} ''
38+
mkdir -p $out
39+
pandoc $src/resume.md -t gfm -o $out/readme.md
40+
'';
41+
ci = pkgs.buildEnv {
42+
name = "ci";
43+
paths = [ html readme ];
44+
};
45+
};
46+
defaultPackage = self.packages.${system}.ci;
47+
});
48+
}

pkgs.nix

Lines changed: 0 additions & 10 deletions
This file was deleted.

updater

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)