aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 917e3aa41ca05d1a02bdb171407ebcbaaad015e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  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";
      };
    };
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs @ {
    self,
    nixpkgs,
    nixos-generators,
    crane,
    rust-overlay,
  }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      overlays = [(import rust-overlay)];
    };
    tex-env = pkgs.callPackage ./nix/tex-env.nix inputs;
    racket-env = pkgs.callPackage ./nix/racket-env.nix inputs;
    rust-toolchain = pkgs.rust-bin.fromRustupToolchain ((builtins.fromTOML (builtins.readFile ./src/rust-toolchain.toml)).toolchain // {profile = "minimal";});
    candelabra = pkgs.callPackage ./nix/candelabra.nix inputs;
  in rec {
    devShells.${system} = {
      minimal = pkgs.mkShell {
        buildInputs = [
          rust-toolchain
          racket-env
          pkgs.just # command runner
          pkgs.inotify-tools
        ];
      };
      full = pkgs.mkShell {
        buildInputs = [
          rust-toolchain
          racket-env
          pkgs.just # command runner
          pkgs.inotify-tools

          tex-env
          pkgs.biber # bibliography backend

          pkgs.livebook # datavis
          # god is dead
          pkgs.nodejs
          pkgs.nodePackages.vega-cli
          pkgs.nodePackages.vega-lite
        ];
      };
    };

    packages.${system} = {
      default = candelabra;
      vm = nixos-generators.nixosGenerate {
        inherit system;
        specialArgs = {
          inherit inputs tex-env racket-env candelabra;
        };
        modules = [./nix/configuration.nix];

        format = "vm";
      };
    };
  };
}