cleanup nix

Co-authored-by: uku <hi@uku.moe>
This commit is contained in:
eymeric
2024-04-09 17:10:38 +02:00
parent e3fd1382e9
commit 8e24a2cb63
4 changed files with 53 additions and 74 deletions

1
.gitignore vendored
View File

@@ -35,6 +35,7 @@ packaging/conda/meta.yaml
#nix
.direnv/
result
# CLion

39
flake.lock generated
View File

@@ -2,7 +2,9 @@
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
@@ -20,36 +22,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1712512205,
"narHash": "sha256-CrKKps0h7FoagRcE2LT3h/72Z64D0Oh83UF1XZVhCLQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3c1b6f75344e207a67536d834886ee9b4577ebe7",
"type": "github"
"lastModified": 1712163089,
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
"path": "/nix/store/n2g5cqwv8qf5p6vjxny6pg3blbdij12k-source",
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
"type": "path"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {

View File

@@ -1,33 +1,34 @@
{
description = "Description for the project";
description = "C++ UML diagram generator based on Clang";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "nixpkgs";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
packages.default = config.packages.clang-uml;
packages.clang-uml = pkgs.callPackage packaging/nix/default.nix { };
perSystem = {
self',
pkgs,
...
}: {
packages = {
default = self'.packages.clang-uml;
clang-uml = pkgs.callPackage ./packaging/nix {};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# C++ Compiler is already part of stdenv
cmake
llvmPackages_latest.libllvm
yaml-cpp
ccache
elfutils
pkg-config
clang
libclang
];
inputsFrom = [self'.packages.clang-uml];
};
formatter = pkgs.alejandra;
};
};
}

View File

@@ -1,34 +1,30 @@
{ pkgs ? import <nixpkgs> {} }:
# Nix derivation for basic C++ project using clang
with pkgs; stdenv.mkDerivation {
{
stdenv,
cmake,
pkg-config,
installShellFiles,
libclang,
libllvm,
yaml-cpp,
}:
stdenv.mkDerivation {
name = "clang-uml";
src = ../..;
buildInputs = [
clang
libclang
nativeBuildInputs = [
cmake
llvmPackages_latest.libllvm
yaml-cpp
ccache
elfutils
pkg-config
installShellFiles
];
dontUseCmakeConfigure = true;
buildInputs = [
libclang
libllvm
yaml-cpp
];
buildPhase = "CCACHE_DIR=/build/.ccache make release";
installPhase = ''
mkdir -p $out/bin
cp release/src/clang-uml $out/bin/clang-uml
postInstall = ''
installShellCompletion --bash $src/packaging/autocomplete/clang-uml
installShellCompletion --zsh $src/packaging/autocomplete/_clang-uml
'';
postInstall = "
installShellCompletion --cmd clang-uml \
--zsh packaging/autocomplete/_clang-uml
--bach packaging/autocomplete/clang-uml
";
}