mirror of
https://github.com/elkowar/eww.git
synced 2024-10-03 22:48:31 +03:00
heavily refactor nix flake (#532)
* heavily refactor nix flake * move from legacy rust-toolchain to rust-toolchain.toml
This commit is contained in:
parent
25105c7c4f
commit
6657ef493e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
/target
|
||||
/**/target
|
||||
/result
|
||||
/result-*
|
||||
|
102
flake.lock
102
flake.lock
@ -1,26 +1,5 @@
|
||||
{
|
||||
"nodes": {
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654237591,
|
||||
"narHash": "sha256-+uOzx9fuo3CBHO7aGI+SKxDXpf/7NTOXi0g4UxOdk9k=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "8dccfbe51a8adea643ec29a4ec516499a5a081c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -39,11 +18,11 @@
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -52,76 +31,47 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1653413650,
|
||||
"narHash": "sha256-wojDHjb+eU80MPH+3HQaK0liUy8EgR95rvmCl24i58Y=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "69daaceebe12c070cd5ae69ba38f277bbf033695",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1654126564,
|
||||
"narHash": "sha256-sgDXDKGmUG4h7OPDOHyQggFQ08ZqVzUIPi8351yhugY=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1660639432,
|
||||
"narHash": "sha256-2WDiboOCfB0LhvnDVMXOAr8ZLDfm3WdO54CkoDPwN1A=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f1c9c23aad972787f00f175651e4cb0d7c7fd5ea",
|
||||
"rev": "6c6409e965a6c883677be7b9d87a95fab6c3472e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1654126564,
|
||||
"narHash": "sha256-sgDXDKGmUG4h7OPDOHyQggFQ08ZqVzUIPi8351yhugY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f1c9c23aad972787f00f175651e4cb0d7c7fd5ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"type": "indirect"
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"fenix": "fenix",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1654178556,
|
||||
"narHash": "sha256-LG8J9E/wMBolkWS3VstuvhgQ4jOp3Nk328EXlCYY24U=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "88024c7ec2d44a8be8bf05a6580409200cf726fc",
|
||||
"lastModified": 1660791450,
|
||||
"narHash": "sha256-I3q06x8HkjavfzvQm2nlGjYwclKfYRYjo3x9jqKBSgA=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "98db932adeee26ea311ba4bbbdf4e0e5c3569fc4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
|
116
flake.nix
116
flake.nix
@ -1,76 +1,76 @@
|
||||
{
|
||||
inputs = {
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
||||
naersk.url = "github:nmattia/naersk";
|
||||
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
outputs = { self, flake-utils, fenix, nixpkgs, naersk, flake-compat, ... }:
|
||||
flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
toolchain = fenix.packages.${system}.latest;
|
||||
|
||||
naersk-lib = (naersk.lib."${system}".override {
|
||||
inherit (toolchain) cargo rustc;
|
||||
});
|
||||
outputs = { self, nixpkgs, rust-overlay, flake-compat, ... }:
|
||||
let
|
||||
pkgsFor = system: import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
mkEww = { wayland ? false }:
|
||||
naersk-lib.buildPackage {
|
||||
pname = "eww";
|
||||
src = builtins.path { name = "eww"; path = ./.; };
|
||||
overlays = [
|
||||
self.overlays.default
|
||||
rust-overlay.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [ pkg-config gtk3 ];
|
||||
buildInputs = pkgs.lib.optional wayland pkgs.gtk-layer-shell;
|
||||
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
|
||||
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev:
|
||||
let
|
||||
rust = mkRustToolchain final;
|
||||
|
||||
cargoBuildOptions = opts: opts ++ pkgs.lib.optionals wayland [
|
||||
"--no-default-features"
|
||||
"--features=wayland"
|
||||
];
|
||||
rustPlatform = prev.makeRustPlatform {
|
||||
cargo = rust;
|
||||
rustc = rust;
|
||||
};
|
||||
in
|
||||
{
|
||||
apps = rec {
|
||||
default = eww;
|
||||
eww = flake-utils.lib.mkApp { drv = self.packages.${system}.eww; };
|
||||
eww-wayland = flake-utils.lib.mkApp { drv = self.packages.${system}.eww-wayland; };
|
||||
in
|
||||
{
|
||||
eww = (prev.eww.override { inherit rustPlatform; }).overrideAttrs (old: {
|
||||
version = self.rev or "dirty";
|
||||
src = builtins.path { name = "eww"; path = prev.lib.cleanSource ./.; };
|
||||
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
|
||||
patches = [ ];
|
||||
});
|
||||
|
||||
eww-wayland = final.eww.override { withWayland = true; };
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
default = eww;
|
||||
eww = mkEww { };
|
||||
eww-wayland = mkEww { wayland = true; };
|
||||
};
|
||||
packages = nixpkgs.lib.genAttrs targetSystems (system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
(self.overlays.default pkgs pkgs) // {
|
||||
default = self.packages.${system}.eww;
|
||||
}
|
||||
);
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = builtins.attrValues {
|
||||
inherit (toolchain)
|
||||
cargo
|
||||
rustc
|
||||
rust-src
|
||||
clippy-preview
|
||||
rustfmt-preview;
|
||||
|
||||
inherit (pkgs)
|
||||
rust-analyzer
|
||||
devShells = nixpkgs.lib.genAttrs targetSystems (system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
rust = mkRustToolchain pkgs;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rust
|
||||
rust-analyzer-unwrapped
|
||||
gcc
|
||||
gtk3
|
||||
gtk-layer-shell
|
||||
pkg-config
|
||||
deno
|
||||
mdbook;
|
||||
};
|
||||
mdbook
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
});
|
||||
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
nightly-2022-04-13
|
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
@ -0,0 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2022-04-13"
|
||||
components = [ "rust-src" ]
|
||||
profile = "default"
|
Loading…
Reference in New Issue
Block a user