Nix: use nixfmt as formatter

This commit is contained in:
wxlyyy
2025-12-20 03:20:39 +08:00
parent 2d81050db0
commit 8ce09bd234
5 changed files with 119 additions and 113 deletions
+29 -23
View File
@@ -5,61 +5,67 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {
outputs =
{
self,
nixpkgs,
...
}: let
}:
let
eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.linux;
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system}.appendOverlays [self.overlays.default]);
in {
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
packages = eachSystem (
system: {
default = pkgsFor.${system}.noctalia-shell;
}
pkgsFor = eachSystem (
system: nixpkgs.legacyPackages.${system}.appendOverlays [ self.overlays.default ]
);
in
{
formatter = eachSystem (system: pkgsFor.${system}.nixfmt);
packages = eachSystem (system: {
default = pkgsFor.${system}.noctalia-shell;
});
overlays = {
default = final: prev: {
noctalia-shell = final.callPackage ./nix/package.nix {
version = let
mkDate = longDate: final.lib.concatStringsSep "-" [
version =
let
mkDate =
longDate:
final.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
];
in
mkDate (self.lastModifiedDate or "19700101")
+ "_"
+ (self.shortRev or "dirty");
mkDate (self.lastModifiedDate or "19700101") + "_" + (self.shortRev or "dirty");
};
};
};
devShells = eachSystem (
system: {
devShells = eachSystem (system: {
default = pkgsFor.${system}.callPackage ./nix/shell.nix { };
}
);
});
homeModules.default = {
homeModules.default =
{
pkgs,
lib,
...
}: {
}:
{
imports = [ ./nix/home-module.nix ];
programs.noctalia-shell.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
nixosModules.default = {
nixosModules.default =
{
pkgs,
lib,
...
}: {
}:
{
imports = [ ./nix/nixos-module.nix ];
services.noctalia-shell.package =
lib.mkDefault
+4 -7
View File
@@ -107,15 +107,15 @@ in
{
templates = {
neovim = {
inputPath = "~/.config/matugen/templates/template.lua";
outputPath = "~/.config/nvim/generated.lua";
postHook = "pkill -SIGUSR1 nvim";
input_path = "~/.config/matugen/templates/template.lua";
output_path = "~/.config/nvim/generated.lua";
post_hook = "pkill -SIGUSR1 nvim";
};
};
}
'';
description = ''
Template definitions for Matugen.
Template definitions for Matugen, to be written to ~/.config/noctalia/user-templates.toml.
This option accepts:
- a Nix attrset (converted to TOML automatically)
@@ -135,7 +135,6 @@ in
config =
let
restart = "${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true";
useApp2Unit = cfg.settings.appLauncher.useApp2Unit or false;
in
lib.mkIf cfg.enable {
@@ -169,11 +168,9 @@ in
xdg.configFile = {
"noctalia/settings.json" = lib.mkIf (cfg.settings != { }) {
onChange = lib.mkIf (!cfg.systemd.enable) restart;
source = generateJson "settings" cfg.settings;
};
"noctalia/colors.json" = lib.mkIf (cfg.colors != { }) {
onChange = lib.mkIf (!cfg.systemd.enable) restart;
source = generateJson "colors" cfg.colors;
};
"noctalia/user-templates.toml" = lib.mkIf (cfg.user-templates != { }) {
+4 -2
View File
@@ -2,9 +2,11 @@
config,
lib,
...
}: let
}:
let
cfg = config.services.noctalia-shell;
in {
in
{
options.services.noctalia-shell = {
enable = lib.mkEnableOption "Noctalia shell systemd service";
+5 -4
View File
@@ -16,10 +16,12 @@
imagemagick,
wget,
gpu-screen-recorder, # optional
}: let
}:
let
src = lib.cleanSourceWith {
src = ../.;
filter = path: type:
filter =
path: type:
!(builtins.any (prefix: lib.path.hasPrefix (../. + prefix) (/. + path)) [
/.github
/.gitignore
@@ -36,8 +38,7 @@
]);
};
runtimeDeps =
[
runtimeDeps = [
brightnessctl
cava
cliphist