Skip to content

Commit

Permalink
Added a flake.nix with cachix for nix build support
Browse files Browse the repository at this point in the history
  • Loading branch information
WombatFromHell committed Feb 1, 2025
1 parent 6714f4d commit f70a2df
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Upload Binary
name: Build and Upload AppImage Binary

on:
workflow_dispatch:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Nix Build and Cache"
on:
workflow_dispatch:
inputs:
branch:
description: "main build"
required: true
default: "main"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: wombatfromhell
authToken: "${{ secrets.CACHIX_TOKEN }}"
- run: nix build . --print-out-paths
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
veridian-controller.toml
target
result
veridian-controller.toml
94 changes: 94 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
description = "Veridian Controller";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
};

nixConfig = {
extra-substituters = [
"https://wombatfromhell.cachix.org/"
];
extra-trusted-public-keys = [
"wombatfromhell.cachix.org-1:pyIVJJkoLxkjH/MKK1ylrrdJKPpm+aXLeD2zAqVk9lA="
];
};

outputs = {
self,
nixpkgs,
flake-utils,
naersk,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
naersk' = pkgs.callPackage naersk {};
in {
packages = {
veridian-controller = naersk'.buildPackage {
pname = "veridian-controller";
version = "0.2.6";
src = ./.;
};
default = self.packages.${system}.veridian-controller;
};

overlays.default = final: prev: {
veridian-controller = self.packages.${prev.system}.veridian-controller;
};

apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
};
})
// {
nixosModules.default = {
config,
pkgs,
...
}: {
nixpkgs.overlays = [self.overlays.default];
};
};
}
22 changes: 22 additions & 0 deletions unit-example.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# include this module in your home-manager config
{
pkgs, # make sure to include the input from your flake
...
}: let
moduleName = "veridian-controller";
description = "Veridian Controller User Fan Service";
in {
# systemd user service to start the fan controller on startup
systemd.user.services."${moduleName}" = {
Unit = {
Description = "${description}";
};
Service = {
Type = "simple";
ExecStart = "${pkgs.${moduleName}}/bin/${moduleName}";
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
}

0 comments on commit f70a2df

Please sign in to comment.