81 lines
1.9 KiB
Nix
81 lines
1.9 KiB
Nix
{
|
|
description = "tlater.net web server";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
|
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";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
fenixPkgs = fenix.packages.${system};
|
|
ownPkgs = self.packages.${system};
|
|
in {
|
|
packages.${system} = dream2nix.lib.importPackages {
|
|
projectRoot = ./.;
|
|
projectRootFile = "flake.nix";
|
|
packagesDir = ./packages;
|
|
packageSets = {
|
|
nixpkgs = pkgs;
|
|
fenix = fenixPkgs;
|
|
};
|
|
};
|
|
|
|
apps.${system} = {
|
|
default = let
|
|
inherit (ownPkgs) server templates;
|
|
inherit (pkgs) writeShellScript;
|
|
in {
|
|
type = "app";
|
|
program = builtins.toString (writeShellScript "tlaternet-webserver" ''
|
|
${server}/bin/tlaternet-webserver --template-directory ${templates}
|
|
'');
|
|
};
|
|
|
|
update = let
|
|
update-script = pkgs.callPackage ./nix/update.nix {inherit self;};
|
|
in {
|
|
type = "app";
|
|
program = "${update-script}/bin/update";
|
|
};
|
|
};
|
|
|
|
nixosModules.default = import ./nix/module.nix {inherit self system;};
|
|
|
|
devShells.${system} = {
|
|
server = pkgs.mkShell {
|
|
packages = [
|
|
(fenixPkgs.stable.withComponents [
|
|
"rustc"
|
|
"cargo"
|
|
"rustfmt"
|
|
"rust-std"
|
|
"rust-docs"
|
|
"clippy"
|
|
"rust-src"
|
|
"rust-analysis"
|
|
])
|
|
fenixPkgs.rust-analyzer
|
|
];
|
|
};
|
|
};
|
|
|
|
checks.${system} = import ./nix/checks {
|
|
inherit self pkgs;
|
|
};
|
|
};
|
|
}
|