Commit graph

59 commits

Author SHA1 Message Date
bors[bot]
5a3bae7be5
Merge #220
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>
2021-03-27 00:10:58 +00:00
Pacman99
fb14e20249 lib/filterPackages: filter by flake requirements
returns only non-broken derivations that support the system.
2021-03-26 16:55:27 -07:00
bors[bot]
3c772df5b0
Merge #215
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>
2021-03-26 21:30:04 +00:00
bors[bot]
00759997ab
Merge #211
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>
2021-03-26 21:22:49 +00:00
bors[bot]
205a9d3e03
Merge #219
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>
2021-03-26 21:07:51 +00:00
Pacman99
d344fc2ea6 lib/mkPkgs: reorder overlays to get access to devos lib(dev) 2021-03-26 13:00:38 -07:00
Pacman99
68a5a2eecf lib/pathsToImportedAttrs: discard string context in the names to prevent flake check error 2021-03-26 08:10:56 -07:00
Pacman99
61fc640f10 lib/pathsIn: don't error if path doesn't exist 2021-03-25 15:21:10 -07:00
Timothy DeHerrera
e767f7066e
devosSystem#hmConfig: don't pass systemPackages
The intentions are good, but for users with many profiles, this is
overkill. Proper solution will come when #127 is resolved.
2021-03-25 00:17:50 -06:00
Pacman99
dc9d9877b8 export homeConfigurations for all user@host pairs and add better home-manager only defaults 2021-03-23 09:43:37 -07:00
bors[bot]
870897a3e9
Merge #202
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: &larr; 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)
```

&rarr; 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>
2021-03-22 21:59:12 +00:00
Pacman99
aec7c92cc7 hosts: set nixpkgs.pkgs based on nixpkgs.system 2021-03-19 12:23:23 -07:00
David Arnold
49b1ad8227
iso: ensure tools of deactivated profiles are still available
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.
2021-03-18 23:46:47 -05:00
David Arnold
007447652b
iso: add back complete host profile to the nix store
This ensures that all builds of activated profiles are included into
the iso cache and don't require rebuilding within the live installer
environment.
2021-03-18 23:46:47 -05:00
David Arnold
435847823f
style / organization 2021-03-18 23:46:47 -05:00
David Arnold
15cf15b3ed
iso: filter out al profiles (except core)
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
2021-03-18 23:46:47 -05:00
David Arnold
db716d1921
lib: ensure path type in mkProfileAttrs
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.
2021-03-18 23:46:47 -05:00
Pacman99
dd494facc3 hosts/devosSystem: pass modules as attrset 2021-03-17 17:28:49 -07:00
David Arnold
8e3777ff34
iso: copy devShell storepath to iso
This avoids for the live nixos on the iso to rebuild the devshell
upon entering it.
2021-03-16 17:35:58 -05:00
David Arnold
17aee57df4
iso: pin inputs as flakes
This intends to avoid downloading inputs on the iso live image
and is a step towards completely air-gaped installs.

credits: @Pacman99

closes: #190
2021-03-16 17:12:38 -05:00
David Arnold
3d324e7533 lib/devos: bake devos repo into live cd (#168)
fix #167 

This worked for me to bootstrap another machine.
2021-03-16 19:50:38 +00:00
Timothy DeHerrera
d8068073c6
lib: add rgxToString function 2021-03-14 21:40:49 -06:00
Timothy DeHerrera
d51cd34fb7
subflakes: make first class citizens
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.
2021-03-14 21:27:58 -06:00
Timothy DeHerrera
c012f2f4ed treewide cleanups and refactoring for initial tests (#157)
- [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.
2021-03-14 07:10:51 +00:00
Timothy DeHerrera
5bd8876b74
Merge pull request #147 from blaggacao/da/lib-with-dep-on-pkgs
lib: can depend on pkgs (a la nixpkgs#pkgs/pkgs-lib)
2021-03-05 12:16:38 -07:00
Timothy DeHerrera
7c226c9168
lib#genPkgs: reorder overlays
Resolves #146 by allowing external overlays to ve overriden by local
overlays.
2021-03-01 22:15:48 -07:00
David Arnold
e56c619aef
lib: add usage docs 2021-03-01 14:37:43 -05:00
David Arnold
bca532ab42
lib: can depend on pkgs (a la nixpkgs#pkgs/pkgs-lib) 2021-03-01 14:01:17 -05:00
Timothy DeHerrera
25180a5e6e
pkgs: use subflake to manage package sources
* 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
2021-02-26 00:15:45 -07:00
Timothy DeHerrera
1651913910
profiles: simplify profiles to suites
* 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.
2021-02-25 14:47:19 -07:00
Timothy DeHerrera
77296ff433
deploy: move logic to lib 2021-02-15 11:24:43 -07:00
Timothy DeHerrera
cf23b8e64d
flake: rename flake-utils input 2021-02-14 22:11:49 -07:00
Timothy DeHerrera
bf34d2071f
doc: new mdbook documentation 2021-02-14 02:46:05 -07:00
Timothy DeHerrera
3bc16596f7
lib: rename defaultImports 2021-02-06 13:30:17 -07:00
Timothy DeHerrera
0ec0c25238
various refactors
* 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
2021-02-03 23:44:58 -07:00
Timothy DeHerrera
39acbefbe9
ci: fix ci after core creation 2021-02-03 19:35:10 -07:00
Timothy DeHerrera
bd9878f82a
ci: move into build attribute 2021-02-03 16:41:21 -07:00
Timothy DeHerrera
c67b846929
profiles: add concept of suites
* 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.
2021-02-03 13:16:14 -07:00
Timothy DeHerrera
4ae99af29d
Merge pull request #102 from blaggacao/da/iso-sd-netboot
host: add deault implementation for system.build.isoImage target (per…
2021-02-01 19:51:44 -07:00
Timothy DeHerrera
8d0119d8e4
home: move hmActivationPackages to own output
Fixes `nix flake check` failure.
2021-02-01 19:48:59 -07:00
Timothy DeHerrera
17621d6b14
iso-cd: style cleanup (#2) 2021-02-01 20:57:19 -05:00
David Arnold
8cb82a307f
iso: move iso target to ./lib 2021-01-27 21:17:59 -05:00
Pacman99
88eecddab5
users: home-manager only configurations
for non-root users or non-nixos systems
2021-01-27 10:16:08 -07:00
Timothy DeHerrera
1b80806516
compat: fixes
* 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
2021-01-23 16:45:10 -07:00
Timothy DeHerrera
f8f67d2dcb
packages: apply overlays to output packages
Apply overlays to output packages so we can easily use a modified
package.
2021-01-18 02:23:49 -07:00
David Arnold
7fb5967735
Don't evaluate overlays on master
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.
2021-01-10 20:10:59 -05:00
Timothy DeHerrera
41e3de0eab
flake: simply packages with flattenTreeSystem
Based on https://github.com/numtide/flake-utils/pull/13.
2021-01-03 00:05:39 -07:00
David Arnold
94f334ee8d
ref: remove overlay xref to pkgs
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.
2020-12-30 11:53:53 -05:00
Timothy DeHerrera
3300b5d582
flake: clean up by moving implementation to utils
Fixes #28 by adding an `externOverlays` list to easily import overlays
from external flakes.
2020-12-25 12:53:57 -07:00
Timothy DeHerrera
2369f43398
format: apply nixpkgs-fmt 2020-07-30 22:17:28 -06:00