aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2025-06-12 12:46:14 -0700
committerFranck Cuny <franck@fcuny.net>2025-06-12 12:46:14 -0700
commit6fff95981bfef5527518fbebac879c71877810ff (patch)
treeee12cecc6843ad931806109417e6aed865602ff3
parentuse a dedicated SSH key for agenix (diff)
downloadinfra-6fff95981bfef5527518fbebac879c71877810ff.tar.gz
pass `self` to the home-manager modules
This is to avoid using relative paths, which is always annoying to get right.
Diffstat (limited to '')
-rw-r--r--flake.nix8
-rw-r--r--nix/lib/mkSystem.nix21
-rw-r--r--nix/users/fcuny/llm.nix8
3 files changed, 25 insertions, 12 deletions
diff --git a/flake.nix b/flake.nix
index fcbb262..504934d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -40,6 +40,7 @@
# Output config, or config for NixOS system
outputs =
{
+ self,
nixpkgs,
nixpkgsUnstable,
darwin,
@@ -88,7 +89,12 @@
];
mkSystem = import ./nix/lib/mkSystem.nix {
- inherit nixpkgs inputs overlays;
+ inherit
+ self
+ nixpkgs
+ inputs
+ overlays
+ ;
};
# Create a treefmt-nix evaluation for a system
diff --git a/nix/lib/mkSystem.nix b/nix/lib/mkSystem.nix
index 7c438b6..3241dd9 100644
--- a/nix/lib/mkSystem.nix
+++ b/nix/lib/mkSystem.nix
@@ -1,12 +1,13 @@
# This function creates a NixOS system based on our VM setup for a
# particular architecture.
{
+ self,
nixpkgs,
inputs,
overlays,
}:
-name:
+systemName:
{
system,
user,
@@ -15,11 +16,11 @@ name:
let
# The config files for this system.
- machineConfig = ../machines/${name};
+ machineConfig = ../machines/${systemName};
userOSConfig = ../users/${user}/${if darwin then "darwin" else "nixos"}.nix;
userHMConfig = ../users/${user}/home-manager.nix;
- # NixOS vs nix-darwin functionst
+ # NixOS vs nix-darwin functions
systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;
home-manager =
if darwin then inputs.home-manager.darwinModules else inputs.home-manager.nixosModules;
@@ -44,9 +45,15 @@ systemFunc rec {
inputs.agenix.homeManagerModules.default
];
home-manager.users.${user} = import userHMConfig {
- inputs = inputs;
- darwin = darwin;
- systemName = name;
+ inherit
+ self
+ inputs
+ darwin
+ systemName
+ ;
+ };
+ home-manager.extraSpecialArgs = {
+ inherit self inputs;
};
}
@@ -55,7 +62,7 @@ systemFunc rec {
{
config._module.args = {
currentSystem = system;
- currentSystemName = name;
+ currentSystemName = systemName;
currentSystemUser = user;
inputs = inputs;
};
diff --git a/nix/users/fcuny/llm.nix b/nix/users/fcuny/llm.nix
index c41bf04..0c6c072 100644
--- a/nix/users/fcuny/llm.nix
+++ b/nix/users/fcuny/llm.nix
@@ -1,13 +1,13 @@
-{ ... }:
+{ self, ... }:
{
home.file.".config/llm/templates/pr-prompt.yaml".text =
- builtins.readFile ../../../configs/llm/templates/pr-prompt.yaml;
+ builtins.readFile "${self}/configs/llm/templates/pr-prompt.yaml";
home.file.".config/llm/templates/commit-prompt.yaml".text =
- builtins.readFile ../../../configs/llm/templates/commit-prompt.yaml;
+ builtins.readFile "${self}/configs/llm/templates/commit-prompt.yaml";
home.file.".config/llm/templates/readme-gen.yaml".text =
- builtins.readFile ../../../configs/llm/templates/readme-gen.yaml;
+ builtins.readFile "${self}/configs/llm/templates/readme-gen.yaml";
programs.fish = {
shellAliases = {