1
0
Fork 0

Simplify flake-parts modules

This commit is contained in:
Ethan Reece 2025-07-14 01:43:58 -05:00
parent 333f06a179
commit dc57b47ab9
Signed by: me
GPG key ID: DD8CE04D5D8FF832
9 changed files with 281 additions and 312 deletions

1
.envrc
View file

@ -1,3 +1,4 @@
watch_dir ./base watch_dir ./base
watch_dir ./sops
watch_file ./home-manager/default.nix watch_file ./home-manager/default.nix
use flake use flake

View file

@ -1,14 +1,13 @@
{ flake-parts-lib, inputs, ... }: { inputs, ... }:
{ {
imports = [ imports = [
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule inputs.git-hooks-nix.flakeModule
inputs.devshell.flakeModule inputs.devshell.flakeModule
]; ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
config = {
devshells.default = { devshells.default = {
commands = [ commands = [
{ {
@ -53,5 +52,3 @@
treefmt.projectRootFile = "flake.nix"; treefmt.projectRootFile = "flake.nix";
}; };
} }
);
}

View file

@ -1,4 +1,4 @@
{ flake-parts-lib, ... }: { ... }:
let let
dictionary = [ dictionary = [
"Asahi" "Asahi"
@ -11,7 +11,7 @@ let
]; ];
in in
{ {
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ pkgs, ... }: { pkgs, ... }:
let let
tomlFormatter = pkgs.formats.toml { }; tomlFormatter = pkgs.formats.toml { };
@ -85,7 +85,6 @@ in
}; };
in in
{ {
config = {
helix.languages.language-server = { helix.languages.language-server = {
# https://ltex-plus.github.io/ltex-plus/supported-languages.html # https://ltex-plus.github.io/ltex-plus/supported-languages.html
ltex-ls-plus = { ltex-ls-plus = {
@ -147,5 +146,3 @@ in
}; };
}; };
} }
);
}

View file

@ -1,10 +1,9 @@
{ flake-parts-lib, ... }: { ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
config = {
helix.languages = { helix.languages = {
language = [ language = [
{ {
@ -42,5 +41,3 @@
pre-commit.settings.hooks.markdownlint.enable = true; pre-commit.settings.hooks.markdownlint.enable = true;
}; };
} }
);
}

View file

@ -1,7 +1,7 @@
{ flake-parts-lib, ... }: { ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
helix.languages = { helix.languages = {
@ -30,6 +30,5 @@
enable = true; enable = true;
strict = true; strict = true;
}; };
} };
);
} }

View file

@ -1,10 +1,9 @@
{ flake-parts-lib, ... }: { ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
config = {
helix.languages = { helix.languages = {
language = [ language = [
{ {
@ -31,5 +30,3 @@
pre-commit.settings.hooks.check-toml.enable = true; pre-commit.settings.hooks.check-toml.enable = true;
}; };
} }
);
}

View file

@ -1,10 +1,9 @@
{ flake-parts-lib, ... }: { ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
config = {
helix.languages = { helix.languages = {
language = [ language = [
{ {
@ -43,5 +42,3 @@
}; };
}; };
} }
);
}

View file

@ -1,16 +1,26 @@
{ { inputs, withSystem, ... }:
flake-parts-lib,
inputs,
withSystem,
...
}:
{ {
imports = [ inputs.home-manager.flakeModules.home-manager ]; imports = [ inputs.home-manager.flakeModules.home-manager ];
options = { # https://nix-community.github.io/home-manager/options.xhtml
perSystem = flake-parts-lib.mkPerSystemOption ( flake.homeConfigurations = {
asahi = withSystem "aarch64-linux" (
{ pkgs, ... }:
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs pkgs; };
modules = [
{ nixpkgs.overlays = [ inputs.nur.overlays.default ]; }
inputs.lix-module.nixosModules.default
inputs.sops-nix.homeManagerModules.sops
inputs.stylix.homeModules.stylix
inputs.catppuccin.homeModules.catppuccin
./home.nix
];
}
);
};
perSystem =
{ config, system, ... }: { config, system, ... }:
{
config =
let let
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
@ -49,26 +59,3 @@
treefmt.settings.global.excludes = [ "home-manager/vencord.nix" ]; treefmt.settings.global.excludes = [ "home-manager/vencord.nix" ];
}; };
} }
);
};
config = {
# https://nix-community.github.io/home-manager/options.xhtml
flake.homeConfigurations = {
asahi = withSystem "aarch64-linux" (
{ pkgs, ... }:
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs pkgs; };
modules = [
{ nixpkgs.overlays = [ inputs.nur.overlays.default ]; }
inputs.lix-module.nixosModules.default
inputs.sops-nix.homeManagerModules.sops
inputs.stylix.homeModules.stylix
inputs.catppuccin.homeModules.catppuccin
./home.nix
];
}
);
};
};
}

View file

@ -1,8 +1,7 @@
{ flake-parts-lib, ... }: { ... }:
{ {
options = { perSystem =
perSystem = flake-parts-lib.mkPerSystemOption ( { pkgs, ... }:
{ config, pkgs, ... }:
{ {
config = { config = {
devshells.default = { devshells.default = {
@ -26,7 +25,5 @@
]; ];
}; };
}; };
}
);
}; };
} }