fix: update and improve flake (#1032)

* fix: update and improve flake

* chore: update changelog
This commit is contained in:
Wölfchen 2024-02-24 12:46:40 +00:00 committed by GitHub
parent d96586c209
commit 7bfd47eb81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 81 additions and 72 deletions

View File

@ -6,6 +6,7 @@ All notable changes to eww will be listed here, starting at changes since versio
### Fixes
- The `shell-completions` subcommand is now run before anything is set up
- Fix nix flake
## [0.5.0] (17.02.2024)

View File

@ -1,13 +1,6 @@
(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

@ -3,11 +3,11 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
@ -17,12 +17,15 @@
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
@ -33,11 +36,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1661353537,
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
"lastModified": 1708407374,
"narHash": "sha256-EECzarm+uqnNDCwaGg/ppXCO11qibZ1iigORShkkDf0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
"rev": "f33dd27a47ebdf11dc8a5eb05e7c8fbdaf89e73f",
"type": "github"
},
"original": {
@ -62,11 +65,11 @@
]
},
"locked": {
"lastModified": 1661655464,
"narHash": "sha256-by9Hb0mNVdiCR7TBvUHIgDb0QIv3znp8VMGh7Bl35VQ=",
"lastModified": 1708395022,
"narHash": "sha256-pxHZbfDsLAAcyWz+snbudxhQPlAnK2nWGAqRx11veac=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "0c4c1432353e12b325d1472bea99e364871d2cb3",
"rev": "b4ae18c03af976549a0b6e396b2b5be56d275f8b",
"type": "github"
},
"original": {
@ -74,6 +77,21 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -1,26 +1,28 @@
{
inputs = {
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
rust-overlay.url = "github:oxalica/rust-overlay";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, flake-compat, ... }:
outputs = { self, nixpkgs, rust-overlay, flake-compat }:
let
pkgsFor = system: import nixpkgs {
inherit system;
overlays = [
self.overlays.default
rust-overlay.overlays.default
];
};
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default rust-overlay.overlays.default ];
};
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
mkRustToolchain = pkgs:
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in {
overlays.default = final: prev:
let
rust = mkRustToolchain final;
@ -29,33 +31,33 @@
cargo = rust;
rustc = rust;
};
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 = [ ];
});
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; };
eww-wayland = final.eww;
};
packages = nixpkgs.lib.genAttrs targetSystems (system:
let
pkgs = pkgsFor system;
in
(self.overlays.default pkgs pkgs) // {
let pkgs = pkgsFor system;
in (self.overlays.default pkgs pkgs) // {
default = self.packages.${system}.eww;
}
);
});
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
in
{
in {
default = pkgs.mkShell {
packages = with pkgs; [
rust
@ -70,7 +72,9 @@
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
};
}
);
});
formatter =
nixpkgs.lib.genAttrs targetSystems (system: (pkgsFor system).nixfmt);
};
}

View File

@ -1,13 +1,6 @@
(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