Skip to content

Commit

Permalink
flake.nix: reformated
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-null-undefined committed Oct 25, 2023
1 parent 5f39f61 commit e7682f1
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@
libpng12
zlib
];
in rec {

program-name = "ascii-art";
in {
apps = {
default = {
type = "app";
program = self.packages.${system}.ascii-art + "/bin/ascii-art";
program = self.packages.${system}.${program-name} + "/bin/${program-name}";
};
};

defaultApp = {
type = "app";
program = self.packages.${system}.ascii-art + "/bin/ascii-art";
program = self.packages.${system}.${program-name} + "/bin/${program-name}";
};

devShell = pkgs.devshell.mkShell {
name = "ascii-art";
name = "${program-name}";
imports = ["${devshell}/extra/language/c.nix"];
packages = with pkgs; [glibc libcxx doxygen graphviz];
packages = with pkgs; [gcc glibc libcxx doxygen graphviz ];

language.c = {
libraries = libs;
Expand Down Expand Up @@ -77,39 +79,32 @@
}
];
bash = {
interactive = "zsh";
extra = ''
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
export LIBRARY_PATH="$LD_LIBRARY_PATH"
'';
};
};

defaultPackage = self.packages.${system}.ascii-art;
defaultPackage = self.packages.${system}.${program-name};

packages = {
ascii-art = let
inherit system;
pname = "ascii-art";
${program-name} = let
pname = "${program-name}";
version = "v0.1.2";
in
pkgs.stdenv.mkDerivation {
pname = pname;
version = version;
inherit pname version;
src = pkgs.fetchFromGitHub {
owner = "dev-null-undefined";
repo = pname;
rev = version;
sha256 = "sha256-dQJjBH0gxn8FBMyyC9DRYOergOUzns/+jUNJ1KSVTtk=";
fetchSubmodules = true;
};
buildInputs = libs;
configurePhase = ''
${pkgs.gnumake}/bin/make clean
'';
buildPhase = ''
${pkgs.gnumake}/bin/make fast
'';

buildInputs = libs ++ [ pkgs.doxygen ];

installPhase = ''
mkdir -p $out/bin
mv bin/${pname} $out/bin/
Expand All @@ -122,7 +117,14 @@
platforms = platforms.linux;
};
};
default = self.packages.${system}.ascii-art;
default = self.packages.${system}.${program-name};
};

formatter = pkgs.alejandra;

cmake-helper = {
libs = builtins.map builtins.toString (builtins.map pkgs.lib.getLib libs);
includes = builtins.map builtins.toString (builtins.map pkgs.lib.getDev libs);
};
});
}

0 comments on commit e7682f1

Please sign in to comment.