feat: add flake support

This commit is contained in:
Ruixi-rebirth 2025-02-25 22:05:29 +08:00
parent 4d48679ccc
commit 1a55178fd6
No known key found for this signature in database
GPG key ID: 847E32F6F2F1D108
7 changed files with 308 additions and 0 deletions

54
flake.nix Normal file
View file

@ -0,0 +1,54 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
flake-parts,
treefmt-nix,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
flake.hmModules.maomaowm = import ./nix/hm-modules.nix;
perSystem =
{
config,
pkgs,
...
}:
let
inherit (pkgs)
callPackage
;
maomaowm = callPackage ./nix { };
shellOverride = old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ ];
buildInputs = old.buildInputs ++ [ ];
};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
packages.default = maomaowm;
overlayAttrs = {
inherit (config.packages) maomaowm;
};
packages = {
inherit maomaowm;
};
devShells.default = maomaowm.overrideAttrs shellOverride;
formatter = treefmtEval.config.build.wrapper;
};
systems = [ "x86_64-linux" ];
};
}