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 ### Fixes
- The `shell-completions` subcommand is now run before anything is set up - The `shell-completions` subcommand is now run before anything is set up
- Fix nix flake
## [0.5.0] (17.02.2024) ## [0.5.0] (17.02.2024)

View file

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

42
flake.lock generated
View file

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

View file

@ -1,26 +1,28 @@
{ {
inputs = { inputs = {
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; flake-compat = {
rust-overlay.url = "github:oxalica/rust-overlay"; url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 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 let
pkgsFor = system: import nixpkgs { pkgsFor = system:
inherit system; import nixpkgs {
inherit system;
overlays = [ overlays = [ self.overlays.default rust-overlay.overlays.default ];
self.overlays.default };
rust-overlay.overlays.default
];
};
targetSystems = [ "aarch64-linux" "x86_64-linux" ]; targetSystems = [ "aarch64-linux" "x86_64-linux" ];
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; mkRustToolchain = pkgs:
in pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
{ in {
overlays.default = final: prev: overlays.default = final: prev:
let let
rust = mkRustToolchain final; rust = mkRustToolchain final;
@ -29,33 +31,33 @@
cargo = rust; cargo = rust;
rustc = rust; rustc = rust;
}; };
in in {
{ eww = (prev.eww.override { inherit rustPlatform; }).overrideAttrs
eww = (prev.eww.override { inherit rustPlatform; }).overrideAttrs (old: { (old: {
version = self.rev or "dirty"; version = self.rev or "dirty";
src = builtins.path { name = "eww"; path = prev.lib.cleanSource ./.; }; src = builtins.path {
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; }; name = "eww";
patches = [ ]; 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: packages = nixpkgs.lib.genAttrs targetSystems (system:
let let pkgs = pkgsFor system;
pkgs = pkgsFor system; in (self.overlays.default pkgs pkgs) // {
in
(self.overlays.default pkgs pkgs) // {
default = self.packages.${system}.eww; default = self.packages.${system}.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 {
packages = with pkgs; [ packages = with pkgs; [
rust rust
@ -70,7 +72,9 @@
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; 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 (import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
( 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