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 dev shell, direnv, VSCode extensions #1571

Merged
merged 1 commit into from
Jun 24, 2023
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
34 changes: 34 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"kamadorueda.alejandra",
"ms-vscode.cmake-tools",
"mkhl.direnv"
]
}
30 changes: 24 additions & 6 deletions flake.lock

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

112 changes: 68 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
description = "A Nix flake for Conky";
description = "A Nix flake for Conky, including a dev shell";

inputs = {
nixpkgs = {
Expand All @@ -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;
};
};
};
};
}
5 changes: 5 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'