Skip to content

Commit

Permalink
Add Nix flake.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsx-udscbt authored and wash2 committed Jan 4, 2023
1 parent c58c3fc commit 37fd3fd
Show file tree
Hide file tree
Showing 3 changed files with 243 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target/
/result
178 changes: 178 additions & 0 deletions flake.lock

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

64 changes: 64 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
description = "Settings daemon 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;

pkgDef = {
src = nix-filter.lib.filter {
root = ./.;
include = [
./src
./Cargo.toml
./Cargo.lock
];
};
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [
systemd # For libudev
];
};

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

packages.default = cosmic-settings-daemon;

apps.default = flake-utils.lib.mkApp {
drv = cosmic-settings-daemon;
};

devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks.${system};
};
});

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 37fd3fd

Please sign in to comment.