From ba751b324363b55620711bb9fc9943d383ee44d1 Mon Sep 17 00:00:00 2001 From: Sven Wilhelm Date: Mon, 7 Apr 2025 22:35:25 +0200 Subject: [PATCH 1/5] feat(user/refnode): add talosctl from unstable --- users/refnode/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/users/refnode/default.nix b/users/refnode/default.nix index fd47221..06af36f 100644 --- a/users/refnode/default.nix +++ b/users/refnode/default.nix @@ -121,6 +121,7 @@ pkgs.garden unstable.cargo unstable.rust-analyzer + unstable.talosctl ]; home.sessionVariables = { From 751b6c06876e651d076e1296324c349d10dc643f Mon Sep 17 00:00:00 2001 From: Sven Wilhelm Date: Mon, 7 Apr 2025 22:39:04 +0200 Subject: [PATCH 2/5] feat(user/refnode): add cilium-cli from unstable --- users/refnode/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/users/refnode/default.nix b/users/refnode/default.nix index 06af36f..0ef2f42 100644 --- a/users/refnode/default.nix +++ b/users/refnode/default.nix @@ -122,6 +122,7 @@ unstable.cargo unstable.rust-analyzer unstable.talosctl + unstable.cilium-cli ]; home.sessionVariables = { From 5ccc1b143ebb062483390ddda0db53b8c348842c Mon Sep 17 00:00:00 2001 From: Sven Wilhelm Date: Mon, 7 Apr 2025 22:43:34 +0200 Subject: [PATCH 3/5] feat(user/refnode): add jj from unstable --- users/refnode/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/users/refnode/default.nix b/users/refnode/default.nix index 0ef2f42..2f89377 100644 --- a/users/refnode/default.nix +++ b/users/refnode/default.nix @@ -123,6 +123,7 @@ unstable.rust-analyzer unstable.talosctl unstable.cilium-cli + unstable.jujutsu ]; home.sessionVariables = { From 4a7a06b265074c46361192528c869401877a410c Mon Sep 17 00:00:00 2001 From: Sven Wilhelm Date: Tue, 8 Apr 2025 19:04:21 +0200 Subject: [PATCH 4/5] chore: shift and cleanup parts of nix-darwin config Cleanup flake output and shift the whole config for a node into node module. Define user and home directory and pass it as specialArgs down to the submodules. --- flake.nix | 10 +---- hosts/common/darwin/core/default.nix | 24 +++++++++++- hosts/common/users/refnode/default.nix | 6 ++- hosts/defiant/default.nix | 53 +++++++++++--------------- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/flake.nix b/flake.nix index 9f13c5c..db2fa8a 100644 --- a/flake.nix +++ b/flake.nix @@ -52,15 +52,7 @@ # Build darwin flake using: # $ darwin-rebuild build --flake .#defiant darwinConfigurations = { - defiant = lib.darwinSystem { - system = "aarch64-darwin"; - modules = [./hosts/defiant]; - specialArgs = { - inherit flake inputs; - system = "aarch64-darwin"; - pkgs = lib.refnode.pkgsFor.aarch64-darwin; - }; - }; + defiant = import ./hosts/defiant {inherit lib flake inputs;}; }; nixosConfigurations = {}; diff --git a/hosts/common/darwin/core/default.nix b/hosts/common/darwin/core/default.nix index c433339..9fd183c 100644 --- a/hosts/common/darwin/core/default.nix +++ b/hosts/common/darwin/core/default.nix @@ -1,3 +1,25 @@ -{...}: { +{ + flake, + system, + hostname, + ... +}: { + # Used for backwards compatibility, + # please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + # TODO https://discourse.nixos.org/t/give-name-label-comment-to-generations/45355 + system.configurationRevision = flake.rev or flake.dirtyRev or null; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = system; + + networking = { + computerName = "${hostname}"; + hostName = "${hostname}"; + localHostName = "${hostname}"; + }; + environment.systemPath = ["/opt/homebrew/bin"]; } diff --git a/hosts/common/users/refnode/default.nix b/hosts/common/users/refnode/default.nix index cb06a62..d58cd95 100644 --- a/hosts/common/users/refnode/default.nix +++ b/hosts/common/users/refnode/default.nix @@ -1,11 +1,13 @@ { config, pkgs, + username, + homeDirectory, ... }: { - home-manager.users.refnode = import ../../../../users/refnode/default.nix; + home-manager.users.${username} = import ../../../../users/${username}/default.nix; imports = [ - ../../../../users/refnode/common/darwin + ../../../../users/${username}/common/darwin ]; } diff --git a/hosts/defiant/default.nix b/hosts/defiant/default.nix index 61d2b8a..5f5a60e 100644 --- a/hosts/defiant/default.nix +++ b/hosts/defiant/default.nix @@ -1,33 +1,26 @@ { - pkgs, + lib, flake, - system, inputs, - ... -}: { - imports = [ - inputs.home-manager.darwinModules.home-manager - ../common/core - ../common/darwin/core - ../common/users/refnode - ]; - - # TODO https://discourse.nixos.org/t/give-name-label-comment-to-generations/45355 - system.configurationRevision = flake.rev or flake.dirtyRev or null; - - # Used for backwards compatibility, - # please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 4; - - # The platform the configuration will be used on. - nixpkgs.hostPlatform = system; - - networking = { - computerName = "defiant"; - hostName = "defiant"; - localHostName = "defiant"; - }; - - # home-manager.users.refnode = import ../../users/refnode; -} +}: let + system = "aarch64-darwin"; + hostname = "defiant"; + username = "refnode"; + homeDirectory = "/Users/${username}"; +in + lib.darwinSystem { + inherit system; + modules = [ + # ./hosts/defiant + inputs.home-manager.darwinModules.home-manager + ../common/core + ../common/darwin/core + # probably I need to import the nix-darwin for a user first + # and the import the home-manager config after + ../common/users/${username} + ]; + specialArgs = { + inherit flake inputs system hostname username homeDirectory; + pkgs = lib.refnode.pkgsFor.aarch64-darwin; + }; + } From 0307cbcfee8737a9acdc2e1868db7fad1c24a8d5 Mon Sep 17 00:00:00 2001 From: Sven Wilhelm Date: Tue, 8 Apr 2025 19:13:26 +0200 Subject: [PATCH 5/5] chore(user/refnode): add keepassxc as launch agent --- users/refnode/common/darwin/default.nix | 1 + .../common/darwin/service-keepassxc.nix | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 users/refnode/common/darwin/service-keepassxc.nix diff --git a/users/refnode/common/darwin/default.nix b/users/refnode/common/darwin/default.nix index a89fa78..0654ce4 100644 --- a/users/refnode/common/darwin/default.nix +++ b/users/refnode/common/darwin/default.nix @@ -6,5 +6,6 @@ }: { imports = [ ./aerospace.nix + ./service-keepassxc.nix ]; } diff --git a/users/refnode/common/darwin/service-keepassxc.nix b/users/refnode/common/darwin/service-keepassxc.nix new file mode 100644 index 0000000..54695ba --- /dev/null +++ b/users/refnode/common/darwin/service-keepassxc.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + pkgs, + homeDirectory, + ... +}: let + serviceName = "io.refnode.keepassxc"; +in { + launchd.user.agents.keepassxc = { + serviceConfig = { + Label = serviceName; + StandardOutPath = "${homeDirectory}/Library/Logs/${serviceName}.log"; + StandardErrorPath = "${homeDirectory}/Library/Logs/${serviceName}.error.log"; + KeepAlive = true; + RunAtLoad = true; + Program = "${pkgs.keepassxc}/Applications/KeePassXC.app/Contents/MacOS/KeePassXC"; + }; + }; +}