diff options
author | Aria Shrimpton <me@aria.rip> | 2024-01-29 22:48:13 +0000 |
---|---|---|
committer | Aria Shrimpton <me@aria.rip> | 2024-01-29 22:48:13 +0000 |
commit | babd6d51bc3e3b4665cec2b6d0750605c2d6c5bd (patch) | |
tree | 2a06caf45d02426e6092409509ed5b90ca1d8648 /flake.nix | |
parent | 8b2556974cb70cddeedc6f4fb1d06d16c1cff5a1 (diff) |
nixos configuration
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 90 |
1 files changed, 14 insertions, 76 deletions
@@ -11,7 +11,7 @@ }; }; - outputs = { + outputs = inputs @ { self, nixpkgs, crane, @@ -22,90 +22,28 @@ 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) - scheme-small - microtype - sectsty - printlen - psnfss - helvetic - courier - biblatex - latex-bin - latexmk - ; - }; + tex-env = pkgs.callPackage ./nix/tex-env.nix inputs; + racket-env = pkgs.callPackage ./nix/racket-env.nix inputs; + candelabra = pkgs.callPackage ./nix/candelabra.nix inputs; in rec { devShells.${system}.default = pkgs.mkShell { buildInputs = [ + tex-env + racket-env + pkgs.just # command runner - tex # latex environment pkgs.biber # bibliography backend - - (pkgs.callPackage ./racket-env.nix {}) - pkgs.z3 ]; }; - packages.${system} = { - thesis = pkgs.stdenvNoCC.mkDerivation rec { - name = "thesis"; - src = ./thesis; - buildInputs = [pkgs.coreutils tex pkgs.biber]; - phases = ["unpackPhase" "buildPhase" "installPhase"]; - buildPhase = '' - export PATH="${pkgs.lib.makeBinPath buildInputs}"; - mkdir -p .cache/texmf-var - env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \ - latexmk -interaction=nonstopmode -bibtex -pdf \ - main.tex - ''; - installPhase = '' - mkdir -p $out - 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 + packages.${system}.default = candelabra; - pkgs.just - (craneLib.cleanCargoSource (craneLib.path ./src)) - ]; + nixosConfigurations.default = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs tex-env racket-env candelabra; + }; + modules = [./nix/configuration.nix]; }; }; } |