tlaternet-webserver/flake.nix

68 lines
1.6 KiB
Nix

{
description = "tlater.net web server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
dream2nix.url = "github:nix-community/dream2nix";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
dream2nix,
fenix,
}: let
# At the moment, we only deploy to x86_64-linux. Update when we
# care about another platform.
system = "x86_64-linux";
flakeOutputs = import ./nix/packages.nix {inherit nixpkgs dream2nix fenix system;};
in {
packages.${system} = {
server = flakeOutputs.server.packages.${system}.default;
templates = flakeOutputs.templates.packages.${system}.default;
};
devShells.${system} = {
templates = flakeOutputs.templates.devShells.${system}.default.overrideAttrs (old: {
buildInputs = with nixpkgs.legacyPackages.${system};
[
yj
]
++ old.buildInputs;
shellHook =
''
# Update package.json
if [ -e ./package.json ]; then
unlink ./package.json
fi
cat ./package.yaml | yj > ./package.json
''
+ old.shellHook;
});
server = nixpkgs.legacyPackages.${system}.mkShell {
packages = [
(flakeOutputs.server.rust-toolchain.withComponents [
"rustc"
"cargo"
"rustfmt"
"rust-std"
"rust-docs"
"clippy"
"rust-src"
"rust-analysis"
])
fenix.packages.${system}.rust-analyzer
];
};
};
};
}