tlaternet-webserver/flake.nix

87 lines
2.4 KiB
Nix
Raw Normal View History

{
description = "tlater.net web server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.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,
} @ flake-inputs: let
2022-08-13 21:44:31 +01:00
# At the moment, we only deploy to x86_64-linux. Update when we
# care about another platform.
system = "x86_64-linux";
flakeOutputs = nixpkgs.lib.callPackageWith flake-inputs (import ./nix/packages.nix) {inherit system;};
2022-08-13 21:44:31 +01:00
in {
2022-09-18 18:52:01 +01:00
packages.${system} = {
server = flakeOutputs.packages.${system}.tlaternet-webserver;
templates = flakeOutputs.packages.${system}.tlaternet;
2022-08-13 21:44:31 +01:00
};
2021-03-31 22:25:44 +01:00
2023-01-19 07:59:58 +00: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}
'');
};
update = let
update-script = nixpkgs.legacyPackages.${system}.callPackage ./nix/update.nix {
cargo = flakeOutputs.rust-toolchain.cargo;
npm = nixpkgs.legacyPackages.${system}.nodePackages_latest.npm;
npm-check-updates = self.packages.${system}.templates.dependencies.npm-check-updates;
};
in {
type = "app";
program = "${update-script}/bin/update";
};
};
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} = {
templates = flakeOutputs.devShells.${system}.tlaternet.overrideAttrs (old: {
2022-09-18 18:52:01 +01:00
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.rust-toolchain.withComponents [
2022-09-18 18:52:01 +01:00
"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
};
}