dotfiles/flake.nix

72 lines
2.2 KiB
Nix
Raw Normal View History

{
description = "Prymn";
2024-02-03 11:11:23 +00:00
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2024-02-03 11:11:23 +00:00
devenv.url = "github:cachix/devenv";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-02-03 11:11:23 +00:00
outputs = { self, nixpkgs, devenv, flake-utils, rust-overlay, crane }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import ./nix/overlay.nix) (import rust-overlay) ];
2023-10-13 19:18:39 +00:00
pkgs = import nixpkgs { inherit system overlays; };
rustBuilder = import ./nix/rust.nix { inherit crane pkgs system; };
in
{
2024-02-03 11:11:23 +00:00
packages = {
devenv-up = self.devShells.${system}.default.config.procfileScript;
};
devShells.default = devenv.lib.mkShell {
inherit pkgs inputs;
modules = [
({ pkgs, config, ... }: {
packages = [
pkgs.elixir
pkgs.elixir-ls
pkgs.rustToolchain
pkgs.natscli
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.inotify-tools ];
services.postgres = {
enable = true;
package = pkgs.postgresql_16;
initialDatabases = [{ name = "prymn_dev"; }];
initialScript = "CREATE USER postgres SUPERUSER;";
};
processes.nats-server.exec = "${pkgs.nats-server}/bin/nats-server -c ./agent/server.conf";
enterShell = ''
echo happy deving
'';
})
];
};
2023-10-13 19:18:39 +00:00
checks.rustTest = rustBuilder.test;
checks.rustClippy = rustBuilder.clippy;
checks.rustFormat = rustBuilder.format;
packages.agent-x86_64-linux = rustBuilder.package "x86_64-linux";
packages.agent-aarch64-linux = rustBuilder.package "aarch64-linux";
});
}