From 5d2935617a0e4bf615a8ffc0f7c1f96d9479cbd8 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 30 Oct 2022 14:28:47 -0400 Subject: use flake-compat builds Signed-off-by: Xe Iaso --- default.nix | 67 +++++++++---------------------------------------------------- flake.lock | 17 ++++++++++++++++ flake.nix | 6 +++++- 3 files changed, 32 insertions(+), 58 deletions(-) diff --git a/default.nix b/default.nix index 5ce17c1..2cccff2 100644 --- a/default.nix +++ b/default.nix @@ -1,57 +1,10 @@ -{ sources ? import ./nix/sources.nix, pkgs ? import sources.nixpkgs { } }: -with pkgs; - -let - rust = pkgs.callPackage ./nix/rust.nix { }; - - srcNoTarget = dir: - builtins.filterSource - (path: type: type != "directory" || builtins.baseNameOf path != "target") - dir; - - naersk = pkgs.callPackage sources.naersk { - rustc = rust; - cargo = rust; - }; - dhallpkgs = import sources.easy-dhall-nix { inherit pkgs; }; - src = srcNoTarget ./.; - - xesite = naersk.buildPackage { - inherit src; - doCheck = true; - buildInputs = [ pkg-config openssl git ]; - remapPathPrefix = true; - }; - - config = stdenv.mkDerivation { - pname = "xesite-config"; - version = "HEAD"; - buildInputs = [ pkgs.dhall ]; - - phases = "installPhase"; - - installPhase = '' - cd ${src} - dhall resolve < ${src}/config.dhall >> $out - ''; - }; - -in pkgs.stdenv.mkDerivation { - inherit (xesite) name; - inherit src; - phases = "installPhase"; - - installPhase = '' - mkdir -p $out $out/bin - - cp -rf ${config} $out/config.dhall - cp -rf $src/blog $out/blog - cp -rf $src/css $out/css - cp -rf $src/data $out/data - cp -rf $src/gallery $out/gallery - cp -rf $src/static $out/static - cp -rf $src/talks $out/talks - - cp -rf ${xesite}/bin/xesite $out/bin/xesite - ''; -} +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; } +).defaultNix diff --git a/flake.lock b/flake.lock index d905819..eec5d41 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1659877975, @@ -64,6 +80,7 @@ }, "root": { "inputs": { + "flake-compat": "flake-compat", "flake-utils": "flake-utils", "naersk": "naersk", "nixpkgs": "nixpkgs_2" diff --git a/flake.nix b/flake.nix index 2c48cd8..463945d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,11 +3,15 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; }; - outputs = { self, nixpkgs, flake-utils, naersk }: + outputs = { self, nixpkgs, flake-utils, naersk, ... }: flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: let pkgs = import nixpkgs { inherit system; }; -- cgit v1.2.3