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,65 +5,71 @@
|
|||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{
|
||||||
nixpkgs,
|
self,
|
||||||
...
|
nixpkgs,
|
||||||
}: let
|
...
|
||||||
eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.linux;
|
}:
|
||||||
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system}.appendOverlays [self.overlays.default]);
|
let
|
||||||
in {
|
eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.linux;
|
||||||
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
|
pkgsFor = eachSystem (
|
||||||
|
system: nixpkgs.legacyPackages.${system}.appendOverlays [ self.overlays.default ]
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter = eachSystem (system: pkgsFor.${system}.nixfmt);
|
||||||
|
|
||||||
packages = eachSystem (
|
packages = eachSystem (system: {
|
||||||
system: {
|
|
||||||
default = pkgsFor.${system}.noctalia-shell;
|
default = pkgsFor.${system}.noctalia-shell;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
overlays = {
|
overlays = {
|
||||||
default = final: prev: {
|
default = final: prev: {
|
||||||
noctalia-shell = final.callPackage ./nix/package.nix {
|
noctalia-shell = final.callPackage ./nix/package.nix {
|
||||||
version = let
|
version =
|
||||||
mkDate = longDate: final.lib.concatStringsSep "-" [
|
let
|
||||||
(builtins.substring 0 4 longDate)
|
mkDate =
|
||||||
(builtins.substring 4 2 longDate)
|
longDate:
|
||||||
(builtins.substring 6 2 longDate)
|
final.lib.concatStringsSep "-" [
|
||||||
];
|
(builtins.substring 0 4 longDate)
|
||||||
in
|
(builtins.substring 4 2 longDate)
|
||||||
mkDate (self.lastModifiedDate or "19700101")
|
(builtins.substring 6 2 longDate)
|
||||||
+ "_"
|
];
|
||||||
+ (self.shortRev or "dirty");
|
in
|
||||||
|
mkDate (self.lastModifiedDate or "19700101") + "_" + (self.shortRev or "dirty");
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
devShells = eachSystem (
|
devShells = eachSystem (system: {
|
||||||
system: {
|
default = pkgsFor.${system}.callPackage ./nix/shell.nix { };
|
||||||
default = pkgsFor.${system}.callPackage ./nix/shell.nix {};
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
homeModules.default = {
|
homeModules.default =
|
||||||
pkgs,
|
{
|
||||||
lib,
|
pkgs,
|
||||||
...
|
lib,
|
||||||
}: {
|
...
|
||||||
imports = [./nix/home-module.nix];
|
}:
|
||||||
programs.noctalia-shell.package =
|
{
|
||||||
lib.mkDefault
|
imports = [ ./nix/home-module.nix ];
|
||||||
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
programs.noctalia-shell.package =
|
||||||
};
|
lib.mkDefault
|
||||||
|
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
};
|
||||||
|
|
||||||
nixosModules.default = {
|
nixosModules.default =
|
||||||
pkgs,
|
{
|
||||||
lib,
|
pkgs,
|
||||||
...
|
lib,
|
||||||
}: {
|
...
|
||||||
imports = [./nix/nixos-module.nix];
|
}:
|
||||||
services.noctalia-shell.package =
|
{
|
||||||
lib.mkDefault
|
imports = [ ./nix/nixos-module.nix ];
|
||||||
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
services.noctalia-shell.package =
|
||||||
|
lib.mkDefault
|
||||||
|
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -107,15 +107,15 @@ in
|
|||||||
{
|
{
|
||||||
templates = {
|
templates = {
|
||||||
neovim = {
|
neovim = {
|
||||||
inputPath = "~/.config/matugen/templates/template.lua";
|
input_path = "~/.config/matugen/templates/template.lua";
|
||||||
outputPath = "~/.config/nvim/generated.lua";
|
output_path = "~/.config/nvim/generated.lua";
|
||||||
postHook = "pkill -SIGUSR1 nvim";
|
post_hook = "pkill -SIGUSR1 nvim";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Template definitions for Matugen.
|
Template definitions for Matugen, to be written to ~/.config/noctalia/user-templates.toml.
|
||||||
|
|
||||||
This option accepts:
|
This option accepts:
|
||||||
- a Nix attrset (converted to TOML automatically)
|
- a Nix attrset (converted to TOML automatically)
|
||||||
@@ -135,7 +135,6 @@ in
|
|||||||
|
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
restart = "${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true";
|
|
||||||
useApp2Unit = cfg.settings.appLauncher.useApp2Unit or false;
|
useApp2Unit = cfg.settings.appLauncher.useApp2Unit or false;
|
||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
@@ -169,11 +168,9 @@ in
|
|||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"noctalia/settings.json" = lib.mkIf (cfg.settings != { }) {
|
"noctalia/settings.json" = lib.mkIf (cfg.settings != { }) {
|
||||||
onChange = lib.mkIf (!cfg.systemd.enable) restart;
|
|
||||||
source = generateJson "settings" cfg.settings;
|
source = generateJson "settings" cfg.settings;
|
||||||
};
|
};
|
||||||
"noctalia/colors.json" = lib.mkIf (cfg.colors != { }) {
|
"noctalia/colors.json" = lib.mkIf (cfg.colors != { }) {
|
||||||
onChange = lib.mkIf (!cfg.systemd.enable) restart;
|
|
||||||
source = generateJson "colors" cfg.colors;
|
source = generateJson "colors" cfg.colors;
|
||||||
};
|
};
|
||||||
"noctalia/user-templates.toml" = lib.mkIf (cfg.user-templates != { }) {
|
"noctalia/user-templates.toml" = lib.mkIf (cfg.user-templates != { }) {
|
||||||
|
|||||||
+10
-8
@@ -2,9 +2,11 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
cfg = config.services.noctalia-shell;
|
cfg = config.services.noctalia-shell;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.services.noctalia-shell = {
|
options.services.noctalia-shell = {
|
||||||
enable = lib.mkEnableOption "Noctalia shell systemd service";
|
enable = lib.mkEnableOption "Noctalia shell systemd service";
|
||||||
|
|
||||||
@@ -24,11 +26,11 @@ in {
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
systemd.user.services.noctalia-shell = {
|
systemd.user.services.noctalia-shell = {
|
||||||
description = "Noctalia Shell - Wayland desktop shell";
|
description = "Noctalia Shell - Wayland desktop shell";
|
||||||
documentation = ["https://docs.noctalia.dev/docs"];
|
documentation = [ "https://docs.noctalia.dev/docs" ];
|
||||||
after = [cfg.target];
|
after = [ cfg.target ];
|
||||||
partOf = [cfg.target];
|
partOf = [ cfg.target ];
|
||||||
wantedBy = [cfg.target];
|
wantedBy = [ cfg.target ];
|
||||||
restartTriggers = [cfg.package];
|
restartTriggers = [ cfg.package ];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
PATH = lib.mkForce null;
|
PATH = lib.mkForce null;
|
||||||
@@ -43,6 +45,6 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [cfg.package];
|
environment.systemPackages = [ cfg.package ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-45
@@ -16,10 +16,12 @@
|
|||||||
imagemagick,
|
imagemagick,
|
||||||
wget,
|
wget,
|
||||||
gpu-screen-recorder, # optional
|
gpu-screen-recorder, # optional
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
src = lib.cleanSourceWith {
|
src = lib.cleanSourceWith {
|
||||||
src = ../.;
|
src = ../.;
|
||||||
filter = path: type:
|
filter =
|
||||||
|
path: type:
|
||||||
!(builtins.any (prefix: lib.path.hasPrefix (../. + prefix) (/. + path)) [
|
!(builtins.any (prefix: lib.path.hasPrefix (../. + prefix) (/. + path)) [
|
||||||
/.github
|
/.github
|
||||||
/.gitignore
|
/.gitignore
|
||||||
@@ -36,52 +38,51 @@
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
runtimeDeps =
|
runtimeDeps = [
|
||||||
[
|
brightnessctl
|
||||||
brightnessctl
|
cava
|
||||||
cava
|
cliphist
|
||||||
cliphist
|
ddcutil
|
||||||
ddcutil
|
matugen
|
||||||
matugen
|
wlsunset
|
||||||
wlsunset
|
wl-clipboard
|
||||||
wl-clipboard
|
imagemagick
|
||||||
imagemagick
|
wget
|
||||||
wget
|
]
|
||||||
]
|
++ lib.optionals (stdenvNoCC.hostPlatform.system == "x86_64-linux") [
|
||||||
++ lib.optionals (stdenvNoCC.hostPlatform.system == "x86_64-linux") [
|
gpu-screen-recorder
|
||||||
gpu-screen-recorder
|
];
|
||||||
];
|
|
||||||
in
|
in
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
pname = "noctalia-shell";
|
pname = "noctalia-shell";
|
||||||
inherit version src;
|
inherit version src;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
qt6.wrapQtAppsHook
|
qt6.wrapQtAppsHook
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
qt6.qtbase
|
qt6.qtbase
|
||||||
qt6.qtmultimedia
|
qt6.qtmultimedia
|
||||||
];
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share/noctalia-shell $out/bin
|
mkdir -p $out/share/noctalia-shell $out/bin
|
||||||
cp -r . $out/share/noctalia-shell
|
cp -r . $out/share/noctalia-shell
|
||||||
ln -s ${quickshell}/bin/qs $out/bin/noctalia-shell
|
ln -s ${quickshell}/bin/qs $out/bin/noctalia-shell
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
qtWrapperArgs+=(
|
qtWrapperArgs+=(
|
||||||
--prefix PATH : ${lib.makeBinPath runtimeDeps}
|
--prefix PATH : ${lib.makeBinPath runtimeDeps}
|
||||||
--add-flags "-p $out/share/noctalia-shell"
|
--add-flags "-p $out/share/noctalia-shell"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "A sleek and minimal desktop shell thoughtfully crafted for Wayland, built with Quickshell.";
|
description = "A sleek and minimal desktop shell thoughtfully crafted for Wayland, built with Quickshell.";
|
||||||
homepage = "https://github.com/noctalia-dev/noctalia-shell";
|
homepage = "https://github.com/noctalia-dev/noctalia-shell";
|
||||||
license = lib.licenses.mit;
|
license = lib.licenses.mit;
|
||||||
mainProgram = "noctalia-shell";
|
mainProgram = "noctalia-shell";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user