Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add known_data_files and a few more config files #363

Merged
merged 11 commits into from
Sep 24, 2024
4 changes: 3 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ pkgs ? import <nixpkgs> { } }:
{
pkgs ? import <nixpkgs> { },
}:
rec {
docs = import ./docs {
inherit pkgs;
Expand Down
47 changes: 31 additions & 16 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{ pkgs, lib, ... }:
let
dontCheckModules = { _module.check = false; };
modules = [ ../modules dontCheckModules ];
dontCheckModules = {
_module.check = false;
};
modules = [
../modules
dontCheckModules
];

githubDeclaration = user: repo: branch: subpath: {
url = "https://github.com/${user}/${repo}/blob/${branch}/${subpath}";
Expand All @@ -10,30 +15,40 @@ let

pmPath = toString ./..;
transformOptions =
opt: opt // {
declarations = (map
(decl:
if (lib.hasPrefix pmPath (toString decl)) then (githubDeclaration "nix-community" "plasma-manager" "trunk" (lib.removePrefix "/" (lib.removePrefix pmPath (toString decl)))) else decl)
opt.declarations);
opt:
opt
// {
declarations = (
map (
decl:
if (lib.hasPrefix pmPath (toString decl)) then
(githubDeclaration "nix-community" "plasma-manager" "trunk" (
lib.removePrefix "/" (lib.removePrefix pmPath (toString decl))
))
else
decl
) opt.declarations
);
};

buildOptionsDocs = (args@{ modules, ... }:
buildOptionsDocs = (
args@{ modules, ... }:
let
opts = (lib.evalModules {
inherit modules;
class = "homeManager";
}).options;
opts =
(lib.evalModules {
inherit modules;
class = "homeManager";
}).options;
options = builtins.removeAttrs opts [ "_module" ];
in
pkgs.buildPackages.nixosOptionsDoc {
inherit options;
inherit transformOptions;
warningsAreErrors = false;
});
}
);

pmOptionsDoc = buildOptionsDocs {
inherit modules;
};
pmOptionsDoc = buildOptionsDocs { inherit modules; };
plasma-manager-options = pkgs.callPackage ./plasma-manager-options.nix {
nixos-render-docs = pkgs.nixos-render-docs;
plasma-manager-options = pmOptionsDoc.optionsJSON;
Expand Down
13 changes: 7 additions & 6 deletions docs/plasma-manager-options.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{ stdenv
, nixos-render-docs
, plasma-manager-options
, revision
, lib
, documentation-highlighter
{
stdenv,
nixos-render-docs,
plasma-manager-options,
revision,
lib,
documentation-highlighter,
}:
let
outputPath = "share/doc/plasma-manager";
Expand Down
6 changes: 4 additions & 2 deletions examples/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@
#
shortcuts = {
ksmserver = {
"Lock Session" = [ "Screensaver" "Meta+Ctrl+Alt+L" ];
"Lock Session" = [
"Screensaver"
"Meta+Ctrl+Alt+L"
];
};

kwin = {
Expand All @@ -262,7 +265,6 @@
};
};


#
# Some low-level settings:
#
Expand Down
15 changes: 6 additions & 9 deletions examples/homeManager/home.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{ pkgs, ... }:

{
imports = [
<plasma-manager/modules>
];
imports = [ <plasma-manager/modules> ];

programs.plasma = {
enable = true;
Expand Down Expand Up @@ -41,19 +39,19 @@
{
location = "top";
height = 26;
widgets = [
"org.kde.plasma.appmenu"
];
widgets = [ "org.kde.plasma.appmenu" ];
}
];


#
# Some mid-level settings:
#
shortcuts = {
ksmserver = {
"Lock Session" = [ "Screensaver" "Meta+Ctrl+Alt+L" ];
"Lock Session" = [
"Screensaver"
"Meta+Ctrl+Alt+L"
];
};

kwin = {
Expand All @@ -65,7 +63,6 @@
};
};


#
# Some low-level settings:
#
Expand Down
8 changes: 7 additions & 1 deletion examples/homeManagerFlake/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
};
};

outputs = inputs@ { nixpkgs, home-manager, plasma-manager, ... }:
outputs =
inputs@{
nixpkgs,
home-manager,
plasma-manager,
...
}:
let
# Replace with your username
username = "jdoe";
Expand Down
8 changes: 7 additions & 1 deletion examples/systemFlake/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
};
};

outputs = inputs@ { nixpkgs, home-manager, plasma-manager, ... }:
outputs =
inputs@{
nixpkgs,
home-manager,
plasma-manager,
...
}:
let
# Replace with your username
username = "jdoe";
Expand Down
74 changes: 39 additions & 35 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs@{ self, ... }:
outputs =
inputs@{ self, ... }:
let
# Systems that can run tests:
supportedSystems = [
Expand All @@ -21,34 +22,38 @@
forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;

# Attribute set of nixpkgs for each system:
nixpkgsFor = forAllSystems (system:
import inputs.nixpkgs { inherit system; });
nixpkgsFor = forAllSystems (system: import inputs.nixpkgs { inherit system; });
in
{
homeManagerModules.plasma-manager = { ... }: {
imports = [ ./modules ];
};
homeManagerModules.plasma-manager =
{ ... }:
{
imports = [ ./modules ];
};

packages = forAllSystems (system:
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
docs = import ./docs {
inherit pkgs;
lib = pkgs.lib;
};
in {
in
{
default = self.packages.${system}.rc2nix;

demo = (inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(import test/demo.nix {
home-manager-module = inputs.home-manager.nixosModules.home-manager;
plasma-module = self.homeManagerModules.plasma-manager;
})
(_: { environment.systemPackages = [ self.packages.${system}.rc2nix ]; })
];
}).config.system.build.vm;
demo =
(inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(import test/demo.nix {
home-manager-module = inputs.home-manager.nixosModules.home-manager;
plasma-module = self.homeManagerModules.plasma-manager;
})
(_: { environment.systemPackages = [ self.packages.${system}.rc2nix ]; })
];
}).config.system.build.vm;

docs-html = docs.html;
docs-json = docs.json;
Expand All @@ -58,7 +63,8 @@
runtimeInputs = with pkgs; [ python3 ];
text = ''python3 ${script/rc2nix.py} "$@"'';
};
});
}
);

apps = forAllSystems (system: {
default = self.apps.${system}.rc2nix;
Expand All @@ -74,28 +80,26 @@
};
});

checks = forAllSystems (system:
{
default = nixpkgsFor.${system}.callPackage ./test/basic.nix {
home-manager-module = inputs.home-manager.nixosModules.home-manager;
plasma-module = self.homeManagerModules.plasma-manager;
};
});
checks = forAllSystems (system: {
default = nixpkgsFor.${system}.callPackage ./test/basic.nix {
home-manager-module = inputs.home-manager.nixosModules.home-manager;
plasma-module = self.homeManagerModules.plasma-manager;
};
});

formatter = forAllSystems (system: nixpkgsFor.${system}.treefmt);

devShells = forAllSystems (system: {
default = nixpkgsFor.${system}.mkShell {
buildInputs = with nixpkgsFor.${system}; [
nixfmt-rfc-style
ruby
ruby.devdoc
(
python3.withPackages (
pyPkgs: [
pyPkgs.python-lsp-server
pyPkgs.black
pyPkgs.isort
]
)
)
(python3.withPackages (pyPkgs: [
pyPkgs.python-lsp-server
pyPkgs.black
pyPkgs.isort
]))
];
};
});
Expand Down
17 changes: 7 additions & 10 deletions lib/colorscheme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ let
"Colors:Window" = colorUIKeys;
};
in
(lib.mkMerge
(lib.mapAttrsToList
(group: keys: {
"kdeglobals"."${group}" = (lib.mkMerge
(map
(key:
{ "${key}"."persistent" = (lib.mkDefault true); })
keys));
})
ignoreKeys))
(lib.mkMerge (
lib.mapAttrsToList (group: keys: {
"kdeglobals"."${group}" = (
lib.mkMerge (map (key: { "${key}"."persistent" = (lib.mkDefault true); }) keys)
);
}) ignoreKeys
))
14 changes: 10 additions & 4 deletions lib/panel.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ lib, config, ... }:
let
widgets = (import ../modules/widgets { inherit lib; });
panelToLayout = panel:
panelToLayout =
panel:
let
inherit (widgets.lib) addWidgetStmts stringIfNotNull;
inherit (lib) boolToString;
Expand All @@ -14,9 +15,14 @@ let
'';
in
''
${if (panel.screen == "all") then "for (screenID = 0; screenID < screenCount; screenID++)"
else if (builtins.isList panel.screen) then "for (var screenID in [${builtins.concatStringsSep "," (map builtins.toString panel.screen)}])"
else ""}
${
if (panel.screen == "all") then
"for (screenID = 0; screenID < screenCount; screenID++)"
else if (builtins.isList panel.screen) then
"for (var screenID in [${builtins.concatStringsSep "," (map builtins.toString panel.screen)}])"
else
""
}
{
const panel = new Panel();
panel.height = ${toString panel.height};
Expand Down
Loading
Loading