{ 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 ]; }; treefmt = config.treefmt.build.wrapper; helixLanguages = { language = [ { name = "markdown"; language-servers = [ "marksman" "ltex-ls-plus" "vale-ls" ]; formatter = { command = "${treefmt}/bin/treefmt"; args = [ "--stdin" ".md" "--quiet" ]; }; auto-format = true; } { name = "nix"; language-servers = [ "nil" "harper-ls" ]; formatter = { command = "${treefmt}/bin/treefmt"; args = [ "--stdin" ".nix" "--quiet" ]; }; auto-format = true; } { name = "toml"; language-servers = [ "taplo" "harper-ls" ]; formatter = { command = "${treefmt}/bin/treefmt"; args = [ "--stdin" ".toml" "--quiet" ]; }; auto-format = true; } { name = "yaml"; language-servers = [ "yaml-language-server" "harper-ls" ]; formatter = { command = "${treefmt}/bin/treefmt"; args = [ "--stdin" ".yaml" "--quiet" ]; }; auto-format = true; } ]; language-server = { ltex-ls-plus = { command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus"; config = { ltex.dictionary = { en-US = [ "Asahi" "LLMs" "LTeX" ]; }; }; }; marksman = { command = "${pkgs.marksman}/bin/marksman"; }; harper-ls = { command = "${pkgs.harper}/bin/harper-ls"; }; nil = { command = "${pkgs.nil}/bin/nil"; }; taplo = { command = "${pkgs.taplo}/bin/taplo"; }; vale-ls = { command = "${pkgs.vale-ls}/bin/vale-ls"; }; yaml-language-server = { command = "${pkgs.yaml-language-server}/bin/yaml-language-server"; }; }; }; helixLanguagesFormat = pkgs.formats.toml { }; helixLanguagesFile = helixLanguagesFormat.generate "languages.toml" helixLanguages; in { _module.args.pkgs = pkgs; devshells.default = { commands = [ { help = "`home-manager switch` for asahi"; name = "switch-asahi"; command = "${pkgs.home-manager}/bin/home-manager switch --flake .#asahi"; } { help = "`home-manager switch` for asahi with backup"; name = "switch-asahi-backup"; command = "${pkgs.home-manager}/bin/home-manager switch --flake .#asahi -b backup"; } { help = "update dependencies"; name = "update"; command = "${pkgs.lix}/bin/nix flake update"; } { help = "show home-manager documentation"; name = "man-home"; command = "${pkgs.man}/bin/man home-configuration.nix"; } { help = "generate Helix grammars"; name = "_helix-grammars"; command = "${pkgs.helix}/bin/hx --grammar fetch && hx --grammar build"; } { help = "sync vale configuration"; name = "vale-sync"; command = "${pkgs.vale}/bin/vale sync"; } { help = "generate age key"; name = "_age-generate-key"; command = "${pkgs.uutils-coreutils-noprefix}/bin/mkdir -p ~/.config/sops/age && ${pkgs.age}/bin/age-keygen -o ~/.config/sops/age/keys.txt && ${pkgs.uutils-coreutils-noprefix}/bin/cat ~/.config/sops/age/keys.txt"; } { help = "edit secrets.yaml"; name = "sops-edit"; command = "${pkgs.sops}/bin/sops edit ./home/secrets/secrets.yaml"; } ]; packages = [ pkgs.age pkgs.forgejo-cli pkgs.git pkgs.helix pkgs.home-manager pkgs.jujutsu pkgs.lix pkgs.man pkgs.sops pkgs.uutils-coreutils-noprefix pkgs.vale ]; devshell = { motd = '' {202}🔨 Nix Laptop Configuration{reset} $(type -p menu &>/dev/null && menu) ''; name = "Laptop Configuration"; startup = { helix_config = { text = '' mkdir -p .helix ${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${helixLanguagesFile} ./.helix/languages.toml ''; }; }; }; }; pre-commit.settings = { hooks = { markdownlint = { enable = true; }; vale = { enable = true; }; treefmt = { enable = true; }; }; }; treefmt = { projectRootFile = "flake.nix"; programs = { nixfmt = { enable = true; strict = true; }; dprint = { enable = true; settings = { plugins = ( pkgs.dprint-plugins.getPluginList ( plugins: with plugins; [ dprint-plugin-markdown g-plane-pretty_yaml ] ) ); }; }; taplo = { enable = true; }; typos = { enable = true; locale = "en-us"; }; }; settings.global = { excludes = [ ".vale/*" ]; }; }; }; } ); }