-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add nix flake * Fix readme syntax issue * Format nix flake * ci(build): add nix flake support * ci(build): fix workflow_dispatch casing * ci(build): fix nix flake lock update job * ci: add nix flake lock update timer job old method didn't work * improve example and add cachix info Co-authored-by: Jake Stanger <[email protected]>
- Loading branch information
1 parent
47420d8
commit a3f90ad
Showing
5 changed files
with
300 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: update-nix-flake-lock | ||
on: | ||
workflow_dispatch: # allows manual triggering | ||
schedule: | ||
- cron: '0 0 1 * *' # first day of every month | ||
|
||
jobs: | ||
update-nix-flake-lock: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v16 | ||
with: | ||
extra_nix_config: | | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@vX | ||
with: | ||
pr-title: "Update flake.lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
description = "Nix Flake for ironbar"; | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
#nci.url = "github:yusdacra/nix-cargo-integration"; | ||
#nci.inputs.nixpkgs.follows = "nixpkgs"; | ||
#nci.inputs.rust-overlay.follows = "rust-overlay"; | ||
}; | ||
outputs = { | ||
self, | ||
nixpkgs, | ||
rust-overlay, | ||
... | ||
}: let | ||
inherit (nixpkgs) lib; | ||
genSystems = lib.genAttrs [ | ||
"aarch64-linux" | ||
"x86_64-linux" | ||
]; | ||
pkgsFor = system: | ||
import nixpkgs { | ||
inherit system; | ||
|
||
overlays = [ | ||
self.overlays.default | ||
rust-overlay.overlays.default | ||
]; | ||
}; | ||
mkRustToolchain = pkgs: pkgs.rust-bin.stable.latest.default; | ||
in { | ||
overlays.default = final: prev: let | ||
rust = mkRustToolchain final; | ||
|
||
rustPlatform = prev.makeRustPlatform { | ||
cargo = rust; | ||
rustc = rust; | ||
}; | ||
in { | ||
ironbar = rustPlatform.buildRustPackage { | ||
pname = "ironbar"; | ||
version = self.rev or "dirty"; | ||
src = builtins.path { | ||
name = "ironbar"; | ||
path = prev.lib.cleanSource ./.; | ||
}; | ||
cargoDeps = rustPlatform.importCargoLock {lockFile = ./Cargo.lock;}; | ||
cargoLock.lockFile = ./Cargo.lock; | ||
nativeBuildInputs = with prev; [pkg-config]; | ||
buildInputs = with prev; [gtk3 gdk-pixbuf gtk-layer-shell libxkbcommon]; | ||
}; | ||
}; | ||
packages = genSystems ( | ||
system: let | ||
pkgs = pkgsFor system; | ||
in | ||
(self.overlays.default pkgs pkgs) | ||
// { | ||
default = self.packages.${system}.ironbar; | ||
} | ||
); | ||
devShells = genSystems (system: let | ||
pkgs = pkgsFor system; | ||
rust = mkRustToolchain pkgs; | ||
in { | ||
default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
rust | ||
rust-analyzer-unwrapped | ||
gcc | ||
gtk3 | ||
gtk-layer-shell | ||
pkg-config | ||
]; | ||
|
||
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; | ||
}; | ||
}); | ||
homeManagerModules.default = { | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: let | ||
cfg = config.programs.ironbar; | ||
defaultIronbarPackage = self.packages.${pkgs.system}.default; | ||
jsonFormat = pkgs.formats.json {}; | ||
in { | ||
options.programs.ironbar = { | ||
enable = lib.mkEnableOption "ironbar status bar"; | ||
package = lib.mkOption { | ||
type = with lib.types; package; | ||
default = defaultIronbarPackage; | ||
description = "The package for ironbar to use"; | ||
}; | ||
systemd = lib.mkOption { | ||
type = lib.types.bool; | ||
default = pkgs.stdenv.isLinux; | ||
description = "Whether to enable to systemd service for ironbar"; | ||
}; | ||
style = lib.mkOption { | ||
type = lib.types.lines; | ||
default = ""; | ||
description = "The stylesheet to apply to ironbar"; | ||
}; | ||
config = lib.mkOption { | ||
type = jsonFormat.type; | ||
default = {}; | ||
description = "The config to pass to ironbar"; | ||
}; | ||
}; | ||
config = lib.mkIf cfg.enable { | ||
home.packages = [cfg.package]; | ||
xdg.configFile = { | ||
"ironbar/config.json" = lib.mkIf (cfg.config != "") { | ||
source = jsonFormat.generate "ironbar-config" cfg.config; | ||
}; | ||
"ironbar/style.css" = lib.mkIf (cfg.style != "") { | ||
text = cfg.style; | ||
}; | ||
}; | ||
systemd.user.services.ironbar = lib.mkIf cfg.systemd { | ||
Unit = { | ||
Description = "Systemd service for Ironbar"; | ||
Requires = ["graphical-session.target"]; | ||
}; | ||
Service = { | ||
Type = "simple"; | ||
ExecStart = "${cfg.package}/bin/ironbar"; | ||
}; | ||
Install.WantedBy = [ | ||
(lib.mkIf config.wayland.windowManager.hyprland.systemdIntegration "hyprland-session.target") | ||
(lib.mkIf config.wayland.windowManager.sway.systemdIntegration "sway-session.target") | ||
]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |