en/flake.nix
jutty 27fa6d15eb
Some checks failed
/ verify (push) Has been cancelled
CI: Switch tooling setup to Nix
2026-06-24 01:24:24 -03:00

99 lines
2.9 KiB
Nix

{
description = "A non-linear writing instrument.";
inputs.nixpkgs.url = "nixpkgs/nixos-26.05";
outputs = { nixpkgs, self }: let
name = "en";
version = "0.4.0";
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
});
in {
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.rustPlatform.buildRustPackage {
inherit name version;
src = ./.;
cargoHash =
"sha256-"
+ "em229cShq/IShRnxlp5mgcIu7pIOf0LflV8Pw0lLUEY=";
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program =
"${self.packages.${system}.default}/bin/en";
};
});
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
sets = with pkgs; rec {
base = [
cargo-deny
cargo-llvm-cov
cargo-msrv
just
rustup
taplo
typos
];
cross = base ++ [
cargo-xwin
wine
];
dev = [
cargo-mutants
watchexec
git
];
edit = dev ++ [
neovim
tmux
];
};
in with sets; {
default = pkgs.mkShell { buildInputs = base; };
cross = pkgs.mkShell { buildInputs = cross; };
dev = pkgs.mkShell { buildInputs = base ++ dev; };
cross-dev = pkgs.mkShell { buildInputs = cross ++ dev; };
edit = pkgs.mkShell { buildInputs = edit; };
cross-edit = pkgs.mkShell { buildInputs = cross ++ edit; };
}
);
nixosModules.bot = { config, lib, system, ... }: {
options.within.services.en.enable =
lib.mkEnableOption "enable en server";
config = lib.mkIf config.within.services.en.enable {
systemd.services.en = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Restart = "always";
ExecStart =
"${self.packages."${system}".default}/bin/en";
};
};
};
};
};
}