nix: switch to nixfmt-rfc-style
This commit is contained in:
parent
8b9d65f800
commit
89d8bfe5c2
3 changed files with 64 additions and 37 deletions
15
default.nix
15
default.nix
|
@ -1,6 +1,9 @@
|
||||||
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
(import (
|
||||||
in fetchTarball {
|
let
|
||||||
url =
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
in
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
fetchTarball {
|
||||||
}) { src = ./.; }).defaultNix
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
) { src = ./.; }).defaultNix
|
||||||
|
|
71
flake.nix
71
flake.nix
|
@ -11,20 +11,31 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, rust-overlay, flake-compat }:
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
rust-overlay,
|
||||||
|
flake-compat,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) self.overlays.default ];
|
overlays = [
|
||||||
|
(import rust-overlay)
|
||||||
|
self.overlays.default
|
||||||
|
];
|
||||||
pkgsFor = system: import nixpkgs { inherit system overlays; };
|
pkgsFor = system: import nixpkgs { inherit system overlays; };
|
||||||
|
|
||||||
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
|
targetSystems = [
|
||||||
mkRustToolchain = pkgs:
|
"aarch64-linux"
|
||||||
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
"x86_64-linux"
|
||||||
in {
|
];
|
||||||
overlays.default = final: prev: {
|
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
inherit (self.packages.${prev.system}) eww eww-wayland;
|
in
|
||||||
};
|
{
|
||||||
|
overlays.default = final: prev: { inherit (self.packages.${prev.system}) eww eww-wayland; };
|
||||||
|
|
||||||
packages = nixpkgs.lib.genAttrs targetSystems (system:
|
packages = nixpkgs.lib.genAttrs targetSystems (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
pkgs = pkgsFor system;
|
pkgs = pkgsFor system;
|
||||||
rust = mkRustToolchain pkgs;
|
rust = mkRustToolchain pkgs;
|
||||||
|
@ -32,18 +43,24 @@
|
||||||
cargo = rust;
|
cargo = rust;
|
||||||
rustc = rust;
|
rustc = rust;
|
||||||
};
|
};
|
||||||
version = (builtins.fromTOML
|
version = (builtins.fromTOML (builtins.readFile ./crates/eww/Cargo.toml)).package.version;
|
||||||
(builtins.readFile ./crates/eww/Cargo.toml)).package.version;
|
in
|
||||||
in rec {
|
rec {
|
||||||
eww = rustPlatform.buildRustPackage {
|
eww = rustPlatform.buildRustPackage {
|
||||||
version = "${version}-dirty";
|
version = "${version}-dirty";
|
||||||
pname = "eww";
|
pname = "eww";
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
cargoBuildFlags = [ "--bin" "eww" ];
|
cargoBuildFlags = [
|
||||||
|
"--bin"
|
||||||
|
"eww"
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ pkg-config wrapGAppsHook ];
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
wrapGAppsHook
|
||||||
|
];
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
gtk3
|
gtk3
|
||||||
librsvg
|
librsvg
|
||||||
|
@ -52,26 +69,30 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
eww-wayland = nixpkgs.lib.warn
|
eww-wayland = nixpkgs.lib.warn "`eww-wayland` is deprecated due to eww building with both X11 and wayland support by default. Use `eww` instead." eww;
|
||||||
"`eww-wayland` is deprecated due to eww building with both X11 and wayland support by default. Use `eww` instead."
|
|
||||||
eww;
|
|
||||||
default = eww;
|
default = eww;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
devShells = nixpkgs.lib.genAttrs targetSystems (system:
|
devShells = nixpkgs.lib.genAttrs targetSystems (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
pkgs = pkgsFor system;
|
pkgs = pkgsFor system;
|
||||||
rust = mkRustToolchain pkgs;
|
rust = mkRustToolchain pkgs;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
inputsFrom = [ self.packages.${system}.eww ];
|
inputsFrom = [ self.packages.${system}.eww ];
|
||||||
packages = with pkgs; [ deno mdbook ];
|
packages = with pkgs; [
|
||||||
|
deno
|
||||||
|
mdbook
|
||||||
|
];
|
||||||
|
|
||||||
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
formatter =
|
formatter = nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt-rfc-style);
|
||||||
nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
15
shell.nix
15
shell.nix
|
@ -1,6 +1,9 @@
|
||||||
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
(import (
|
||||||
in fetchTarball {
|
let
|
||||||
url =
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
in
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
fetchTarball {
|
||||||
}) { src = ./.; }).shellNix
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
) { src = ./.; }).shellNix
|
||||||
|
|
Loading…
Add table
Reference in a new issue