diff options
| author | Xe Iaso <me@christine.website> | 2022-10-30 18:42:45 -0400 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-10-30 18:42:45 -0400 |
| commit | 1c2737540172085900f7e68c772a60f7ee35a6f3 (patch) | |
| tree | 76ef9ec94b48c496ad459b3455522460a38fa426 | |
| parent | 23c64aebf57b3a9f9db4c08af001f01af25d732d (diff) | |
| download | xesite-1c2737540172085900f7e68c772a60f7ee35a6f3.tar.xz xesite-1c2737540172085900f7e68c772a60f7ee35a6f3.zip | |
revert to old nix build i guess
Signed-off-by: Xe Iaso <me@christine.website>
| -rw-r--r-- | default.nix | 67 |
1 files changed, 57 insertions, 10 deletions
diff --git a/default.nix b/default.nix index 2cccff2..5ce17c1 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,57 @@ -(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 +{ 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 + ''; +} |
