mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Nix: use nixfmt as formatter
This commit is contained in:
@@ -5,62 +5,68 @@
|
||||
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: {
|
||||
default = pkgsFor.${system}.callPackage ./nix/shell.nix {};
|
||||
}
|
||||
);
|
||||
devShells = eachSystem (system: {
|
||||
default = pkgsFor.${system}.callPackage ./nix/shell.nix { };
|
||||
});
|
||||
|
||||
homeModules.default = {
|
||||
homeModules.default =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [./nix/home-module.nix];
|
||||
}:
|
||||
{
|
||||
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];
|
||||
}:
|
||||
{
|
||||
imports = [ ./nix/nixos-module.nix ];
|
||||
services.noctalia-shell.package =
|
||||
lib.mkDefault
|
||||
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
|
||||
+4
-7
@@ -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 != { }) {
|
||||
|
||||
+10
-8
@@ -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";
|
||||
|
||||
@@ -24,11 +26,11 @@ in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.user.services.noctalia-shell = {
|
||||
description = "Noctalia Shell - Wayland desktop shell";
|
||||
documentation = ["https://docs.noctalia.dev/docs"];
|
||||
after = [cfg.target];
|
||||
partOf = [cfg.target];
|
||||
wantedBy = [cfg.target];
|
||||
restartTriggers = [cfg.package];
|
||||
documentation = [ "https://docs.noctalia.dev/docs" ];
|
||||
after = [ cfg.target ];
|
||||
partOf = [ cfg.target ];
|
||||
wantedBy = [ cfg.target ];
|
||||
restartTriggers = [ cfg.package ];
|
||||
|
||||
environment = {
|
||||
PATH = lib.mkForce null;
|
||||
@@ -43,6 +45,6 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [cfg.package];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
};
|
||||
}
|
||||
|
||||
+7
-6
@@ -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
|
||||
@@ -52,7 +53,7 @@
|
||||
gpu-screen-recorder
|
||||
];
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "noctalia-shell";
|
||||
inherit version src;
|
||||
|
||||
@@ -84,4 +85,4 @@ in
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "noctalia-shell";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user