clean up nix expressions (#469)

This commit is contained in:
moni 2022-08-15 16:56:05 +08:00 committed by GitHub
parent 7a3e2f4448
commit 39eeeff7cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 103 additions and 81 deletions

View File

@ -1,9 +1,13 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
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
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
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

View File

@ -8,11 +8,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1635402244,
"narHash": "sha256-4bUSYJDRxAo66UpNkFmEMRIWMdDXBEnq8GB/rG++Y3A=",
"lastModified": 1654237591,
"narHash": "sha256-+uOzx9fuo3CBHO7aGI+SKxDXpf/7NTOXi0g4UxOdk9k=",
"owner": "nix-community",
"repo": "fenix",
"rev": "840f96d1f3257d64c04fe949dfc9c0b4795c04c1",
"rev": "8dccfbe51a8adea643ec29a4ec516499a5a081c6",
"type": "github"
},
"original": {
@ -24,11 +24,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1627913399,
"narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=",
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
@ -39,11 +39,11 @@
},
"flake-utils": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
@ -57,11 +57,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1635444951,
"narHash": "sha256-1y3YkERwoYDIZjGow7HLAR8K3C/9VBPCBy8VpftMPsM=",
"lastModified": 1653413650,
"narHash": "sha256-wojDHjb+eU80MPH+3HQaK0liUy8EgR95rvmCl24i58Y=",
"owner": "nmattia",
"repo": "naersk",
"rev": "0d2ce479df4633dbeb53a8ea96e5098ed37fbcc6",
"rev": "69daaceebe12c070cd5ae69ba38f277bbf033695",
"type": "github"
},
"original": {
@ -72,11 +72,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1635481254,
"narHash": "sha256-tyVpgjeNhzCP2bBdIgFOkTtwDJWO/bKp59V5ctfonyg=",
"lastModified": 1654126564,
"narHash": "sha256-sgDXDKGmUG4h7OPDOHyQggFQ08ZqVzUIPi8351yhugY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f1d9248eddad2369fca6572470670ec45aa85272",
"rev": "f1c9c23aad972787f00f175651e4cb0d7c7fd5ea",
"type": "github"
},
"original": {
@ -86,11 +86,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1635336330,
"narHash": "sha256-EPrCZTmuOEY1KLjUCu7rXCBxNemggIFJMDdfEqXQKGo=",
"lastModified": 1654126564,
"narHash": "sha256-sgDXDKGmUG4h7OPDOHyQggFQ08ZqVzUIPi8351yhugY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "51acb65b302551ac7993b437cc6863fe9fa8ae50",
"rev": "f1c9c23aad972787f00f175651e4cb0d7c7fd5ea",
"type": "github"
},
"original": {
@ -111,15 +111,15 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1635274542,
"narHash": "sha256-Cew1/WUozM3jalItPuj4cNN8GIFMvCaJ1KXoj6wrHwE=",
"owner": "rust-analyzer",
"lastModified": 1654178556,
"narHash": "sha256-LG8J9E/wMBolkWS3VstuvhgQ4jOp3Nk328EXlCYY24U=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "dd43f3f2d13a32199828e758ddf13176df1f17f9",
"rev": "88024c7ec2d44a8be8bf05a6580409200cf726fc",
"type": "github"
},
"original": {
"owner": "rust-analyzer",
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"

View File

@ -1,62 +1,76 @@
{
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
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";
};
outputs = { self, flake-utils, fenix, nixpkgs, naersk, flake-compat, ... }:
flake-utils.lib.eachDefaultSystem (system:
flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
let
# Add rust nightly to pkgs
pkgs = nixpkgs.legacyPackages.${system} // { inherit (fenix.packages.${system}.latest) cargo rustc rust-src clippy-preview rustfmt-preview; };
pkgs = import nixpkgs { inherit system; };
toolchain = fenix.packages.${system}.latest;
naersk-lib = (naersk.lib."${system}".override {
cargo = pkgs.cargo;
rustc = pkgs.rustc;
inherit (toolchain) cargo rustc;
});
eww = { wayland ? false }:
mkEww = { wayland ? false }:
naersk-lib.buildPackage {
pname = "eww";
buildInputs = pkgs.lib.optional wayland pkgs.gtk-layer-shell;
src = builtins.path { name = "eww"; path = ./.; };
nativeBuildInputs = with pkgs; [ pkg-config gtk3 ];
cargoBuildOptions = opts: opts ++ pkgs.lib.optionals wayland [ "--no-default-features" "--features=wayland" ];
root = ./.;
buildInputs = pkgs.lib.optional wayland pkgs.gtk-layer-shell;
cargoBuildOptions = opts: opts ++ pkgs.lib.optionals wayland [
"--no-default-features"
"--features=wayland"
];
};
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; };
};
packages = rec {
default = eww;
eww = mkEww { };
eww-wayland = mkEww { wayland = true; };
};
devShells.default = pkgs.mkShell {
packages = builtins.attrValues {
inherit (toolchain)
cargo
rustc
rust-src
clippy-preview
rustfmt-preview;
inherit (pkgs)
rust-analyzer
gcc
gtk3
gtk-layer-shell
pkg-config
deno
mdbook;
};
in rec {
packages.eww = eww {};
packages.eww-wayland = eww {wayland=true;};
defaultPackage = self.packages.${system}.eww;
apps.eww = flake-utils.lib.mkApp { drv = packages.eww; };
apps.eww-wayland = flake-utils.lib.mkApp { drv = packages.eww-wayland; };
defaultApp = apps.eww;
devShell = pkgs.mkShell {
packages = with pkgs; [
rustc
cargo
rust-analyzer
gcc
gtk3
gtk-layer-shell
pkg-config
rustfmt-preview
clippy-preview
deno
mdbook
];
RUST_SRC_PATH = "${pkgs.rust-src}/lib/rustlib/src/rust/library";
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
});
}

View File

@ -1,9 +1,13 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
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
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
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