Skip to content

Commit

Permalink
Merge pull request #44 from pop-os/add-flake_nobuild
Browse files Browse the repository at this point in the history
Add flake files
  • Loading branch information
jackpot51 authored Nov 14, 2023
2 parents 0309a9a + 1d49b2e commit 67b3d8f
Show file tree
Hide file tree
Showing 2 changed files with 223 additions and 0 deletions.
137 changes: 137 additions & 0 deletions flake.lock

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

86 changes: 86 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
description = "Text Editor application for the COSMIC desktop environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-utils, nix-filter, crane, fenix }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.stable.toolchain;
crateNameFromCargoToml = craneLib.crateNameFromCargoToml {cargoToml = ./Cargo.toml;};
pkgDef = {
inherit (crateNameFromCargoToml) pname version;
src = nix-filter.lib.filter {
root = ./.;
include = [
./src
./Cargo.toml
./Cargo.lock
./i18n
./i18n.toml
./justfile
];
};
nativeBuildInputs = with pkgs; [
gtk3
just
pkg-config
autoPatchelfHook
];
buildInputs = with pkgs; [
systemdMinimal
bashInteractive
libxkbcommon
freetype
fontconfig
expat
lld
desktop-file-utils
stdenv.cc.cc.lib
libinput
];
};

cargoArtifacts = craneLib.buildDepsOnly pkgDef;
cosmic-edit= craneLib.buildPackage (pkgDef // {
inherit cargoArtifacts;
});
in {
checks = {
inherit cosmic-edit;
};

apps.default = flake-utils.lib.mkApp {
drv = cosmic-edit;
};
packages.default = cosmic-edit.overrideAttrs (oldAttrs: rec {
installPhase = ''
just prefix=$out install
'';
});

devShells.default = pkgs.mkShell rec {
inputsFrom = builtins.attrValues self.checks.${system};
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath (builtins.concatMap (d: d.runtimeDependencies) inputsFrom);
};
});

nixConfig = {
# Cache for the Rust toolchain in fenix
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
}

0 comments on commit 67b3d8f

Please sign in to comment.