220: Drop flattenTreeSystem and use custom function for filtering packages r=nrdxp a=Pacman99
I don't think we should flatten the system because if a user doesn't make a package a derivation in pkgs/default.nix we should trust that there is a reason for doing so. So instead this drops the flattenTreeSystem reference(and switches to flake-utils master branch) and replaces its usage with a custom function `filterPackages`. This function filter all packages that match three conditions;
- is a derivation
- not broken
- system is supported
In that order as to not cause errors when trying to reference non-derivation meta attributes.
And then also just dump *all* packages into legacy packages, so everything else is still accessible. I was considering removing the packages that are already in the packages output in legacyPackages, but I don't think its necessary since nix looks to the packages output first.
Co-authored-by: Pacman99 <pachum99@gmail.com>
215: lib/pathsToImportedAttrs: discard string context in the names to prevent flake check error r=nrdxp a=Pacman99
So I learned about this myself while working on it. Nix has a thing called string context, where strings refer to various store paths that they used to contain. This is normally a good thing to guarantee purity, but flake outputs cannot contain store paths. So when `pathsToImportedAttrs` is passed a list of store paths, and is then used for a flake output, we get a very confusing error that the string refers to a store path - even though it doesn't look like it does!
I think its good to review this as a separate Pr, since it requires calling an unsafe nix builtin.
Co-authored-by: Pacman99 <pachum99@gmail.com>
211: home-manager fixes r=nrdxp a=nrdxp
- [x] integrate nix-community/home-manager#1880 (to avoid duplicate commits, we'll wait a bit to see if this gets merged)
- [x] don't use all of `systemPackages` for `flk home`
- [x] test home-manager `activationPackage` and `flk home` as part of CI
Co-authored-by: Timothy DeHerrera <tim.deh@pm.me>
219: lib/mkPkgs: reorder overlays to get access to devos lib(dev) r=nrdxp a=Pacman99
nixpkgs applies overlays in the order given. This PR moves the lib extension overlay to be first so all subsequent overlays can access `dev` which is the devos lib.
Co-authored-by: Pacman99 <pachum99@gmail.com>
202: iso: avoid systemd service startup r=nrdxp a=blaggacao
fixes#194
alternative to #197
# Manual Tests
<details>
<summary>was unrelated</summary>
- [ ] `flk install NixOS --impure` correctly onto `/mnt` ❎ (looks like no profile is present)
Issue: https://github.com/divnix/devos/issues/204
Upstream Issue: https://github.com/NixOS/nixpkgs/issues/116938
</details>
- [x] acceptable build time / closure size ca 850MB (for a simple base OS) ✔️
- [x] local profile with `cage` service is disabled, that is: boots into terminal ✔️
- [x] success: air gapped / offline devshell enter ✔️
- [ ] failure: aire gapped target install: ← non blocking bonus item ❎
```console
$ flk install POS
warning: you don't have internet access; disabling some network-dependent features
building the flake in path:/iso/devos?narHash=sha265-...
warning: you don't have internet access; disabling some network-dependent features
error: unable to download 'https://api.github.com/repos/NixOS/nixpkgs/df8e3...': Couldn't resolve host name (6)
```
→ detailed rationale in the commit messages
❤️ @Pacman99 for the excellent and detailed discussions in #197 and the may ideas, suggestions and code.
Co-authored-by: David Arnold <dar@xoe.solutions>
This is just for convenience, since the closuers are already in the
store. It might be helpful to be able to test out some things
of those deactivated profiles een on the iso isntaller.
IN order to avoid random startup of systemd services, filter out all
profiles, except for core and user profiles.
This works becasue of a fundamental devos contract, that modules
only define configuration, but don't implement them and profiles
only implement confguration but don't define them. So only ever an
activated profile is expected to effectively start up a systemd service.
closes: #194
This is required so that filtering via lib.remove works against
modules.core and similar which are of path type.
It is also a prerequisite for disabledModules to match by module.key
instead of path string relative to nixpkgs' modulePath.
Subflakes should provide their wares as outputs, so wire up the pkgs
flake to reflect that.
Due to the unstable nature of flakes, updating the root flake doesn't
currently update the subflake lock file. Therefore, add additional
logic to flk update script in order to do this behind the scenes.
Nix is now pulled in from the "nix" registry flake in order for users
to take advantage of improvements to the UI since its last update in
nixpkgs.
- [x] refactor lib into separate files, similar to NixOS/nixpkgs/lib.
- [x] refactor ci to automatically generate derivations from flake outputs
- [x] remove cluttered indirection statements throughout the codebase
- [x] refactor hosts to allow for upcoming integration tests
- [x] improve ambiguity in the existing docs
- [x] add [BORS](https://bors.tech) support
- [x] add initial integration test
- [x] write tests documentation
- [x] test lib
- [x] improve version string generation, and do so automatically for pkgs/flake.nix sources
Clean up the codebase as best we can in preparation for #152 and add tests. From now on, all PRs will be merged with BORS.
* Resolves#118
* Leverage flakes to manage package sources & hashes
* Update documentation with an example.
* Add `mkVersion` function to autogenerate a version string.
* Add srcs package via overlay containing all sources defined in
_pkgs/flake.nix_
* Extend `flk update` with the ability to only update the given input
* Leave importing to nixpkgs module implentation. Provide a path
instead; resolves#136.
* Allow profiles which are not lambdas but simple attribute sets,
relaxing the constraints a bit.
* Update profile README.md
* defaultImports -> mkProfileAttrs: allow importing subprofiles even
if parent directory does not contain a default.nix.
* Move extern lists to their own folder
* Move unstable package and module imports to their own folder
* Create a genPkgs function to avoid using legacyPackages for the whole
package set
* Move hmActivationPackages to legacyPackages
* Import attrs of profiles automatically with `defaultImport`.
* Refactor profiles to ensure all are functions returning a module.
* Add a suites.nix with collections of profiles.
* Add suites as `specialArgs` to modules.
* Add suite import to NixOS host.
* fix nixos-option
* use flake-compat for all backward compat concerns
* rebuild devshell after any nix file changes
* reexport system pkgs as legacyPackages
* provide lib flake output
* provide flake lib to nixos configs via `lib.flk`
* clean up flake.nix
master is only used in the context of `pkgs/override.nix`
and `unstableModulesPath`
and only within `./hosts`
Since overlays exists that are incompatible between nixos and master
at evaluation time (sic!), this together with #77 avoids evaluating
overlays against master all together.
since packages are exposed through output.packages by their own,
a second export through overlays.pkgs would be smudging the public api
of this repository.