-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
74 lines (66 loc) · 1.79 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{
self,
nixpkgs,
rust-overlay,
...
}:
let
overlays = [ (import rust-overlay) ];
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: function (import nixpkgs { inherit system overlays; }));
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
mkDate =
longDate:
(nixpkgs.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
name = "hypr-socket-watch-shell";
buildInputs = with pkgs; [
cargo
rust-bin.stable.latest.default
rustfmt
clippy
openssl
];
nativeBuildInputs = with pkgs; [ pkg-config ];
};
});
homeManagerModules = {
default = self.homeManagerModules.hypr-socket-watch;
hypr-socket-watch = import ./nix/hm-module.nix self;
};
overlays.default = final: prev: {
hypr-socket-watch = final.callPackage ./nix/default.nix {
version =
version
+ "+date="
+ (mkDate (self.lastModifiedDate or "19700101"))
+ "_"
+ (self.shortRev or "dirty");
};
};
packages = forAllSystems (
pkgs:
let
packages = self.overlays.default pkgs pkgs;
in
packages // { default = packages.hypr-socket-watch; }
);
};
}