1
0
Fork 0
nix-homemanager-laptop/flake.nix

162 lines
4.9 KiB
Nix

# TODO: Add flake-utils, flake-parts, git-pre-hook
{
description = "Home Manager configuration";
inputs = {
devshell.url = "github:numtide/devshell";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nur.url = "github:nix-community/NUR";
git-hooks-nix.url = "github:cachix/git-hooks.nix";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ withSystem, ... }:
{
systems = [ "aarch64-linux" ];
imports = [
inputs.devshell.flakeModule
inputs.git-hooks-nix.flakeModule
inputs.home-manager.flakeModules.home-manager
inputs.treefmt-nix.flakeModule
# ./home/flake-module.nix
];
flake = {
homeConfigurations = {
asahi = withSystem "aarch64-linux" (
{ pkgs, ... }:
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs pkgs; };
modules = [
./home/home.nix
inputs.lix-module.nixosModules.default
inputs.sops-nix.homeManagerModules.sops
{ nixpkgs.overlays = [ inputs.nur.overlays.default ]; }
];
}
);
};
};
perSystem =
{ system, config, ... }:
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.nur.overlays.default
inputs.nixgl.overlays.default
];
};
in
{
_module.args.pkgs = pkgs;
devshells.default = {
commands = [
{
help = "`home-manager switch` for asahi";
name = "switch-asahi";
command = "home-manager switch --flake .#asahi";
}
{
help = "`home-manager switch` for asahi with backup";
name = "switch-asahi-backup";
command = "home-manager switch --flake .#asahi -b backup";
}
{
help = "update dependencies";
name = "update";
command = "nix flake update";
}
{
help = "show home-manager documentation";
name = "man-home";
command = "man home-configuration.nix";
}
{
help = "generate Helix grammars";
name = "_helix-grammars";
command = "hx --grammar fetch && hx --grammar build";
}
{
help = "sync vale configuration";
name = "vale-sync";
command = "vale sync";
}
];
packages = [
config.treefmt.build.wrapper
pkgs.age
pkgs.forgejo-cli
pkgs.git
pkgs.harper
pkgs.helix
pkgs.jujutsu
pkgs.lix
pkgs.ltex-ls-plus
pkgs.marksman
pkgs.nil
pkgs.sops
pkgs.taplo
pkgs.uutils-coreutils
pkgs.vale
pkgs.vale-ls
pkgs.yaml-language-server
];
};
pre-commit.settings = {
hooks = {
markdownlint = {
enable = true;
};
vale = {
enable = true;
};
treefmt = {
enable = true;
};
};
};
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt = {
enable = true;
strict = true;
};
prettier = {
enable = true;
};
taplo = {
enable = true;
};
typos = {
enable = true;
locale = "en";
};
};
};
};
}
);
}