tlaternet-webserver/flake.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

{
description = "tlater.net web server";
inputs = {
2022-06-20 14:46:36 +01:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
2022-09-18 18:52:01 +01:00
dream2nix.url = "github:nix-community/dream2nix";
2022-09-18 18:52:01 +01:00
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
2022-08-13 21:44:31 +01:00
};
};
2021-03-31 22:25:44 +01:00
2022-08-13 21:44:31 +01:00
outputs = {
self,
nixpkgs,
2022-09-18 18:52:01 +01:00
dream2nix,
fenix,
2022-08-13 21:44:31 +01:00
}: let
# At the moment, we only deploy to x86_64-linux. Update when we
# care about another platform.
system = "x86_64-linux";
2022-09-18 18:52:01 +01:00
flakeOutputs = import ./nix/packages.nix {inherit nixpkgs dream2nix fenix system;};
2022-08-13 21:44:31 +01:00
in {
2022-09-18 18:52:01 +01:00
packages.${system} = {
server = flakeOutputs.server.packages.${system}.default;
templates = flakeOutputs.templates.packages.${system}.default;
2022-08-13 21:44:31 +01:00
};
2021-03-31 22:25:44 +01:00
apps.${system}.default = let
inherit (self.packages.${system}) server templates;
inherit (nixpkgs.legacyPackages.${system}) writeShellScript;
in {
type = "app";
program = builtins.toString (writeShellScript "tlaternet-webserver" ''
${server}/bin/tlaternet-webserver --template-directory ${templates}
'');
};
2022-09-29 03:24:56 +01:00
nixosModules.default = import ./nix/module.nix {inherit self system;};
2022-08-13 21:44:31 +01:00
devShells.${system} = {
2022-09-18 18:52:01 +01:00
templates = flakeOutputs.templates.devShells.${system}.default.overrideAttrs (old: {
buildInputs = with nixpkgs.legacyPackages.${system};
2022-08-13 21:44:31 +01:00
[
2022-09-18 18:52:01 +01:00
yj
2022-08-13 21:44:31 +01:00
]
2022-09-18 18:52:01 +01:00
++ old.buildInputs;
});
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
2022-08-13 21:44:31 +01:00
];
2021-03-31 22:25:44 +01:00
};
};
checks.${system} = import ./nix/checks {
inherit self system;
pkgs = nixpkgs.legacyPackages.${system};
};
2022-08-13 21:44:31 +01:00
};
}