Add flake.nix

This commit is contained in:
Juno Takano 2026-06-07 04:00:36 -03:00
commit 0987269307
4 changed files with 111 additions and 4 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/target
/result

8
Cargo.lock generated
View file

@ -86,9 +86,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "2.12.1"
version = "2.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a"
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
[[package]]
name = "block-buffer"
@ -469,9 +469,9 @@ dependencies = [
[[package]]
name = "ignore"
version = "0.4.25"
version = "0.4.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a"
checksum = "b915661dd01db3f05050265b2477bcc6527b3792388e2749b41623cc592be67d"
dependencies = [
"crossbeam-deque",
"globset",

26
flake.lock generated Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1780453794,
"narHash": "sha256-bXMRa9VTsHSPXL4Cw8R6JJLQeY3Y/IP4+YJCYVmQ7FY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6b316287bae2ee04c9b93c8c858d930fd07d7338",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-26.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

80
flake.nix Normal file
View file

@ -0,0 +1,80 @@
{
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}; in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
rustup
just
watchexec
cargo-deny
cargo-llvm-cov
cargo-mutants
go-tools
typos
taplo
];
};
}
);
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";
};
};
};
};
};
}