1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

Add nix flake dev shell, direnv, VSCode extensions, CI

This commit is contained in:
Brenden Matthews 2023-06-24 12:51:09 -04:00
parent eb1649a129
commit 4940070c0a
7 changed files with 146 additions and 52 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

34
.github/workflows/nix.yaml vendored Normal file
View File

@ -0,0 +1,34 @@
name: 'Nix build'
on:
push:
branches:
- main
paths-ignore:
- web/**
- doc/**
pull_request:
branches:
- main
paths-ignore:
- web/**
- doc/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-check:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: conky
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build
- run: nix flake check

9
.gitignore vendored
View File

@ -23,10 +23,15 @@ lua/libimlib2.c
# Compiler cache
.cache
# Ignore vscode stuff
.vscode
# Ignore (most) vscode stuff
.vscode/*
*.code-workspace
# Allow vscode recommended extensions
!.vscode/extensions.json
.idea/
# Ignore nix stuff
/result
# Ignore direnv
.direnv

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"recommendations": [
"kamadorueda.alejandra",
"ms-vscode.cmake-tools",
"mkhl.direnv"
]
}

View File

@ -1,12 +1,15 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"type": "github"
},
"original": {
@ -17,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1677407201,
"narHash": "sha256-3blwdI9o1BAprkvlByHvtEm5HAIRn/XPjtcfiunpY7s=",
"lastModified": 1687502512,
"narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7f5639fa3b68054ca0b062866dc62b22c3f11505",
"rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f",
"type": "github"
},
"original": {
@ -36,6 +39,21 @@
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

112
flake.nix
View File

@ -1,5 +1,5 @@
{
description = "A Nix flake for Conky";
description = "A Nix flake for Conky, including a dev shell";
inputs = {
nixpkgs = {
@ -10,53 +10,77 @@
};
};
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem
(system:
let
outputs = {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
overlays = [self.overlay];
};
in
rec
{
packages = flake-utils.lib.flattenTree {
conky = pkgs.conky;
};
defaultPackage = packages.conky;
apps.conky = flake-utils.lib.mkApp { drv = packages.conky; };
defaultApp = apps.conky;
}
) // {
overlay = final: prev: {
conky = with final; stdenv.mkDerivation rec {
name = "conky";
src = ./.;
nativeBuildInputs = [
clang_15
cmake
git
ninja
pkg-config
];
buildInputs = [
freetype
gettext
imlib2
llvmPackages_15.libcxx
llvmPackages_15.libcxxabi
lua5_4
ncurses
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXext
xorg.libXft
xorg.libXinerama
xorg.libXdamage
xorg.libXfixes
];
with pkgs; rec
{
packages = flake-utils.lib.flattenTree {
conky = conky;
};
defaultPackage = packages.conky;
apps.conky = flake-utils.lib.mkApp {drv = packages.conky;};
defaultApp = apps.conky;
devShells.default = mkShell {
buildInputs =
packages.conky.buildInputs
++ packages.conky.nativeBuildInputs
++ [
alejandra # for beautifying flake
lefthook # for git hooks
nodejs # for web/ stuff
# for docs
(python3.withPackages (ps: with ps; [jinja2]))
];
};
}
)
// {
overlay = final: prev: {
conky = with final;
stdenv.mkDerivation rec {
name = "conky";
src = ./.;
nativeBuildInputs = [
clang_16
cmake
git
llvmPackages_16.clang-unwrapped
ninja
pkg-config
];
buildInputs =
[
freetype
gettext
imlib2
llvmPackages_16.libcxx
llvmPackages_16.libcxxabi
lua5_4
ncurses
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXft
xorg.libXinerama
]
++ lib.optional stdenv.isDarwin darwin.libobjc;
};
};
};
};
}

View File

@ -17,3 +17,8 @@ pre-commit:
npx prettier --write {staged_files} \
&& git add {staged_files}
glob: '*.{md,json,yml,yaml}'
nix-linter:
run: |
alejandra -q {staged_files} \
&& git add {staged_files}
glob: '*.{nix}'