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 nix flake #519

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ jobs:
run: |
gmake t && gmake build
Build-test-nix-flake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- name: Build flake
run: nix build
- name: Use flake devShell
run: nix develop

Releaser:
runs-on: ubuntu-latest
steps:
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

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

71 changes: 71 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
description = "A very basic flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};

outputs = { self, nixpkgs }:
let
version = "v0.8.4";

supportedSystems = [ "x86_64-linux" "aarch64-linux" ];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.stdenv.mkDerivation {
pname = "ibus-bamboo";
inherit version;

src = ./.;

nativeBuildInputs = [
pkgs.pkg-config
pkgs.wrapGAppsHook3
pkgs.go
];

buildInputs = [
pkgs.xorg.libXtst
];

preConfigure = ''
export GOCACHE="$TMPDIR/go-cache"
sed -i "s,/usr,$out," data/bamboo.xml
'';

makeFlags = [
"PREFIX=${placeholder "out"}"
];
};
}
);

devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.pkg-config
pkgs.wrapGAppsHook3
pkgs.go
];

buildInputs = [
pkgs.xorg.libXtst
];
};
}
);
};
}