tlaternet-webserver/flake.nix

81 lines
1.9 KiB
Nix
Raw Permalink Normal View History

{
description = "tlater.net web server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
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,
}: 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";
pkgs = nixpkgs.legacyPackages.${system};
fenixPkgs = fenix.packages.${system};
ownPkgs = self.packages.${system};
2022-08-13 21:44:31 +01:00
in {
packages.${system} = dream2nix.lib.importPackages {
projectRoot = ./.;
projectRootFile = "flake.nix";
packagesDir = ./packages;
packageSets = {
nixpkgs = pkgs;
fenix = fenixPkgs;
};
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 (ownPkgs) server templates;
inherit (pkgs) writeShellScript;
2023-01-19 07:59:58 +00:00
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;};
2023-01-19 07:59:58 +00:00
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} = {
server = pkgs.mkShell {
2022-09-18 18:52:01 +01:00
packages = [
(fenixPkgs.stable.withComponents [
2022-09-18 18:52:01 +01:00
"rustc"
"cargo"
"rustfmt"
"rust-std"
"rust-docs"
"clippy"
"rust-src"
"rust-analysis"
])
fenixPkgs.rust-analyzer
2022-08-13 21:44:31 +01:00
];
2021-03-31 22:25:44 +01:00
};
};
checks.${system} = import ./nix/checks {
2024-01-02 14:06:58 +00:00
inherit self pkgs;
};
2022-08-13 21:44:31 +01:00
};
}