Skip to content

Commit

Permalink
refactor: update haumea
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 8, 2023
1 parent 4649807 commit d8a5339
Show file tree
Hide file tree
Showing 73 changed files with 4,778 additions and 303 deletions.
10 changes: 10 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Disable the automatic menu displaying on every environment reload.
# export DEVSHELL_NO_MOTD=1
watch_file flakes.nix flake.lock
watch_file local/flake.nix local/flake.lock
# shellcheck disable=SC1090
source "$(fetchurl "https://raw.githubusercontent.com/gtrunsec/direnv/main/lib" "sha256-tuMA8WGkwcYq9V3MtlN6xdVvKd2YkdEpdK4ZyAN6VDM=")"

registry="$PRJ_ROOT/local#__std"

use envreload //repo/devshells/default
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
15 changes: 15 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repository:
allow_merge_commit: false
allow_rebase_merge: true
allow_squash_merge: false
default_branch: main
delete_branch_on_merge: true
description: 'A nix language configuration framework based on POP: Pure Object'
has_downloads: false
has_issues: false
has_projects: false
has_wiki: false
homepage: ''
name: CONFIGURE-ME
private: true
topics: Flops
25 changes: 25 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "CI"
on:
pull_request:
push:
branches:
- master
jobs:
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: nixbuild/nix-quick-install-action@v25
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Run Flake Show
run: nix -Lv flake show --override-input namaka github:nix-community/namaka

- name: Run Eval check
run: nix -Lv eval ./local#checks --override-input namaka github:nix-community/namaka

- name: Run Format Check
run: nix develop ./local --command treefmt -- . --fail-on-change --no-cache
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.data
# nixago: ignore-linked-files
/lefthook.yml
/.editorconfig
/.conform.yaml
/treefmt.toml
68 changes: 68 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#+TITLE: README
#+AUTHOR: GuangTao Zhang
#+EMAIL: gtrunsec@hardenedlinux.org
#+DATE: 2023-05-03 Wed 05:53

powered by [[https://github.com/divnix/POP/blob/main/POP.md][POP: Pure Object Prototypes]] && [[https://github.com/nix-community/haumea][haumea]]

~A nix language configuration framework based on POP: Pure Object~

if you want to understand this repo how works and use cases easily, just read the tests and expressions directly. For having a human-readable test set, the problem of complexity wouldn't exist anymore.

- snapshots : https://github.com/GTrunSec/flops/blob/master/tests/_snapshots/haumea
- expr: https://github.com/GTrunSec/flops/blob/master/tests/haumea/expr.nix

* bye bye, a bloated flake inputs

We could avoid putting all the inputs in the main flake.nix

- use the ~flake.pops.default~ to load a subflake.

#+begin_src nix
callInputs =
(flops.lib.flake.pops.default.setInitInputs ./lib/__lock)
.setSystem
"x86_64-linux";
#+end_src

* Merge

** dmerge

you can't use the dmerge for the nixosModules

- David Arnold (blaggacao) said
#+begin_quote
dmerge can only work with json-serializable data on both sides. That's by design.
#+end_quote

#+begin_src nix :async :exports both :results output
test = with dmerge;
merge {
a.b.c = [];
a.c = lib.mkOption {
type = lib.types.submodule {
freeformType = lib.types.attrs;
options = {
enable = lib.mkEnableOption (lib.mdDoc "Whether to enable git profile");
};
};
};
} {a.b.c = append ["a" "b" "c"];};

testNonMerge =
{
a.b.c = [];
a.c = lib.mkOption {
type = lib.types.submodule {
freeformType = lib.types.attrs;
options = {
enable = lib.mkEnableOption (lib.mdDoc "Whether to enable git profile");
};
};
};
}
// {d = "d";};
#+end_src

So, we use *withoutMergedOptions* to keep the native options after the action of merged.
22 changes: 0 additions & 22 deletions de-systemize.nix

This file was deleted.

Loading

0 comments on commit d8a5339

Please sign in to comment.