Skip to content

Commit

Permalink
Merge pull request mszep#85 from chfanghr/build-with-nix
Browse files Browse the repository at this point in the history
Build with Nix
  • Loading branch information
mszep authored Sep 1, 2022
2 parents 343e354 + db16bcd commit de27970
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
*.swo
*.swp
output/
result
result-*
.envrc
.direnv
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ Make sure to add the directory `/Library/TeX/texbin/` to your path or `context`
export PATH=$PATH:/Library/TeX/texbin/
```

#### Nix

Make sure to enable flakes, see [this](https://nixos.wiki/wiki/Flakes).

```bash
nix build
```

The built resume will end up in `./result`.

### Troubleshooting

#### Get versions
Expand Down
26 changes: 26 additions & 0 deletions flake.lock

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

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
inputs = { nixpkgs.url = "github:nixos/nixpkgs"; };

outputs = { self, nixpkgs }:
let
supportedSystems = nixpkgs.lib.systems.flakeExposed;
perSystem = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = system: import nixpkgs { inherit system; };

buildResumeFor = system:
let pkgs = pkgsFor system;
in pkgs.runCommand "build-resume" {
nativeBuildInputs = with pkgs; [ pandoc texlive.combined.scheme-context ];
} ''
cd ${self}
make OUT_DIR="$out"
'';
in {
packages.resume = perSystem (system: buildResumeFor system);
devShell =
perSystem (system: import ./shell.nix { pkgs = pkgsFor system; });
defaultPackage = perSystem (system: self.packages.resume.${system});
};
}
3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell { buildInputs = [ pandoc texlive.combined.scheme-context gnumake ]; }

0 comments on commit de27970

Please sign in to comment.