diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 60 |
1 files changed, 58 insertions, 2 deletions
@@ -1,11 +1,29 @@ { description = "Aria Shrimpton dissertation"; + inputs = { + crane.url = "github:ipetkov/crane"; + crane.inputs.nixpkgs.follows = "nixpkgs"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + outputs = { self, nixpkgs, + crane, + rust-overlay, }: let system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + overlays = [(import rust-overlay)]; + }; + toolchain = pkgs.rust-bin.fromRustupToolchain (builtins.fromTOML (builtins.readFile ./src/rust-toolchain.toml)).toolchain // {profile = "minimal";}; + craneLib = crane.lib.${system}.overrideToolchain toolchain; tex = pkgs.texlive.combine { inherit (pkgs.texlive) @@ -33,7 +51,7 @@ ]; }; packages.${system} = { - default = pkgs.stdenvNoCC.mkDerivation rec { + thesis = pkgs.stdenvNoCC.mkDerivation rec { name = "thesis"; src = ./thesis; buildInputs = [pkgs.coreutils tex pkgs.biber]; @@ -50,6 +68,44 @@ cp main.pdf $out/ ''; }; + + default = let + rustCrate = craneLib.buildPackage { + pname = "candelabra-unwrapped"; + version = "1.0.0"; + + src = craneLib.cleanCargoSource (craneLib.path ./src); + doCheck = false; + + cargoExtraArgs = "-p candelabra-cli"; + }; + in + pkgs.runCommand "candelabra" {} '' + . ${pkgs.makeWrapper}/nix-support/setup-hook + mkdir -p $out/bin + makeWrapper ${rustCrate}/bin/candelabra $out/bin/candelabra \ + --set CANDELABRA_SRC_DIR ${pkgs.lib.sourceByRegex ./src [ + ".*crates" + ".*racket_specs.*" + ".*crates/library.*" + ".*crates/benchmarker.*" + ]} + ''; + }; + + dockerImages.${system}.default = pkgs.dockerTools.streamLayeredImage { + name = "candelabra"; + maxLayers = 128; + contents = [ + toolchain + (pkgs.callPackage ./racket-env.nix {}) + pkgs.z3 + + packages.${system}.default + + pkgs.just + (craneLib.cleanCargoSource (craneLib.path ./src)) + ]; }; }; } |