Nix: cleaner code

This commit is contained in:
wxlyyy
2025-11-21 02:22:57 +08:00
parent e9114297d1
commit 04311f191f
5 changed files with 12 additions and 46 deletions

18
flake.lock generated
View File

@@ -18,23 +18,7 @@
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
"nixpkgs": "nixpkgs"
}
}
},

View File

@@ -3,24 +3,21 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs = {
self,
nixpkgs,
systems,
...
}: let
eachSystem = nixpkgs.lib.genAttrs (import systems);
eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system}.appendOverlays [self.overlays.default]);
in {
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
packages = eachSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system}.appendOverlays [self.overlays.default];
in {
default = pkgs.noctalia-shell;
system: {
default = pkgsFor.${system}.noctalia-shell;
}
);
@@ -42,10 +39,8 @@
};
devShells = eachSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.callPackage ./nix/shell.nix {};
system: {
default = pkgsFor.${system}.callPackage ./nix/shell.nix {};
}
);
@@ -58,9 +53,6 @@
programs.noctalia-shell.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.default;
programs.noctalia-shell.app2unit.package =
lib.mkDefault
nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.app2unit;
};
nixosModules.default = {

View File

@@ -89,6 +89,7 @@ in {
app2unit.package = lib.mkOption {
type = lib.types.package;
default = pkgs.app2unit;
description = ''
The app2unit package to use when appLauncher.useApp2Unit is enabled.
'';
@@ -96,9 +97,7 @@ in {
};
config = let
restart = ''
${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true
'';
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 {

View File

@@ -24,7 +24,7 @@ in {
config = lib.mkIf cfg.enable {
systemd.user.services.noctalia-shell = {
description = "Noctalia Shell - Wayland desktop shell";
documentation = ["https://github.com/noctalia-dev/noctalia-shell"];
documentation = ["https://docs.noctalia.dev/docs"];
after = [cfg.target];
partOf = [cfg.target];
wantedBy = [cfg.target];
@@ -34,17 +34,9 @@ in {
PATH = lib.mkForce null;
};
unitConfig = {
StartLimitIntervalSec = 60;
StartLimitBurst = 3;
};
serviceConfig = {
ExecStart = "${cfg.package}/bin/noctalia-shell";
ExecStart = lib.getExe cfg.package;
Restart = "on-failure";
RestartSec = 3;
TimeoutStartSec = 10;
TimeoutStopSec = 5;
Environment = [
"NOCTALIA_SETTINGS_FALLBACK=%h/.config/noctalia/gui-settings.json"
];

View File

@@ -26,7 +26,6 @@
/.github
/.gitignore
/Assets/Screenshots
/Assets/Wallpaper
/Bin/dev
/nix
/LICENSE