Comments (12)
from flake-utils.
I can't anytime soon. But cleaning up my flake.nixs will eventually block me and I plan to clean them via this repo, so I'll get to it eventually if you don't. Thanks for confirming my understanding and starting up this repo.
from flake-utils.
{
packages = let
pkgs = sys:
let
nixpkgs_ = (pkgsFor inputs.nixpkgs sys true);
packagePlatforms = pkg: pkg.meta.hydraPlatforms or pkg.meta.platforms or [ "x86_64-linux" ];
pred = n: v: builtins.elem sys (packagePlatforms v);
in
nixpkgs_.lib.filterAttrs pred nixpkgs_.waylandPkgs;
in {
x86_64-linux = pkgs "x86_64-linux";
aarch64-linux = pkgs "aarch64-linux";
};
}
from flake-utils.
With today's flake-utils you would achieve something similar like this:
{
description = "colemicken's wayland overlay";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
{
overlay = import ./overlay.nix;
}
//
(
flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
config = { };
overlays = [ self.overlay ];
};
in
{
packages = pkgs.waylandPkgs;
}
)
);
}
Assuming that the overlay puts all its packages under pkgs.waylandPkgs
, and that pkgs.waylandPkgs
only contains derivations (otherwise nix flake check
complains).
The big chunk at the end could probably be simplified for the common case.
{
description = "colemicken's wayland overlay";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
overlay = import ./overlay.nix;
overlayAttr = "waylandPkgs";
systems = [ "aarch64-linux" "x86_64-linux" ];
};
}
How does that look?
from flake-utils.
Cool, I need to try it and glance at eachSystem
but it looks like what I want, yeah. And I like the looks of #5. I'm going to try to re-visit my various flake repos next weekend, maybe dogfood #5 and then comment again / close this out.
from flake-utils.
Looking forward to your feedback!
from flake-utils.
I'm skimming through the source and #5, I'm not seeing anything that does the filtering I'm looking for based on the meta.platforms
unless I'm looking in the wrong place?
from flake-utils.
You're right. .flattenTree should be changed to take the system as an argument. Do you want to tackle this?
from flake-utils.
We're slowly converting our overlays to flakes, and something that filters the per-system package set based on meta.hydraPlatforms
would be very helpful.
In our current overlays, we import nixpkgs + "/pkgs/top-level/release-lib.nix"
and use its functionality to build Hydra jobsets. Nix's built-in flake support, combined with flake-utils
, replaces most of that machinery, except for the bit that filters out packages that don't support a particular platform.
from flake-utils.
^ please try out this new implementation in PR 13
from flake-utils.
@nrdxp do stars align here? (through PR13). I think nrdxp/nixflk
is a complement use case to look for. Its flake is already quite complex while trying to solve common use cases around nixos configurations.
My reasoning is: flake-utils
is an even higher order abstraction than nixflk
, so moving things up the ladder (where adequate) might perfectly serve the presumptive goal of both projects to set a standardization precedents early on.
from flake-utils.
My solution does check the buildInputs of each flake package for platform dependence, but not recursively.
from flake-utils.
Related Issues (20)
- feat: Cut more releases
- by-name HOT 7
- Q: why does flattenTree rely on recurseIntoAttrs? HOT 4
- eachDefaultSystem leads to missing architecture attributes HOT 4
- simpleFlake to support defaultSystems HOT 2
- Outputs spec update makes `eachSystemMap` powerful HOT 2
- flake-utils.lib.mkApp is broken with nix 2.8 HOT 4
- move functions to nixpkgs HOT 2
- Use `meta.mainProgram` by default in `mkApp` HOT 4
- Request for Semantic Version Pinning HOT 1
- Request for Semantic Version Pinning HOT 1
- `flattenTree` cannot seem to flatten `legacyPackages` to a `packages`-compatible format HOT 5
- Should `filterPackages` check `meta.hydraPlatforms`? HOT 2
- nixops support HOT 4
- self parameter for eachSystem/eachDefaultSystem HOT 2
- single arch+os override flake HOT 15
- Potential feature-freeze or deprecation in favor of flake-parts HOT 2
- master rename to main breaks nix flake update HOT 3
- eachDefaultSystem docs are sorely missing a real example HOT 3
- This `flake.system.nix` approach... relies on a broken nix feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake-utils.