Refactor flake structure with flake-parts
This commit is contained in:
parent
8ca6499da1
commit
cf83a45191
10 changed files with 203 additions and 176 deletions
157
flake.nix
157
flake.nix
|
|
@ -1,6 +1,37 @@
|
|||
{
|
||||
description = "A simple NixOS flakes";
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
flake-parts,
|
||||
flake-utils,
|
||||
home-manager,
|
||||
treefmt-nix,
|
||||
...
|
||||
} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = flake-utils.lib.defaultSystems;
|
||||
imports = [
|
||||
home-manager.flakeModules.home-manager
|
||||
treefmt-nix.flakeModule
|
||||
|
||||
./flake
|
||||
];
|
||||
flake = {
|
||||
nix.settings = {
|
||||
# substituters shared in home-manager and nixos configuration
|
||||
substituters = let
|
||||
cachix = x: "https://${x}.cachix.org";
|
||||
in
|
||||
nixpkgs.lib.flatten [
|
||||
(cachix "nix-community")
|
||||
"https://cache.nixos.org"
|
||||
(cachix "cosmic")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
|
|
@ -140,130 +171,4 @@
|
|||
repo = "treefmt-nix";
|
||||
};
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-parts,
|
||||
flake-utils,
|
||||
...
|
||||
} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} ({flake-parts-lib, ...}: let
|
||||
inherit (self) outputs;
|
||||
inherit (flake-parts-lib) importApply;
|
||||
rootPath = ./.;
|
||||
nixos = importApply ./flake/nixos.nix {inherit rootPath outputs;};
|
||||
home = importApply ./flake/home.nix {inherit rootPath outputs;};
|
||||
deploy = importApply ./flake/deploy.nix {inherit outputs;};
|
||||
templates = importApply ./flake/templates.nix {inherit rootPath;};
|
||||
in {
|
||||
systems = flake-utils.lib.defaultSystems;
|
||||
imports = [
|
||||
inputs.home-manager.flakeModules.home-manager
|
||||
inputs.treefmt-nix.flakeModule
|
||||
nixos
|
||||
home
|
||||
deploy
|
||||
templates
|
||||
];
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
} @ args: {
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
packages = import ./pkgs (
|
||||
args
|
||||
// {
|
||||
inherit inputs rootPath;
|
||||
}
|
||||
);
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
nixd
|
||||
typos
|
||||
typos-lsp
|
||||
just
|
||||
nvfetcher
|
||||
];
|
||||
};
|
||||
treefmt = {
|
||||
programs = {
|
||||
alejandra = {
|
||||
enable = true;
|
||||
excludes = ["pkgs/_sources/*.nix"];
|
||||
};
|
||||
biome = {
|
||||
enable = true;
|
||||
includes = ["*.json"];
|
||||
excludes = ["pkgs/_sources/*.json"];
|
||||
settings = {
|
||||
javascript.formatter.enabled = false;
|
||||
css.formatter.enabled = false;
|
||||
};
|
||||
};
|
||||
dprint = {
|
||||
enable = true;
|
||||
includes = ["*.md" "*.toml" "*.yaml"];
|
||||
excludes = ["secrets/*.yaml"];
|
||||
settings = {
|
||||
plugins = pkgs.dprint-plugins.getPluginList (plugins:
|
||||
with plugins; [
|
||||
dprint-plugin-toml
|
||||
dprint-plugin-markdown
|
||||
g-plane-pretty_yaml
|
||||
]);
|
||||
};
|
||||
};
|
||||
just = {
|
||||
enable = true;
|
||||
includes = [".justfile"];
|
||||
};
|
||||
typos = let
|
||||
config = ./.typos.toml |> builtins.readFile |> builtins.fromTOML;
|
||||
in {
|
||||
enable = true;
|
||||
includes = ["*"];
|
||||
excludes = ["assets/*"] ++ config.files.extend-exclude;
|
||||
configFile = "${toString ./.typos.toml}";
|
||||
# Disable all extra option in treefmt module.
|
||||
# Use config file.
|
||||
sort = false;
|
||||
isolated = false;
|
||||
hidden = false;
|
||||
noIgnore = false;
|
||||
noIgnoreDot = false;
|
||||
noIgnoreGlobal = false;
|
||||
noIgnoreParent = false;
|
||||
noIgnoreVCS = false;
|
||||
binary = false;
|
||||
noCheckFilenames = false;
|
||||
noCheckFiles = false;
|
||||
noUnicode = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
flake = {
|
||||
overlays = {
|
||||
modifications = import ./overlays/modifications {inherit inputs outputs;};
|
||||
additions = import ./overlays/additions {inherit inputs outputs;};
|
||||
};
|
||||
nix.settings = {
|
||||
# substituters shared in home-manager and nixos configuration
|
||||
substituters = let
|
||||
cachix = x: "https://${x}.cachix.org";
|
||||
in
|
||||
nixpkgs.lib.flatten [
|
||||
(cachix "nix-community")
|
||||
"https://cache.nixos.org"
|
||||
(cachix "cosmic")
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue