-
Notifications
You must be signed in to change notification settings - Fork 18
Created NixOS Package & Module #22
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
Changes from 13 commits
5fade22
6f92ecf
d6603a5
98a2ec9
86626c6
e8985a8
900f08d
d0ad803
53a2f59
43fb8bc
2e7a2aa
0139cbd
a045251
e76f88e
6e21bc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,47 +27,47 @@ experience. A successor to HyprPanel without the pain or dependency on Hyprland. | |
| - [x] **Notification Daemon** | ||
| - [x] **Power Profiles** | ||
| - [x] **System Tray** | ||
| - [x] GTK4 Adapter | ||
| - [x] GTK4 Adapter | ||
| - [x] Hyprland | ||
| - [x] **Cava** | ||
|
|
||
| ### UI Components | ||
|
|
||
| - [x] **Component Library** - Base Relm4 widgets and containers | ||
| - [x] **Bar Modules**: | ||
| - [x] Battery | ||
| - [x] Media | ||
| - [x] Volume | ||
| - [x] Network | ||
| - [x] Bluetooth | ||
| - [x] Clock | ||
| - [x] Microphone | ||
| - [x] System tray | ||
| - [x] Notification | ||
| - [x] Dashboard | ||
| - [x] Netstat | ||
| - [x] RAM | ||
| - [x] CPU | ||
| - [x] CPU Temp | ||
| - [x] Storage | ||
| - [x] Separator | ||
| - [x] Power | ||
| - [x] World clock | ||
| - [x] Weather | ||
| - [x] Idle Inhibit | ||
| - [x] Keyboard input | ||
| - [x] Hyprland Window title | ||
| - [x] Hyprland submap | ||
| - [x] Hyprsunset | ||
| - [x] Hyprland workspaces | ||
| - [x] Custom Modules | ||
| - [x] Cava | ||
| - [x] Battery | ||
| - [x] Media | ||
| - [x] Volume | ||
| - [x] Network | ||
| - [x] Bluetooth | ||
| - [x] Clock | ||
| - [x] Microphone | ||
| - [x] System tray | ||
| - [x] Notification | ||
| - [x] Dashboard | ||
| - [x] Netstat | ||
| - [x] RAM | ||
| - [x] CPU | ||
| - [x] CPU Temp | ||
| - [x] Storage | ||
| - [x] Separator | ||
| - [x] Power | ||
| - [x] World clock | ||
| - [x] Weather | ||
| - [x] Idle Inhibit | ||
| - [x] Keyboard input | ||
| - [x] Hyprland Window title | ||
| - [x] Hyprland submap | ||
| - [x] Hyprsunset | ||
| - [x] Hyprland workspaces | ||
| - [x] Custom Modules | ||
| - [x] Cava | ||
|
|
||
| #### Scoped out | ||
|
|
||
| - **Updates** | ||
| - Too much surface area and distro coupling | ||
| - Will be achievable easily via custom modules | ||
| - Too much surface area and distro coupling | ||
| - Will be achievable easily via custom modules | ||
|
|
||
| ### Dropdown Interfaces | ||
|
|
||
|
|
@@ -181,6 +181,172 @@ wayle icons setup | |
| wayle panel start | ||
| ``` | ||
|
|
||
| ## Installation | ||
|
|
||
| <details> | ||
| <summary> <h3> NixOS - Flake </h3> </summary> | ||
|
|
||
| For systems running NixOS, wayle is available to be used as home-manager module | ||
| via a flake. | ||
|
|
||
| First, add wayle to your inputs in your `flake.nix` file: | ||
|
|
||
| ```nix | ||
| # flake.nix | ||
| { | ||
| # ... | ||
| inputs = { | ||
| # ... | ||
| wayle = { | ||
| url = "git+https://github.com/Jas-SinghFSU/wayle"; | ||
| inputs.nixpkgs.follows = "nixpkgs-unstable"; # Optional (not tested on stable nixpkgs) | ||
| }; | ||
| # ... | ||
| }; | ||
| # ... | ||
| } | ||
| ``` | ||
|
|
||
| Note, you must use the path `git+https://github.com/...` since this project uses | ||
| git submodules and the `github://...` path style does not support these. | ||
|
|
||
| Then, still in your `flake.nix` file, add wayle as a module to your home manager | ||
| config. How your home-manager is configured might be slightly different but in | ||
| this example home-manager is configured as a nix-module. The important part is | ||
| adding `inputs.wayle.homeManagerModules.default` to your home-manager shared | ||
| modules list. | ||
|
|
||
| ```nix | ||
| # flake.nix | ||
| { | ||
| # ... | ||
|
|
||
| outputs = { nixpkgs, ... } @ inputs: { | ||
| # ... | ||
| nixosConfigurations.default = nixpkgs.lib.nixosSystem { | ||
| # ... | ||
| modules = [ | ||
| # ... | ||
| inputs.home-manager.nixosModules.home-manager | ||
| { | ||
| home-manager = { | ||
| # ... | ||
|
|
||
| sharedModules = [ | ||
| # ... | ||
|
|
||
| # Adding wayle to the sharedModules list inside of | ||
| # your home manager module is the important part. | ||
| inputs.wayle.homeManagerModules.default | ||
| ]; | ||
| # ... | ||
| }; | ||
| } | ||
| # ... | ||
| ]; | ||
| }; | ||
|
|
||
| # ... | ||
| }; | ||
|
|
||
| } | ||
| ``` | ||
|
|
||
| Finally, you can enable wayle in your `home.nix` file using: | ||
|
|
||
| ```nix | ||
| # home.nix | ||
| { | ||
| config, | ||
| lib, | ||
| pkgs, | ||
| inputs, # Only needed to install the wayle package manually. | ||
| ... | ||
| }: { | ||
| # ... | ||
|
|
||
| services.wayle = { | ||
| enable = true; | ||
| settings = { | ||
| # Put your wayle configuration here. | ||
| }; | ||
|
|
||
| # Uncomment this if you don't want wayle to start automatically: | ||
| # systemd.enable = false; | ||
| }; | ||
|
|
||
| # -- Optional -- | ||
| # If you would like to access the `wayle` and `wayle-shell` commands from | ||
| # your command line, then remember to add wayle as a package to your home | ||
| # environment using the following. | ||
| # | ||
| # This is required if you set `services.wayle.systemd.enable = false` | ||
| # above. Otherwise you will have no way to start wayle. | ||
| home.packages = with pkgs; [ | ||
| # ... | ||
| inputs.wayle.packages.${stdenv.hostPlatform.system}.default | ||
| # ... | ||
| ]; | ||
|
|
||
| # ... | ||
| } | ||
| ``` | ||
|
|
||
| #### Notes on using NixOS | ||
|
|
||
| ##### Icons | ||
|
|
||
| This nix package will automatically install the icons for you so you don't need | ||
| to worry about running `wayle icons setup`. | ||
|
|
||
| ##### Live Config Reloading | ||
|
|
||
| NixOS will generate the wayle `config.toml` file for you using the config you | ||
| wrote for wayle in your `home.nix` file. Unfortunately, this misses out on | ||
| wayle's live config reloading feature. To work around this and configure wayle | ||
| without rebuilding your home-manager config everytime and to allow utilizing the | ||
| `wayle config` the following steps are recommended: | ||
|
|
||
| 1. Move the nix-made symlink config file to a new path and make a clone of it to | ||
| be used as a starting point with: | ||
| ```bash | ||
| mv ~/.config/wayle/config.toml{,.bak} | ||
| cp ~/.config/wayle/config.toml{.bak,} | ||
| ``` | ||
|
|
||
| 2. Modify the config file at `~/.config/wayle/config.toml` either manually or by | ||
| using the `wayle config <cmd>` commands until you are happy with your | ||
| configuration. | ||
|
|
||
| 3. Translate your new config from the TOML syntax of the | ||
| `~/.config/wayle/config.toml` file into nix syntax in your `home.nix` file at | ||
| `services.wayle.settings = { # settings go here }`. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW you can automate this using $ nix repl
nix-repl> :p builtins.fromTOML (builtins.readFile ./config.toml)
{
bar = {
layout = [
{
center = [ "window-title" ];
left = [
"hyprland-workspaces"
"cava"
"media"
];
monitor = "*";
}
];
};
}
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is amazing to know, thank you. |
||
|
|
||
| 4. Move the original config symlink back (this will overwrite whatever changes | ||
| you may have made and return you to the config defined by your nix config). | ||
| ```bash | ||
| mv ~/.config/wayle/config.toml{.bak,} | ||
| ``` | ||
|
|
||
| 5. Rebuild your home-manager config and the new settings will be applied. | ||
|
|
||
| This method allows you to configure wayle efficiently and benefit from its live | ||
| config reloading and command line features, while still declaratively writing | ||
| your config using nix. | ||
|
|
||
| **CAUTION:** Home manager will automatically move any existing config to a | ||
| `config.toml.hm-bak`, or similar, backup file name. This is expected, however, | ||
| wayle will automatically create a _new_ `config.toml` file if you moved the | ||
| symlink make by home-manager and didn't move it back. If this occurs, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For me, home-manager just crashes and doesn't update symlinks at all. Maybe there is a setting?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will look into this.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have home-manager configured as a module in my main flake and I have the following option set in its config: # Inside "inputs.nixpkgs.lib.nixosSystem {...}":
modules = [
...
{
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
...
backupFileExtension = "hm-bak";
...
};
}
}
...This must be the difference that causes your homemanager to fail to take over and generate the symlinks. However I don't have an easy solution for users who don't want to set this option because wayle seems to automatically generate a new file at any opportunitiy which will need either backing up or removing manually without the option. |
||
| home-manager will try to move the new `config.toml` (non-symlink) file to | ||
| `config.toml.hm-bak` (or similar) _again_ and fail because that back up file | ||
| already exists. If you are rebuilding with nix, and it is failing, check if your | ||
| `~/.config/wayle` directory contains these non-symlinked files and remove or | ||
| re-backup them to a different file name. Home assistant seems to give very | ||
| little to no feedback when this error occurs. | ||
|
|
||
| </details> | ||
|
|
||
| ## Icons | ||
|
|
||
| Wayle uses GTK symbolic icons that support CSS color theming. | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { | ||
| description = "A fast, configurable desktop environment shell for Wayland compositors."; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
| fenix = { | ||
| url = "github:nix-community/fenix"; | ||
| inputs.nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
| self.submodules = true; | ||
| }; | ||
|
|
||
| outputs = { | ||
| self, | ||
| nixpkgs, | ||
| ... | ||
| } @ inputs: let | ||
| inherit (nixpkgs) lib; | ||
|
|
||
| supportedSystems = [ | ||
| "x86_64-linux" # 64-bit Intel/AMD Linux | ||
| "aarch64-linux" # 64-bit ARM Linux | ||
| ]; | ||
| forAllSystems = lib.genAttrs supportedSystems; | ||
| in { | ||
| packages = forAllSystems (system: let | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
| toolchain = inputs.fenix.packages.${system}.minimal.toolchain; | ||
|
|
||
| rustPlatform = pkgs.makeRustPlatform { | ||
| cargo = toolchain; | ||
| rustc = toolchain; | ||
| }; | ||
| in { | ||
| default = self.packages.${system}.wayle; | ||
| wayle = | ||
| (pkgs.callPackage ./nix/package.nix { | ||
| inherit rustPlatform; | ||
| }).overrideAttrs ( | ||
| oldAttrs: { | ||
| src = self; | ||
| } | ||
| ); | ||
| }); | ||
|
|
||
| homeManagerModules = { | ||
| default = self.homeManagerModules.wayle; | ||
| wayle = import ./nix/modules/flake-home-manager.nix self; | ||
| }; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # This is just a wrapper for the main wayle home manager module that is only | ||
| # called by the flake. | ||
| # | ||
| # It simply overrides the default package for the service to the one | ||
| # defined/used by the flake, which itself constructs the package using rust | ||
| # nightly. This probably won't be the case forever which is why the actual | ||
| # modules has been made separate for (when the time comes) easier porting to | ||
| # wayle being a regular nix home manager package. | ||
| self: { | ||
| config, | ||
| lib, | ||
| pkgs, | ||
| ... | ||
| } @ s: | ||
| import ./home-manager.nix ( | ||
| s | ||
| // { | ||
| pkgs = | ||
| pkgs | ||
| // { | ||
| wayle = self.packages.${pkgs.stdenv.system}.wayle; | ||
| }; | ||
| } | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider this section a bit redundant since this is unfortunately the case for every software in Nix, and it cannot be fixed. Thus, every user already knows how to work around that. If the user already managed to climb Nix's learning curve...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I suppose that is true. I think I was possible just trying to soften that curve a little bit, even if it was just for a handful of people.
That graphic is also fantastic.