From 37bc4248220fe94d47772f974d80c58fc375bb16 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 7 May 2022 18:18:35 -0700 Subject: 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` --- users/fcuny/resume/.drone.yml | 3 ++- users/fcuny/resume/.gitignore | 1 + users/fcuny/resume/flake.lock | 16 ++++++++++++++++ users/fcuny/resume/flake.nix | 37 ++++++++++++++++++++++--------------- 4 files changed, 41 insertions(+), 16 deletions(-) (limited to 'users/fcuny') 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 ]; }; + }); } -- cgit 1.4.1