Improve nix setup

This commit is contained in:
dolphinau 2025-08-27 18:11:12 +02:00
parent 6f85efcd26
commit 580f80b521
No known key found for this signature in database
6 changed files with 113 additions and 33 deletions

View file

@ -1,41 +1,22 @@
{
description = "lwn-sub-snoozer";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = {
default = self.packages.${system}.myapp;
};
# $ nix develop
devShells.default = pkgs.mkShell {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.openssl];
packages = [
pkgs.pkg-config
pkgs.openssl
pkgs.postgresql
# Nix
pkgs.nixpkgs-fmt
pkgs.nil
pkgs.nixd
pkgs.alejandra
# Rust
pkgs.rustfmt
pkgs.rustc
pkgs.cargo
pkgs.rust-analyzer
];
};
}: let
supportedSystems = ["x86_64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./. {};
});
devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./shell.nix {};
});
};
}