From 70c2dc4e2fcf44b3b8c872dfbabf67efdaa0dba8 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Dec 2023 23:13:25 -0500 Subject: [PATCH 1/4] Pass hostname and username to modules --- flake.nix | 10 ++++++---- modules/common/darwin/all-hosts.nix | 8 ++++---- modules/common/nixos/all-hosts.nix | 7 +++++-- modules/hosts/nixos/rainbow-planet/default.nix | 10 ++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 4484ea1..a45f4c0 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,7 @@ inputs = { inherit disko home-manager nixpkgs nixpkgs-unstable nix-darwin; }; # creates a macOS system config - darwinSystem = system: hostName: username: nix-darwin.lib.darwinSystem { + darwinSystem = system: hostname: username: nix-darwin.lib.darwinSystem { pkgs = import nixpkgs { inherit system; config = { @@ -48,6 +48,7 @@ ]; }; }; + specialArgs = { inherit inputs username hostname; }; modules = [ nix-homebrew.darwinModules.nix-homebrew { @@ -77,12 +78,12 @@ } ./modules/common/darwin/all-hosts.nix - ./modules/hosts/darwin/${hostName} # ip address, host specific stuff + ./modules/hosts/darwin/${hostname} # ip address, host specific stuff ]; # end modules }; # end darwinSystem # creates a nixos system config - nixosSystem = system: hostName: username: nixpkgs.lib.nixosSystem { + nixosSystem = system: hostname: username: nixpkgs.lib.nixosSystem { pkgs = import nixpkgs { inherit system; config = { @@ -92,6 +93,7 @@ ]; }; }; + specialArgs = { inherit inputs username hostname; }; modules = [ home-manager.nixosModules.home-manager { @@ -107,7 +109,7 @@ } ./modules/common/nixos/all-hosts.nix - ./modules/hosts/nixos/${hostName} # ip address, host specific stuff + ./modules/hosts/nixos/${hostname} # ip address, host specific stuff ]; }; # end nixosSystem diff --git a/modules/common/darwin/all-hosts.nix b/modules/common/darwin/all-hosts.nix index ba590c0..e73bb48 100644 --- a/modules/common/darwin/all-hosts.nix +++ b/modules/common/darwin/all-hosts.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: let - username = "gene.liverman"; -in { +{ pkgs, hostname, username, ... }: { environment = { shells = with pkgs; [ bash zsh ]; loginShell = pkgs.zsh; @@ -68,6 +66,8 @@ in { }; }; + networking.hostName = "${hostname}"; + nix = { settings = { bash-prompt-prefix = "(nix:$name)\040"; @@ -93,4 +93,4 @@ in { home = "/Users/${username}"; shell = pkgs.zsh; }; -} \ No newline at end of file +} diff --git a/modules/common/nixos/all-hosts.nix b/modules/common/nixos/all-hosts.nix index e55df47..8bdc9b8 100644 --- a/modules/common/nixos/all-hosts.nix +++ b/modules/common/nixos/all-hosts.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ config, pkgs, hostname, username, ... }: { imports = [ ./internationalisation.nix ]; @@ -26,7 +26,10 @@ }) ]; + networking.hostName = "${hostname}"; + nix.settings = { + allowed-users = [ "${username}" ]; experimental-features = [ "flakes" "nix-command" @@ -46,4 +49,4 @@ time.timeZone = "America/New_York"; users.defaultUserShell = pkgs.zsh; -} \ No newline at end of file +} diff --git a/modules/hosts/nixos/rainbow-planet/default.nix b/modules/hosts/nixos/rainbow-planet/default.nix index 6cc946c..962f669 100644 --- a/modules/hosts/nixos/rainbow-planet/default.nix +++ b/modules/hosts/nixos/rainbow-planet/default.nix @@ -1,7 +1,4 @@ -{ config, pkgs, ... }: let - username = "gene"; - hostname = "rainbow-planet"; -in { +{ config, pkgs, username, ... }: { imports = [ ./hardware-configuration.nix ]; @@ -39,12 +36,9 @@ in { ]; networking = { - hostName = "${hostname}"; networkmanager.enable = true; }; - nix.settings.allowed-users = [ "${username}" ]; - programs = { _1password.enable = true; _1password-gui = { @@ -104,7 +98,7 @@ in { description = "Gene Liverman"; extraGroups = [ "networkmanager" "wheel" "dialout" "input" ]; packages = with pkgs; [ - tailscale-systray + tailscale-systray ]; }; } From c1c5cbe00072f3208bd55cc930c297ba4d53d459 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Dec 2023 23:37:29 -0500 Subject: [PATCH 2/4] Result of running "nix flake update" --- flake.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 0b91744..351098d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,16 +3,16 @@ "brew-src": { "flake": false, "locked": { - "lastModified": 1690184446, - "narHash": "sha256-fGjvNY6ON/cdExCfwhfqmHzoxs3AZ0sev7vyBHfPGJo=", + "lastModified": 1694443293, + "narHash": "sha256-wBjbF2RRFyD4lN7ie98VnggmNBwAPv/dg2U+w5mUyuM=", "owner": "Homebrew", "repo": "brew", - "rev": "3b3300546b5a4e40b74f4ee33cf225cca280defe", + "rev": "4afb8e5602f3ecc9edf67a44257d8eceeaa8a108", "type": "github" }, "original": { "owner": "Homebrew", - "ref": "4.1.1", + "ref": "4.1.11", "repo": "brew", "type": "github" } @@ -78,11 +78,11 @@ ] }, "locked": { - "lastModified": 1694375657, - "narHash": "sha256-32X8dcty4vPXx+D4yJPQZBo5hJ1NQikALhevGv6elO4=", + "lastModified": 1702681677, + "narHash": "sha256-Wa86ehEzoPXb9t1zXfDuKZ4ELQrFicnuuQjgFUCmxLk=", "owner": "nix-community", "repo": "home-manager", - "rev": "f7848d3e5f15ed02e3f286029697e41ee31662d7", + "rev": "abdc82d930521448e47574b8ca1a0a450e861cca", "type": "github" }, "original": { @@ -98,11 +98,11 @@ ] }, "locked": { - "lastModified": 1694497842, - "narHash": "sha256-z03v/m0OwcLBok97KcUgMl8ZFw5Xwsi2z+n6nL7JdXY=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "4496ab26628c5f43d2a5c577a06683c753e32fe2", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -137,11 +137,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1690495710, - "narHash": "sha256-7yF5A16Ayorrpcal74mRB1EqwUAHfXnoCIgDvj+ylgo=", + "lastModified": 1695057498, + "narHash": "sha256-wn3j7u5tOgLLbNxZC542rJiP5iX323m+CoGPMgPOxp4=", "owner": "zhaofengli-wip", "repo": "nix-homebrew", - "rev": "d2738b78fd0f304f5a7ed4764b736ed2c7169b94", + "rev": "6ab33c5e9249e74401144a7c667d96a757c5d341", "type": "github" }, "original": { @@ -197,11 +197,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1694459622, - "narHash": "sha256-PcbBuRJKFxgb+CUQ3sliI5oRaKHHAV+OSTv6GPAccEA=", + "lastModified": 1702697493, + "narHash": "sha256-KV4ehPcaS8tHK8zJaKbI4slZCm2vpl9Cl7sy/ZSmqW0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bb446a19f77e8d1d0c5ada7069d21a001442fc73", + "rev": "08d6cec730e825d240ddf1df12808f502caf3b87", "type": "github" }, "original": { From 5a7dacbaab382c64447bf5cb3405787fad68399f Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 16 Dec 2023 09:14:06 -0500 Subject: [PATCH 3/4] Update code based on upstream changes --- flake.nix | 2 +- modules/home-manager/default.nix | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index a45f4c0..545ec6f 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,7 @@ config = { allowUnfree = true; permittedInsecurePackages = [ - "python-2.7.18.6" + "python-2.7.18.7" ]; }; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index e8910f7..7ee8bed 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -45,12 +45,15 @@ theme = "Catppuccin-frappe"; }; themes = { - Catppuccin-frappe = builtins.readFile (pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "bat"; - rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; - hash = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; - } + "/Catppuccin-frappe.tmTheme"); + Catppuccin-frappe = { + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "bat"; + rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; + hash = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; + }; + file = "Catppuccin-frappe.tmTheme"; + }; }; }; eza.enable = true; From bf00e6a6f1b76a25eeb6289e5701c7521a5eda16 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 16 Dec 2023 09:15:52 -0500 Subject: [PATCH 4/4] Updates --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 351098d..3b47bbc 100644 --- a/flake.lock +++ b/flake.lock @@ -78,11 +78,11 @@ ] }, "locked": { - "lastModified": 1702681677, - "narHash": "sha256-Wa86ehEzoPXb9t1zXfDuKZ4ELQrFicnuuQjgFUCmxLk=", + "lastModified": 1702735279, + "narHash": "sha256-SztEzDOE/6bDNnWWvnRbSHPVrgewLwdSei1sxoZFejM=", "owner": "nix-community", "repo": "home-manager", - "rev": "abdc82d930521448e47574b8ca1a0a450e861cca", + "rev": "e9b9ecef4295a835ab073814f100498716b05a96", "type": "github" }, "original": { @@ -197,11 +197,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1702697493, - "narHash": "sha256-KV4ehPcaS8tHK8zJaKbI4slZCm2vpl9Cl7sy/ZSmqW0=", + "lastModified": 1702735365, + "narHash": "sha256-PqGFt/SH8WHzuvlgRHrvRjYrafGV7A2S1mfAMnLNol8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "08d6cec730e825d240ddf1df12808f502caf3b87", + "rev": "db6ce8b1a2735932a19575958c1be4b3b62662df", "type": "github" }, "original": {