70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
{
|
|
description = "My Project";
|
|
|
|
inputs = {
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
flake-utils,
|
|
nixpkgs,
|
|
treefmt-nix,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
treefmtEval = treefmt-nix.lib.evalModule pkgs {
|
|
projectRootFile = "flake.nix";
|
|
programs = {
|
|
nixfmt.enable = true;
|
|
nixfmt.package = pkgs.nixfmt-rfc-style;
|
|
shfmt.enable = true;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
# For `nix fmt`
|
|
formatter = treefmtEval.config.build.wrapper;
|
|
|
|
# Checks/tests for the project
|
|
checks = {
|
|
# FIXME: Add actual tests
|
|
simple-test = pkgs.runCommand "simple-test" { } ''
|
|
${self.packages.${system}.default}/bin/my-program
|
|
touch $out
|
|
'';
|
|
};
|
|
|
|
# Packages
|
|
packages = {
|
|
my-program = pkgs.writeShellScriptBin "my-program" ''
|
|
${pkgs.ddate}/bin/ddate +'Hello, world! Today is the %e of %B%, %Y' |
|
|
${pkgs.cowsay}/bin/cowsay
|
|
'';
|
|
|
|
default = self.packages.${system}.my-program;
|
|
};
|
|
|
|
# Development shell
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
just
|
|
watchexec
|
|
];
|
|
shellHook = ''
|
|
echo
|
|
echo "✨ Welcome to the My Project development environment! ✨"
|
|
echo "Run 'just' to see available commands."
|
|
echo
|
|
'';
|
|
};
|
|
|
|
}
|
|
);
|
|
}
|