Skip to content

Commit

Permalink
refactor: Still working on massive update (2) [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lehmanator committed Mar 15, 2024
1 parent 5a914f4 commit c5dffca
Show file tree
Hide file tree
Showing 22 changed files with 321 additions and 67 deletions.
13 changes: 7 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
systems =
[ "x86_64-linux" "aarch64-linux" "riscv64-linux" "aarch64-darwin" ];
in
flake-parts.lib.mkFlake { inherit inputs; } {
flake-parts.lib.mkFlake { inherit inputs self; } {
inherit systems;
imports = [ ./profiles/flakes ];
debug = true;
Expand All @@ -33,11 +33,12 @@
};
flake = {
#homeConfigurations."sam@minimal" = home.lib.homeManagerConfiguration {
# pkgs = nixpkgs;
# modules = [
# #./users/sam
# ];
# extraSpecialArgs = { inherit inputs; };
# pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
# modules = [ ./users/sam ];
# extraSpecialArgs = {
# inherit inputs;
# user = "sam";
# };
#};
nixosConfigurations =
let user = "sam";
Expand Down
12 changes: 9 additions & 3 deletions nix/hive/homeConfigurations/sam/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{ inputs, cell, }@commonArgs:
let
inherit (inputs.home-manager.lib) homeManagerConfiguration;
user = builtins.toString ./.;
user = builtins.baseNameOf (builtins.toString ./.);
in
homeManagerConfiguration {
#pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
pkgs = inputs.nixpkgs;
modules = [
inputs.cells.hive.homeSuites.developer-default
(inputs.self + /users/${user})
#(inputs.self + /users/${user} { inherit inputs cell user; })
cell.userProfiles.${user}
#(inputs.self + /users/${user})
];
extraSpecialArgs = { inherit inputs cell user; };
extraSpecialArgs = {
inherit inputs cell user;
#inherit (inputs.nixpkgs) lib;
};
}
15 changes: 4 additions & 11 deletions nix/hive/homeProfiles/device-fajita.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{ inputs
, config
, lib
, pkgs
, ...
}:
{
{ inputs, cell, config, lib, pkgs, ... }: {
# TODO: Reorganize this file
# - OnePlus 6T (fajita)
# - OnePlus 6 (enchilada)
# - OnePlus (all)
# - Android (all)
imports = [
./oem/oneplus.nix
./os/android
./os/postmarketos.nix
cell.homeProfiles.device-oneplus
cell.homeProfiles.device-android
cell.homeProfiles.device-postmarketos
];

# --- Downloads ------------------------------------------
Expand Down Expand Up @@ -116,5 +110,4 @@
# TODO: Create package for version `2.0.0` instead of `1.53.0` or `1.51.0`
pkgs.pmbootstrap
];

}
19 changes: 6 additions & 13 deletions nix/hive/homeProfiles/device-oneplus.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{ inputs
, config
, lib
, pkgs
, ...
}:
{
imports = [
#../os/android
#../os/postmarketos.nix
];
{ inputs, config, lib, pkgs, ... }: {
#imports = [
# inputs.cell.homeProfiles.device-android
# inputs.cell.homeProfiles.device-postmarketos
#];

home.packages = [
];
home.packages = [ ];

# TODO: Install Bottles with OnePlus MDM tool
# TODO: Generic flasher scripts for OnePlus devices
Expand Down
19 changes: 4 additions & 15 deletions nix/hive/homeProfiles/device-postmarketos.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
{ inputs
, config
, lib
, pkgs
, user
, ...
}:
{
imports = [ ];

{ inputs, config, lib, pkgs, user, ... }: {
home = {
packages = [ pkgs.pmbootstrap ];
shellAliases = {
pmb = "${pkgs.pmbootstrap}/bin/pmbootstrap";
pmb = lib.getExe pkgs.pmbootstrap;
pmbI = "pmb init";
pmbi = "pmb install --fde --add unl0kr";
pmbc = "pmb config";
pmbf = "fastboot erase dtbo && pmb flasher flash_rootfs --partition=userdata && pmb flasher flash_kernel";
pmbf =
"fastboot erase dtbo && pmb flasher flash_rootfs --partition=userdata && pmb flasher flash_kernel";
pmbp = "pmb pull";
pmbu = "pmb update";
pmbv = "pmb --version";
Expand Down Expand Up @@ -205,10 +197,7 @@
# org.gnome.NautilusPreviewer \
#'';


# TODO: Create pmbootstrap GitHub personal access token.
# TODO: Configure pmbootstrap to use GitHub personal access token.
#sops.secrets.github-token-pmbootstrap = {};


}
17 changes: 5 additions & 12 deletions nix/hive/homeProfiles/device-sawfish.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{ self
, inputs
, config
, lib
, pkgs
, ...
}:
{
{ inputs, config, lib, pkgs, ... }: {
# --- Huawei Watch 2 (sawfish) ---
# https://asteroidos.org/watches/sawfish
#
Expand All @@ -28,10 +21,10 @@
# fastboot continue
#

imports = [
#./os/android-wear.nix
#./os/asteriodos.nix
];
#imports = [
# inputs.cell.homeProfiles.device-android-wear
# inputs.cell.homeProfiles.device-asteroidos
#];

home.packages = [
pkgs.android-tools # Android SDK platform tools (ADB / fastboot)
Expand Down
9 changes: 8 additions & 1 deletion nix/hive/homeSuites/developer-default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{ inputs, cell, nixosConfig, osConfig, config, lib, pkgs, ... }: {
{ inputs
, cell
, #, cell, nixosConfig, osConfig
config
, lib
, pkgs
, ...
}: {
imports = [
cell.homeProfiles.abook
cell.homeProfiles.bat
Expand Down
12 changes: 10 additions & 2 deletions nix/hive/pops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ omnibusStd.mkBlocks.pops commonArgs {
src = ./homeConfigurations;
#type = "nixosProfiles";
#loader = [ inputs.haumea.lib.matchers.nix inputs.haumea.lib.loaders.scoped ];
transformer = inputs.haumea.lib.transformers.liftDefault;
#transformer = inputs.haumea.lib.transformers.liftDefault;
inputs = { inherit inputs cell; };
#};
};
Expand All @@ -94,7 +94,7 @@ omnibusStd.mkBlocks.pops commonArgs {
src = ./homeProfiles;
#loader = with inputs.haumea.lib; [ matchers.nix loaders.scoped ];
type = "nixosProfiles";
#inputs = { inherit inputs cell; };
inputs = { inherit inputs cell; };
#transformer = inputs.haumea.lib.transformers.liftDefault;
};
homeSuites = pops.homeProfiles.addLoadExtender {
Expand All @@ -104,6 +104,14 @@ omnibusStd.mkBlocks.pops commonArgs {
inputs = { inherit inputs cell; };
}; # type = "nixosProfilesOmnibus";
};
userProfiles = pops.homeProfiles.addLoadExtender {
load = {
src = ./userProfiles;
type = "nixosProfilesOmnibus";
#transformer = inputs.haumea.lib.transformers.liftDefault;
inputs = { inherit inputs cell; };
};
};

# --- NixOS -------------------------------------------
nixosConfigurations = {
Expand Down
1 change: 1 addition & 0 deletions nix/hive/userProfiles.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{inputs,cell}: cell.pops.userProfiles.exports.default
38 changes: 38 additions & 0 deletions nix/hive/userProfiles/sam/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ inputs, cell, config, lib, pkgs, osConfig, nixosConfig, ... }: {
imports = [
#cell.homeSuites.developer-default
cell.homeProfiles.device-fajita
cell.homeProfiles.device-nintendo-switch
cell.homeProfiles.device-pinetime
cell.homeProfiles.device-sawfish
#../../profiles/hm

cell.userProfiles.sam.gpg
cell.userProfiles.sam.git
#cell.userProfiles.sam.nix
#./git
#./gpg.nix
];

home.stateVersion = "23.11";

sops.secrets.github-token = { };

#programs.gallery-dl.settings = {};

#home.file."os-config" = {
# target = ".hm/os-config";
# #text = lib.generators.toPretty (lib.attrsets.filterAttrs (n: v: lib.elem n [ "meta" "_functor" "_toString" ])) osConfig;
# #text = lib.generators.toPretty
# text = lib.traceIf (osConfig ? users)
# (lib.attrsets.removeAttrs
# osConfig.users.users.${config.home.username}.openssh
# [ "meta" "_functor" "_toString" "toString" "_type" "system" "home" "packages" "home-manager" ]
# ) "true";
#};
#home.file."nixos-config" = {
# target = ".hm/nixos-config";
# #text = lib.generators.toPretty osConfig;
# text = lib.traceIf (osConfig ? users)
#};
}
39 changes: 39 additions & 0 deletions nix/hive/userProfiles/sam/git/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ inputs, config, lib, pkgs, ... }: {
programs = {
git = {
includes = [
# --- Users ---
# TODO: Import all users in ./users/default.nix
(import ./public.nix)
(import ./personal.nix)
(import ./gnome.nix)
(import ./gaming.nix)
#(import ./work.nix)

# TODO: Extra conditionals
# { path = "~/path/to/config.inc"; }
# { path = "~/path/to/conditional.inc";
# condition = "gitdir:~/src/dir";
# }
];
#userEmail = "";
#userName = "";
};

mr.settings = {
config = {
checkout = "git clone [email protected]:lehmanator/nix-configs.git";
update = "git pull";
};
nixpkgs = {
checkout = "git clone [email protected]:NixOS/nixpkgs.git";
update = "git pull --rebase";
};
nur = { checkout = "git clone [email protected]:lehmanator/nur-repo.git"; };
passwords = {
checkout = "git clone [email protected]:lehmanator/keepass.git";
update = "git pull";
};
};
};
}
12 changes: 12 additions & 0 deletions nix/hive/userProfiles/sam/git/gaming.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
#path = "~/.config/git/gaming.inc";
#condition = "gitdir: ~/Code/gaming";
condition = "hasconfig:remote.*.url:https://github.com/RedstoneSSB/**";
contents = {
core.sshCommand = "ssh -i ~/.ssh/id_redstone_ed25519";
user = {
email = "[email protected]";
name = "Redstone";
};
};
}
10 changes: 10 additions & 0 deletions nix/hive/userProfiles/sam/git/gnome.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
#path = "~/.config/git/gnome.inc";
condition = "hasconfig:remote.*.url:https://gitlab.gnome.org/**";
contents = {
user = {
email = "[email protected]";
name = "Sam Lehman";
};
};
}
11 changes: 11 additions & 0 deletions nix/hive/userProfiles/sam/git/personal.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
#path = "~/.config/git/personal.inc";
#condition = "gitdir: ~/Code/personal";
condition = "hasconfig:remote.*.url:https://github.com/Lehmanator/**";
contents = {
user = {
email = "[email protected]";
name = "Sam Lehman";
};
};
}
13 changes: 13 additions & 0 deletions nix/hive/userProfiles/sam/git/public.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
condition = "hasconfig:remote.*.url:https://github.com/publicSam/**";
#path = "~/.config/git/public.inc";
#condition = "gitdir: ~";
contents = {
user = {
email = "[email protected]";
name = "Sam Lehman";
#signingKey = "";
};
#commit.gpgSign = true;
};
}
2 changes: 2 additions & 0 deletions nix/hive/userProfiles/sam/git/work.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
25 changes: 25 additions & 0 deletions nix/hive/userProfiles/sam/gpg.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ inputs, config, lib, pkgs, ... }:
{
# Good overview of GPG:
# - https://rgoulter.com/blog/posts/programming/2022-06-10-a-visual-explanation-of-gpg-subkeys.html
programs.gpg = {
settings = {
default-key = "DC19 62D6 560F F66B B16F 99E0 C47C 1462 4041 0561";
};
# --- External Public Keys ---
# WARN: Entries here will be added to the world-viewable Nix store
#publicKeys = [
#{
# source = ./pubkeys.txt;
# text = ""; # Text of OpenPGP public key
# trust = "full"; # unknown | never | marginal | full | ultimate
#}
#];
};

# --- GnuPG Agent ---
# Which GPG keys (by keygrip) to expose as SSH keys
services.gpg-agent.sshKeys = [
#""
];
}
22 changes: 22 additions & 0 deletions nix/hive/userProfiles/sam/maintainer-handle.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
# TODO: Write homeModule with options for fields that cannot be deduced using
# rest of home-manager environment/options & GPG keys.
# TODO: Write script to create first nixpkgs commit.
# This attrset must be added to nixpkgs repo in file: nixpkgs/maintainers/maintainer-list.nix
# TODO: Write lib that automatically generates this data.
# TODO: Write devShell that runs the command to create your first nixpkgs commit.
lehmanator = {
name = "Sam Lehman";
email = "[email protected]";
matrix = "@lehmanator:tchncs.de";
github = "Lehmanator";
githubId = "lehmanator"; # TODO: Retrieve
keys = [
{
# TODO: Set GPG actual key
longkeyid = "rsa4096/0x0123456789ABCDEF";
fingerprint = "AAAA BBBB CCCC DDDD EEEE FFFF 0000 1111 2222 3333";
}
];
};
}
Loading

0 comments on commit c5dffca

Please sign in to comment.