Commit graph

50 commits

Author SHA1 Message Date
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
Timothy DeHerrera 7e93ef7ccf
flake: move pathsToImportedAttrs to utils 2020-07-30 15:29:58 -06:00
Timothy DeHerrera 9670fa4b0f
Revert "utils: now lives in lib.utils globally"
This reverts commit c9944b411e.
Causes infinite recursion, revert for now while exploring possible
solutions.
2020-01-05 15:39:59 -07:00
Timothy DeHerrera c9944b411e
utils: now lives in lib.utils globally 2020-01-05 03:45:59 -07:00
Timothy DeHerrera 16b8136f50
change formatter to nixfmt 2020-01-03 22:06:31 -07:00
Timothy DeHerrera e7079c5c63
utils: small cleanup 2019-12-21 19:02:22 -07:00
Timothy DeHerrera da6e3fee94
format with nixpkgs#nixpkgs-fmt 2019-12-15 01:08:22 -07:00
Timothy DeHerrera ae0746a5a4
utils: create utility functions to ease repetition
`reqImport` in particular, is useful for easily importing an entire
directory of nix files into an attribute set.
2019-12-13 21:30:43 -07:00
Timothy DeHerrera 79181e103f
setup configurations API
NixOS file, configurations/<name>.nix, will be easily installable
via `nixos-rebuild --flake ".#<name>"`.
2019-12-05 01:58:40 -07:00
Timothy DeHerrera 17713c22d0
init 2019-12-02 22:18:30 -07:00