aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix90
-rw-r--r--nix/candelabra.nix31
-rw-r--r--nix/configuration.nix61
-rw-r--r--nix/racket-env.nix (renamed from racket-env.nix)1
-rw-r--r--nix/tex-env.nix16
5 files changed, 123 insertions, 76 deletions
diff --git a/flake.nix b/flake.nix
index 7fe8562..26a1621 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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];
};
};
}
diff --git a/nix/candelabra.nix b/nix/candelabra.nix
new file mode 100644
index 0000000..da0a51c
--- /dev/null
+++ b/nix/candelabra.nix
@@ -0,0 +1,31 @@
+inputs @ {
+ pkgs,
+ crane,
+ ...
+}: let
+ inherit (pkgs) system;
+ toolchain = pkgs.rust-bin.fromRustupToolchain ((builtins.fromTOML (builtins.readFile ../src/rust-toolchain.toml)).toolchain // {profile = "minimal";});
+ craneLib = crane.lib.${system}.overrideToolchain toolchain;
+
+ rustCrate = craneLib.buildPackage {
+ pname = "candelabra-unwrapped";
+ version = "1.0.0";
+
+ src = craneLib.cleanCargoSource (craneLib.path ../src);
+ doCheck = false;
+ propagatedBuildInputs = [(pkgs.callPackage ./racket-env.nix inputs)];
+
+ 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.*"
+ ]}
+ ''
diff --git a/nix/configuration.nix b/nix/configuration.nix
new file mode 100644
index 0000000..c91059d
--- /dev/null
+++ b/nix/configuration.nix
@@ -0,0 +1,61 @@
+# Edit this configuration file to define what should be installed on
+# your system. Help is available in the configuration.nix(5) man page, on
+# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
+{
+ config,
+ lib,
+ pkgs,
+ modulesPath,
+ candelabra,
+ ...
+}: {
+ imports = [
+ (modulesPath + "/profiles/qemu-guest.nix")
+ ];
+
+ environment.systemPackages = with pkgs; [
+ git
+ just
+ candelabra # :D
+ ];
+
+ nix.settings.experimental-features = ["nix-command" "flakes" "ca-derivations"];
+
+ # Everything below here is just boring machine setup
+ networking.hostName = "candelabra";
+ networking.useDHCP = lib.mkDefault true;
+
+ time.timeZone = "Europe/London";
+ i18n.defaultLocale = "en_US.UTF-8";
+
+ # SSH Access
+ services.openssh = {
+ enable = true;
+ settings.PermitRootLogin = "prohibit-password";
+ };
+
+ users.users.root.openssh.authorizedKeys.keys = [
+ "no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPpKjZfzPN1KxVskFRnmTTCwzyCtjwcXVZc4i1rNfl9oAAAABHNzaDo= me@aria.rip"
+ ];
+
+ # Boot & filesystems
+ boot.loader.grub.enable = true;
+ boot.loader.grub.device = "/dev/sda";
+
+ boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
+ boot.initrd.kernelModules = [];
+ boot.kernelModules = ["kvm-intel"];
+ boot.extraModulePackages = [];
+
+ fileSystems."/" = {
+ device = "/dev/disk/by-uuid/b7946a55-0573-4be9-801b-5ca9afc7b3f3";
+ fsType = "ext4";
+ };
+
+ swapDevices = [
+ {device = "/dev/disk/by-uuid/9101d36f-dba8-4dda-8f4b-8dc8c1d37fe9";}
+ ];
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ system.stateVersion = "23.11";
+}
diff --git a/racket-env.nix b/nix/racket-env.nix
index e201dbf..0577b97 100644
--- a/racket-env.nix
+++ b/nix/racket-env.nix
@@ -427,6 +427,7 @@ in
name = "racket-wrapped";
buildInputs = [pkgs.makeWrapper];
phases = ["installPhase"];
+ propagatedBuildInputs = [pkgs.z3];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${racket}/bin/racket $out/bin/racket \
diff --git a/nix/tex-env.nix b/nix/tex-env.nix
new file mode 100644
index 0000000..96d621d
--- /dev/null
+++ b/nix/tex-env.nix
@@ -0,0 +1,16 @@
+{pkgs, ...}:
+pkgs.texlive.combine {
+ inherit
+ (pkgs.texlive)
+ scheme-small
+ microtype
+ sectsty
+ printlen
+ psnfss
+ helvetic
+ courier
+ biblatex
+ latex-bin
+ latexmk
+ ;
+}