Merge pull request 'flake: pull in changes from digga upstream' (#207) from upstream/digga-changes into main

Reviewed-on: pub-solar/os#207
Reviewed-by: hensoko <hensoko@gssws.de>
This commit is contained in:
teutat3s 2023-04-15 18:59:02 +02:00
commit 9f7d209392
Signed by: pub.solar gitea
GPG key ID: F0332B04B7054873
10 changed files with 60 additions and 66 deletions

View file

@ -5,7 +5,6 @@ let
ciSystems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
];

View file

@ -59,5 +59,5 @@ list of strings
_*Default*_
```
["aarch64-linux","aarch64-darwin","i686-linux","x86_64-darwin","x86_64-linux"]
["aarch64-linux","aarch64-darwin","x86_64-darwin","x86_64-linux"]
```

View file

@ -1,5 +1,9 @@
[book]
authors = ["Timothy DeHerrera"]
authors = [
"Timothy DeHerrera",
"Parthiv Seetharaman",
"David Arnold",
]
language = "en"
multilingual = false
src = "."

View file

@ -9,8 +9,7 @@
Users are a special case of [profiles](profiles.md) that define system
users and [home-manager][home-manager] configurations. For your convenience,
home manager is wired in by default so all you have to worry about is declaring
your users. For a fully fleshed out example, check out the developers personal
[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
your users.
## Basic Usage
@ -60,18 +59,6 @@ using the `homeConfigurations` flake output.
This is great for keeping your environment consistent across Unix-like systems,
including macOS.
### From within the projects devshell:
```sh
# builds the pub-solar user defined in the PubSolarOS host
nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage'
# build and activate
nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage' && ./result/activate && unlink result
```
### Manually from outside the project:
```sh
# build
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
@ -81,5 +68,5 @@ nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPac
```
[home-manager]: https://nix-community.github.io/home-manager
[modules-list]: https://github.com/divnix/devos/tree/main/users/modules/module-list.nix
[modules-list]: https://github.com/divnix/digga/tree/main/users/modules/module-list.nix
[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers

View file

@ -4,7 +4,8 @@ The only dependency is nix, so make sure you have it [installed][install-nix].
## Get the Template
If you currently don't have flakes setup, you can utilize the digga shell to pull the template:
If you currently don't have flakes setup, you can utilize the digga shell to
pull the template:
```sh
nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \
@ -22,37 +23,26 @@ Then make sure to create the git repository:
```sh
git init
git add .
git commit -m init
git commit
```
To drop into a nix-shell, if you don't have flakes setup, use the digga shell to create a `flake.lock`:
```sh
nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \
--run "nix flake lock"
```
Or if you do have flakes support, just run:
```sh
nix flake lock
```
Finally, run `nix-shell` to get to an interactive shell with all the dependencies, including the unstable nix
version required. You can run `menu` to confirm that you are using digga (expected output includes [docs], [general commands], [linter], etc.).
Finally, run `nix-shell` to get to an interactive shell with all the
dependencies, including the unstable nix version required. You can run `menu` to
confirm that you are using digga (expected output includes [docs], [general
commands], [linter], etc.).
In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
> ##### _Notes:_
> # _Notes:_
>
> - Flakes ignore files that have not been added to git, so be sure to stage new
> files before building the system.
> - You can choose to simply clone the repo with git if you want to follow
> upstream changes.
> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work
> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work you
> can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
## Next Steps:
## Next Steps
- [Make installable ISO](./iso.md)

View file

@ -14,12 +14,21 @@ be built during CI.
## Integration Tests
All your profiles defined in suites will be tested in a NixOS VM.
All your profiles defined in suites can be tested against an individual host.
Simply use digga's pre-baked `digga.lib.allProfilesTest` like so:
```nix
{
hosts = {
Morty.tests = [ allProfilesTest ];
};
}
```
You can write integration tests for one or more NixOS VMs that can,
optionally, be networked together, and yes, it's as awesome as it sounds!
Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest`
Be sure to use the `mkTest` function from Digga, `digga.lib.mkTest`
which wraps the official [testing-python][testing-python] function to ensure
that the system is setup exactly as it is for a bare DevOS system. There are
already great resources for learning how to use these tests effectively,
@ -28,7 +37,7 @@ and the examples in [nixpkgs][nixos-tests].
[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
[default]: https://github.com/divnix/devos/tree/main/tests/default.nix
[default]: https://github.com/divnix/devos/tree/core/tests/default.nix
[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix

View file

@ -1,2 +1,10 @@
{lib}:
lib.makeExtensible (self: {})
lib.makeExtensible (self: let
callLibs = file: import file {lib = self;};
in rec {
## Define your own library functions here!
#id = x: x;
## Or in files, containing functions that take {lib}
#foo = callLibs ./foo.nix;
## In configs, they can be used under "lib.our"
})

View file

@ -15,10 +15,10 @@
auto-optimise-store = true;
# Prevents impurities in builds
sandbox = true;
# give root and @wheel special privileges with nix
# Give root and @wheel special privileges with nix
trusted-users = ["root" "@wheel"];
# This is just a representation of the nix default
system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"];
# Allow only group wheel to connect to the nix daemon
allowed-users = ["@wheel"];
};
# Generally useful nix option defaults
extraOptions = ''

View file

@ -8,11 +8,11 @@
inherit
(pkgs)
agenix
alejandra
cachix
editorconfig-checker
mdbook
nix
alejandra
nodePackages
nvfetcher
shellcheck
shfmt
@ -25,21 +25,23 @@
prettier
;
hooks = import ./hooks;
pkgWithCategory = category: package: {inherit package category;};
devos = pkgWithCategory "devos";
linter = pkgWithCategory "linter";
docs = pkgWithCategory "docs";
formatter = pkgWithCategory "linter";
in {
_file = toString ./.;
imports = ["${extraModulesPath}/git/hooks.nix"];
git = {inherit hooks;};
imports = ["${extraModulesPath}/git/hooks.nix" ./hooks];
# override for our own welcome
devshell.name = pkgs.lib.mkForce "PubSolarOS";
packages = [
alejandra
editorconfig-checker
nodePackages.prettier
shellcheck
shfmt
];
commands = with pkgs;
[
(devos nix)
@ -50,14 +52,7 @@ in {
help = pkgs.nvfetcher.meta.description;
command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@";
}
(linter alejandra)
(linter editorconfig-checker)
(linter nodePackages.prettier)
(linter shfmt)
(linter shellcheck)
(linter treefmt)
(docs mdbook)
(formatter treefmt)
]
++ lib.optionals (!pkgs.stdenv.buildPlatform.isi686) [
(devos cachix)

View file

@ -1,4 +1,6 @@
{
git.hooks = {
enable = true;
pre-commit.text = builtins.readFile ./pre-commit.sh;
};
}