Browse Source

Merge pull request #85 from chfanghr/build-with-nix

Build with Nix
Mark Szepieniec 2 years ago
parent
commit
de279700f4
5 changed files with 67 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 10 0
      README.md
  3. 26 0
      flake.lock
  4. 24 0
      flake.nix
  5. 3 0
      shell.nix

+ 4 - 0
.gitignore

@@ -2,3 +2,7 @@
 *.swo
 *.swp
 output/
+result
+result-*
+.envrc
+.direnv

+ 10 - 0
README.md

@@ -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

+ 26 - 0
flake.lock

@@ -0,0 +1,26 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1655269044,
+        "narHash": "sha256-VscxTckDD3wSdXsJxkOrdtDo4h4nVD5GutWQmD2uMlM=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "81ccb11016c0e333f6158ec6af965a47c37e5055",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}

+ 24 - 0
flake.nix

@@ -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 - 0
shell.nix

@@ -0,0 +1,3 @@
+{ pkgs ? import <nixpkgs> { } }:
+with pkgs;
+mkShell { buildInputs = [ pandoc texlive.combined.scheme-context gnumake ]; }