Compare commits

..

5 Commits

Author SHA1 Message Date
John Lancaster
9a8f98d4fe moved imports 2026-03-11 18:50:16 -05:00
John Lancaster
30ffa5f234 moved base import 2026-03-11 18:35:59 -05:00
John Lancaster
c3e80bb91a commented out certs for restic 2026-03-11 18:31:41 -05:00
John Lancaster
7a5c96284f table 2026-03-11 18:30:04 -05:00
John Lancaster
ee1b2aafba reading base-profile.yaml into config 2026-03-11 18:02:00 -05:00
9 changed files with 81 additions and 69 deletions

View File

@@ -15,7 +15,15 @@ nix flake show --all-systems
## Layout
- Everything under `./modules` gets auto-imported by `import-tree`
-
| Directory | Description |
| ------------- | ----------- |
| `hosts` | Provides either `homeConfigurations` or `nixosConfigurations` |
| `nix-tools` | Nix-specific tools, like factory functions for use in the flakes |
| `nixos` | `flake.modules.nixos` |
| `programs` | flakes that provide `flake.modules` attributes for specific programs |
| `services` | flakes that provide configuration for running services |
| `users` | flakes that provide configuration for individual users with the `flake.factory.user` factory |
## Mechanics

View File

@@ -10,13 +10,11 @@ in
{
imports = with inputs.self.modules.homeManager; [
rebuild
zsh
john
desktop
docker
ssh
resticprofile
sops
docker
desktop
];
home.packages = with pkgs; [
@@ -52,8 +50,8 @@ in
default = {
"inherit" = "base";
repository = "rest:https://soteria.john-stream.com/john-ubuntu";
cacert = "${config.home.homeDirectory}/.step/certs/root_ca.crt";
tls-client-cert = "${config.home.homeDirectory}/.step/certs/mtls.pem";
# cacert = "${config.home.homeDirectory}/.step/certs/root_ca.crt";
# tls-client-cert = "${config.home.homeDirectory}/.step/certs/mtls.pem";
backup = {
source = [
"${config.xdg.userDirs.documents}"

View File

@@ -19,6 +19,7 @@
home-manager.users."${username}" = {
imports = [
self.modules.homeManager."${username}"
# self.modules.homeManager.shell-tools
];
};
};
@@ -26,9 +27,10 @@
homeManager."${username}" = {
home.username = "${username}";
home.homeDirectory = "/home/${username}";
imports = with self.modules.homeManager; [
base
];
# TODO: This doesn't get merged properly when the factory gets used
# imports = with self.modules.homeManager; [
# shell-tools
# ];
};
};
}

View File

@@ -1,10 +0,0 @@
{ inputs, pkgs, ... }:
{
flake.modules.homeManager.base = { pkgs, ... }:
{
imports = with inputs.self.modules.homeManager; [
git
shell-tools
];
};
}

View File

@@ -10,7 +10,7 @@
imports = with inputs.self.modules.homeManager; [
bash
# zsh
zsh
# Tools
eza

View File

@@ -0,0 +1,42 @@
base:
repository: local:/mnt/backup
password-file: '{{ .ConfigDir }}/password.txt'
status-file: '{{ .ConfigDir }}/backup-status.json'
retention:
after-backup: true
keep-last: '10'
keep-hourly: '8'
keep-daily: '14'
keep-weekly: '8'
backup:
verbose: true
exclude:
- .cache
- .devenv
- .rustup
- .cargo
- .venv
- .pyenv
- .vscode*
- data/postgres
- build
- __pycache__
- '*.log'
- '*.egg-info'
- '*.csv'
- '*.m4a'
- .local/share/Steam
- .local/share/Trash
- build
- dist
- /home/*/Pictures
- /home/*/Videos
- /home/*/go
- /home/*/snap
- /home/john/john-nas
schedule-permission: user
schedule-priority: background
check-after: true
prune:
schedule-permission: user
schedule-lock-wait: 1h

View File

@@ -1,42 +0,0 @@
base:
repository: local:/mnt/backup
password-file: '{{ .ConfigDir }}/password.txt'
status-file: '{{ .ConfigDir }}/backup-status.json'
retention:
after-backup: true
keep-last: '10'
keep-hourly: '8'
keep-daily: '14'
keep-weekly: '8'
backup:
verbose: true
exclude:
- .cache
- .devenv
- .rustup
- .cargo
- .venv
- .pyenv
- .vscode*
- data/postgres
- build
- __pycache__
- '*.log'
- '*.egg-info'
- '*.csv'
- '*.m4a'
- .local/share/Steam
- .local/share/Trash
- build
- dist
- /home/*/Pictures
- /home/*/Videos
- /home/*/go
- /home/*/snap
- /home/john/john-nas
schedule-permission: user
schedule-priority: background
check-after: true
prune:
schedule-permission: user
schedule-lock-wait: 1h

View File

@@ -29,12 +29,25 @@
};
};
flake.lib.fromYAML = pkgs: path:
builtins.fromJSON (
builtins.readFile (
pkgs.runCommand "${builtins.baseNameOf path}.json"
{
nativeBuildInputs = [ pkgs.remarshal ];
}
''
remarshal -if yaml -of json ${path} > "$out"
''
)
);
flake.modules.homeManager.resticprofile = { config, lib, pkgs, ... }:
let
cfg = config.programs.resticprofile;
yamlFormat = pkgs.formats.yaml { };
baseProfile = import ../../../resticprofile/base.nix;
# baseProfile = builtins.fromJSON (builtins.readFile ./base.yaml)
# baseProfile = import ../../../resticprofile/base.nix;
baseProfile = inputs.self.lib.fromYAML pkgs ./base-profile.yaml;
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
in {
options.programs.resticprofile = {

View File

@@ -17,7 +17,7 @@ in
];
};
modules = lib.mkMerge [
modules = lib.recursiveUpdate
(inputs.self.factory.user username true)
{
#
@@ -41,10 +41,11 @@ in
programs.git.settings.user.email = email;
imports = with inputs.self.modules.homeManager; [
# base
ssh
shell-tools
git
];
};
}
];
};
};
}