From 0a348dcc7bb8d8f5389baa862f0aa6a9f988540d Mon Sep 17 00:00:00 2001 From: larstvei Date: Sat, 23 Aug 2025 16:28:52 +0200 Subject: [PATCH] Add some simple variables --- hosts/macbook/configuration.nix | 17 +++++++++-------- hosts/macbook/variables.nix | 5 +++++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 hosts/macbook/variables.nix diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix index da35cff..3cd4039 100644 --- a/hosts/macbook/configuration.nix +++ b/hosts/macbook/configuration.nix @@ -1,26 +1,27 @@ { pkgs, emacs-larstvei, ... }: +let + v = import ./variables.nix; +in { imports = [ ../../system ../../system/darwin ]; - system.primaryUser = "larstvei"; + system.primaryUser = v.username; - networking.hostName = "larstvei-macbookpro"; + networking.hostName = v.hostName; - users.users = { - larstvei = { - home = "/Users/larstvei"; - shell = pkgs.fish; - }; + users.users.${v.username} = { + home = v.userHome; + shell = pkgs.fish; }; home-manager = { useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit emacs-larstvei; }; - users.larstvei.imports = [ ../../home ]; + users.${v.username}.imports = [ ../../home ]; }; homebrew = { diff --git a/hosts/macbook/variables.nix b/hosts/macbook/variables.nix new file mode 100644 index 0000000..601a680 --- /dev/null +++ b/hosts/macbook/variables.nix @@ -0,0 +1,5 @@ +{ + username = "larstvei"; + userHome = "/Users/larstvei"; + hostName = "larstvei-macbookpro"; +}