about summary refs log tree commit diff
path: root/users/fcuny/resume
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-07 18:18:35 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-08 14:55:09 -0700
commit37bc4248220fe94d47772f974d80c58fc375bb16 (patch)
treeaf1869555c8844efc41afab75d8491b33d2596f2 /users/fcuny/resume
parentdrone: add configuration (diff)
downloadworld-37bc4248220fe94d47772f974d80c58fc375bb16.tar.gz
simplify the build
Running `nix build` is enough to generate the file `resume.html`. It
will be created in the `result` directory automatically.

The configuration for the build is also updated to run `nix build`
Diffstat (limited to 'users/fcuny/resume')
-rw-r--r--users/fcuny/resume/.drone.yml3
-rw-r--r--users/fcuny/resume/.gitignore1
-rw-r--r--users/fcuny/resume/flake.lock16
-rw-r--r--users/fcuny/resume/flake.nix37
4 files changed, 41 insertions, 16 deletions
diff --git a/users/fcuny/resume/.drone.yml b/users/fcuny/resume/.drone.yml
index 9639cb1..0cffea5 100644
--- a/users/fcuny/resume/.drone.yml
+++ b/users/fcuny/resume/.drone.yml
@@ -5,4 +5,5 @@ name: default
 steps:
 - name: build
   commands:
-    - nix run .#publishHTML
+    - nix build
+    - ls -l result/
diff --git a/users/fcuny/resume/.gitignore b/users/fcuny/resume/.gitignore
index 813f87f..b61158c 100644
--- a/users/fcuny/resume/.gitignore
+++ b/users/fcuny/resume/.gitignore
@@ -1 +1,2 @@
 /resume.html
+/result
diff --git a/users/fcuny/resume/flake.lock b/users/fcuny/resume/flake.lock
index 415fb11..4e3cc98 100644
--- a/users/fcuny/resume/flake.lock
+++ b/users/fcuny/resume/flake.lock
@@ -1,5 +1,20 @@
 {
   "nodes": {
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1649676176,
+        "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1651421973,
@@ -17,6 +32,7 @@
     },
     "root": {
       "inputs": {
+        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
     }
diff --git a/users/fcuny/resume/flake.nix b/users/fcuny/resume/flake.nix
index 476a981..fbb2755 100644
--- a/users/fcuny/resume/flake.nix
+++ b/users/fcuny/resume/flake.nix
@@ -1,20 +1,27 @@
 {
   description = "Franck Cuny's resume";
-  inputs = { nixpkgs.url = "github:nixos/nixpkgs"; };
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
 
-  outputs = { self, nixpkgs }:
-    let pkgs = nixpkgs.legacyPackages.x86_64-linux;
-    in {
-      defaultApp.x86_64-linux = self.publishHTML;
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let pkgs = nixpkgs.legacyPackages.${system};
+      in {
+        defaultPackage = pkgs.stdenv.mkDerivation {
+          name = "resume";
+          buildInputs = with pkgs; [ pandoc ];
+          src = ./.;
+          buildPhase = ''
+            pandoc --self-contained --css styles/resume.css --from org --to html --output resume.html readme.org
+          '';
 
-      # run with `nix run .#publishHTML`
-      publishHTML = pkgs.writers.writeBashBin "html" ''
-        set -e
-        set -o pipefail
-        pandoc --self-contained --css styles/resume.css --from org --to html --output resume.html readme.org
-      '';
-
-      devShell.x86_64-linux =
-        pkgs.mkShell { buildInputs = with pkgs; [ git pandoc ]; };
-    };
+          installPhase = ''
+            mkdir -p $out
+            cp resume.html $out/
+          '';
+        };
+        devShell = pkgs.mkShell { buildInputs = with pkgs; [ git pandoc ]; };
+      });
 }