Add treefmt configuration
This commit is contained in:
parent
ff0ce9d94c
commit
b2395ce611
5 changed files with 158 additions and 31 deletions
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
self,
|
||||
flakeSelf,
|
||||
system,
|
||||
pkgs,
|
||||
deployPkgs,
|
||||
treefmtEval,
|
||||
...
|
||||
}@inputs:
|
||||
{
|
||||
${system} = {
|
||||
|
||||
# TODO: Check project formatting
|
||||
formatting = treefmtEval.config.build.check flakeSelf;
|
||||
|
||||
nixos-modules = pkgs.callPackage ./nixos-modules {
|
||||
inherit (self.lib) getSubDirs isFolderWithFile;
|
||||
|
|
109
flake.lock
generated
109
flake.lock
generated
|
@ -56,18 +56,77 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks-nix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742649964,
|
||||
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"git-hooks-nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1702272962,
|
||||
"narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=",
|
||||
"lastModified": 1742669843,
|
||||
"narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d",
|
||||
"rev": "1e5b653dff12029333a6546c11e108ede13052eb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -88,7 +147,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-nixos-unstable": {
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1742669843,
|
||||
"narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=",
|
||||
|
@ -106,16 +165,16 @@
|
|||
},
|
||||
"private": {
|
||||
"inputs": {
|
||||
"nixpkgs-nixos-unstable": [
|
||||
"nixpkgs-nixos-unstable"
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742849713,
|
||||
"narHash": "sha256-EH3vvMdalGxxvYt3tZI4K4RKT/YAh7XejYYrf/jZ0N8=",
|
||||
"lastModified": 1742903609,
|
||||
"narHash": "sha256-/RY0aP9QJROQqyaTX2qUy04YQD22l8cTbKqYo3aFzpg=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "f79080b8802eec4463bb4a25c64f82f73e6e31db",
|
||||
"revCount": 12,
|
||||
"rev": "9e9c48a02ca9ce6514d609c0f4f0607fa7fa8165",
|
||||
"revCount": 13,
|
||||
"type": "git",
|
||||
"url": "file:./private"
|
||||
},
|
||||
|
@ -128,16 +187,18 @@
|
|||
"inputs": {
|
||||
"deploy-rs": "deploy-rs",
|
||||
"disko": "disko",
|
||||
"git-hooks-nix": "git-hooks-nix",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-nixos-stable": "nixpkgs-nixos-stable",
|
||||
"nixpkgs-nixos-unstable": "nixpkgs-nixos-unstable",
|
||||
"private": "private",
|
||||
"sops-nix": "sops-nix"
|
||||
"sops-nix": "sops-nix",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-nixos-unstable"
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
|
@ -169,6 +230,26 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742370146,
|
||||
"narHash": "sha256-XRE8hL4vKIQyVMDXykFh4ceo3KSpuJF3ts8GKwh5bIU=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "adc195eef5da3606891cedf80c0d9ce2d3190808",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
43
flake.nix
43
flake.nix
|
@ -5,35 +5,44 @@
|
|||
extra-trusted-public-keys = "qois-infrastructure:lh35ymN7Aoxm5Hz0S6JusxE+cYzMU+x9OMKjDVIpfuE=";
|
||||
};
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-nixos-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
git-hooks-nix = {
|
||||
url = "github:cachix/git-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs-nixos-stable";
|
||||
};
|
||||
nixpkgs-nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-nixos-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs-nixos-unstable";
|
||||
};
|
||||
};
|
||||
private.url = "git+file:./private";
|
||||
private.inputs.nixpkgs-nixos-unstable.follows = "nixpkgs-nixos-unstable";
|
||||
private.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs-nixos-unstable,
|
||||
nixpkgs,
|
||||
deploy-rs,
|
||||
treefmt-nix,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
# Packages for development and build process
|
||||
pkgs = import nixpkgs-nixos-unstable { inherit system; };
|
||||
deployPkgs = import nixpkgs-nixos-unstable {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
deployPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
deploy-rs.overlay
|
||||
|
@ -45,6 +54,7 @@
|
|||
})
|
||||
];
|
||||
};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
importParams = {
|
||||
inherit (inputs)
|
||||
deploy-rs
|
||||
|
@ -53,7 +63,12 @@
|
|||
sops-nix
|
||||
private
|
||||
;
|
||||
inherit pkgs deployPkgs system;
|
||||
inherit
|
||||
deployPkgs
|
||||
pkgs
|
||||
system
|
||||
treefmtEval
|
||||
;
|
||||
flakeSelf = self;
|
||||
};
|
||||
in
|
||||
|
@ -93,7 +108,7 @@
|
|||
};
|
||||
}
|
||||
);
|
||||
formatter.${system} = pkgs.nixfmt-tree;
|
||||
formatter.${system} = treefmtEval.config.build.wrapper;
|
||||
nixosConfigurations = import ./nixos-configurations/default.nix (
|
||||
importParams
|
||||
// {
|
||||
|
|
2
private
2
private
|
@ -1 +1 @@
|
|||
Subproject commit f79080b8802eec4463bb4a25c64f82f73e6e31db
|
||||
Subproject commit 9e9c48a02ca9ce6514d609c0f4f0607fa7fa8165
|
30
treefmt.nix
Normal file
30
treefmt.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
nixfmt.enable = true;
|
||||
deadnix.enable = true;
|
||||
jsonfmt.enable = true;
|
||||
yamlfmt.enable = true;
|
||||
mdformat.enable = true;
|
||||
ruff-check.enable = true;
|
||||
ruff-format.enable = true;
|
||||
shfmt.enable = true;
|
||||
};
|
||||
settings = {
|
||||
global.excludes =
|
||||
[
|
||||
"*.jpg"
|
||||
"*.pdf"
|
||||
"*.toml"
|
||||
]
|
||||
++ [
|
||||
".envrc"
|
||||
"robots.txt"
|
||||
".vscode/*"
|
||||
"nixos-modules/system/etc/*"
|
||||
"private/*"
|
||||
];
|
||||
formatter.jsonfmt.excludes = [ ".vscode/*.json" ];
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue