summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2024-12-27 08:45:34 +0100
committerMartin Fischer <martin@push-f.com>2024-12-27 18:44:37 +0100
commit1b65ba7a838e422c9bf16ddcaf796a996fa51b6b (patch)
treed8ec8d965f955a7f9a5c2b5c98e8a430fb0e8b6f
parentedda7ef46bf2ae7fde9511005b4e7d40648c7e24 (diff)
refactor: introduce profiles
-rw-r--r--nixos/hosts/ev/default.nix8
-rw-r--r--nixos/hosts/hamac/default.nix9
-rw-r--r--nixos/hosts/tente/default.nix4
-rw-r--r--nixos/profiles/common/basics.nix (renamed from nixos/parts/basics.nix)0
-rw-r--r--nixos/profiles/common/default.nix8
-rw-r--r--nixos/profiles/common/nixpkgs/config.nix (renamed from nixos/nixpkgs/config.nix)0
-rw-r--r--nixos/profiles/common/nixpkgs/overlays.nix (renamed from nixos/nixpkgs/overlays.nix)0
-rw-r--r--nixos/profiles/common/sanix.nix (renamed from nixos/sanix.nix)5
-rw-r--r--nixos/profiles/server/default.nix (renamed from nixos/parts/server.nix)4
-rw-r--r--nixos/profiles/workstation/create.nix (renamed from nixos/parts/create.nix)0
-rw-r--r--nixos/profiles/workstation/default.nix20
-rw-r--r--nixos/profiles/workstation/dev.nix (renamed from nixos/parts/dev.nix)5
-rw-r--r--nixos/profiles/workstation/graphical.nix (renamed from nixos/parts/graphical.nix)5
-rwxr-xr-xnixos/profiles/workstation/scripts/deploy-dir (renamed from nixos/parts/scripts/deploy-dir)0
-rw-r--r--nixos/profiles/workstation/scripts/reset-bg (renamed from nixos/parts/scripts/reset-bg)0
-rw-r--r--nixos/profiles/workstation/scripts/set-bg (renamed from nixos/parts/scripts/set-bg)0
-rwxr-xr-xnixos/rebuild2
-rw-r--r--nixos/shared/basics-physical.nix (renamed from nixos/parts/basics-physical.nix)0
-rw-r--r--nixos/shared/tailscale.nix (renamed from nixos/parts/tailscale.nix)0
-rw-r--r--user/zsh/.zshrc9
-rw-r--r--user/zsh/zshrc-dev.sh11
-rw-r--r--user/zsh/zshrc-workstation.sh (renamed from user/zsh/zshrc-graphical.sh)12
22 files changed, 53 insertions, 49 deletions
diff --git a/nixos/hosts/ev/default.nix b/nixos/hosts/ev/default.nix
index d8b4b24..ec2ed86 100644
--- a/nixos/hosts/ev/default.nix
+++ b/nixos/hosts/ev/default.nix
@@ -8,11 +8,9 @@
{
imports = [
./hardware-configuration.nix
- ../../sanix.nix
- ../../parts/server.nix
- ../../parts/tailscale.nix
- ../../parts/basics.nix
- ../../parts/basics-physical.nix
+ <top/profiles/server>
+ <top/shared/tailscale.nix>
+ <top/shared/basics-physical.nix>
];
boot.loader.systemd-boot.enable = true;
diff --git a/nixos/hosts/hamac/default.nix b/nixos/hosts/hamac/default.nix
index c8f40e1..594d70c 100644
--- a/nixos/hosts/hamac/default.nix
+++ b/nixos/hosts/hamac/default.nix
@@ -6,13 +6,8 @@
{
imports = [
./hardware-configuration.nix
- ../../sanix.nix
- ../../parts/basics.nix
- ../../parts/basics-physical.nix
- ../../parts/graphical.nix
- ../../parts/tailscale.nix
- ../../parts/dev.nix
- ../../parts/create.nix
+ <top/profiles/workstation>
+ <top/shared/tailscale.nix>
];
# Bootloader.
diff --git a/nixos/hosts/tente/default.nix b/nixos/hosts/tente/default.nix
index b38d1ea..7885ff4 100644
--- a/nixos/hosts/tente/default.nix
+++ b/nixos/hosts/tente/default.nix
@@ -21,9 +21,7 @@ in
{
imports = [
./hardware-configuration.nix
- ../../sanix.nix
- ../../parts/server.nix
- ../../parts/basics.nix
+ <top/profiles/server>
];
# Use the GRUB 2 boot loader.
diff --git a/nixos/parts/basics.nix b/nixos/profiles/common/basics.nix
index aa6eff9..aa6eff9 100644
--- a/nixos/parts/basics.nix
+++ b/nixos/profiles/common/basics.nix
diff --git a/nixos/profiles/common/default.nix b/nixos/profiles/common/default.nix
new file mode 100644
index 0000000..de4499a
--- /dev/null
+++ b/nixos/profiles/common/default.nix
@@ -0,0 +1,8 @@
+{ config, pkgs, ... }:
+
+{
+ imports = [
+ ./sanix.nix
+ ./basics.nix
+ ];
+}
diff --git a/nixos/nixpkgs/config.nix b/nixos/profiles/common/nixpkgs/config.nix
index b53485a..b53485a 100644
--- a/nixos/nixpkgs/config.nix
+++ b/nixos/profiles/common/nixpkgs/config.nix
diff --git a/nixos/nixpkgs/overlays.nix b/nixos/profiles/common/nixpkgs/overlays.nix
index 613338f..613338f 100644
--- a/nixos/nixpkgs/overlays.nix
+++ b/nixos/profiles/common/nixpkgs/overlays.nix
diff --git a/nixos/sanix.nix b/nixos/profiles/common/sanix.nix
index 02d9ed5..a20db24 100644
--- a/nixos/sanix.nix
+++ b/nixos/profiles/common/sanix.nix
@@ -1,9 +1,4 @@
{ lib, pkgs, config, ... }: {
- environment.systemPackages = with pkgs; [
- # We're using npins to manage the systems Nixpkgs version, install it globally for ease
- npins
- ];
-
# Use the Nixpkgs config and overlays from the local files for this NixOS build
nixpkgs = {
config = import ./nixpkgs/config.nix;
diff --git a/nixos/parts/server.nix b/nixos/profiles/server/default.nix
index 3d94985..4ccef67 100644
--- a/nixos/parts/server.nix
+++ b/nixos/profiles/server/default.nix
@@ -1,6 +1,10 @@
{ config, pkgs, ... }:
{
+ imports = [
+ ../common
+ ];
+
services = {
openssh = {
enable = true;
diff --git a/nixos/parts/create.nix b/nixos/profiles/workstation/create.nix
index 1fc7a28..1fc7a28 100644
--- a/nixos/parts/create.nix
+++ b/nixos/profiles/workstation/create.nix
diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix
new file mode 100644
index 0000000..ddc9a8c
--- /dev/null
+++ b/nixos/profiles/workstation/default.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, ... }:
+
+{
+ imports = [
+ ../common
+ <top/shared/basics-physical.nix>
+ ./graphical.nix
+ ./dev.nix
+ ./create.nix
+ ];
+
+ environment.systemPackages = with pkgs; [
+ npins
+ ];
+
+ environment.sessionVariables = {
+ # Tell .zshrc to source zshrc-workstation.sh.
+ MYNIX_PROFILE = "workstation";
+ };
+}
diff --git a/nixos/parts/dev.nix b/nixos/profiles/workstation/dev.nix
index 0d258b4..1e04b4c 100644
--- a/nixos/parts/dev.nix
+++ b/nixos/profiles/workstation/dev.nix
@@ -1,11 +1,6 @@
{ config, pkgs, ... }:
{
- environment.sessionVariables = {
- # Tell .zshrc to source zshrc-dev.sh.
- MYNIX_DEV = "true";
- };
-
environment.systemPackages = with pkgs; [
rustup
python313
diff --git a/nixos/parts/graphical.nix b/nixos/profiles/workstation/graphical.nix
index d459c33..d79ed97 100644
--- a/nixos/parts/graphical.nix
+++ b/nixos/profiles/workstation/graphical.nix
@@ -12,11 +12,6 @@
[[ "$(tty)" == /dev/tty1 ]] && exec sway
'';
- environment.sessionVariables = {
- # Tell .zshrc to source zshrc-graphical.sh.
- MYNIX_GRAPHICAL = "true";
- };
-
environment.systemPackages = with pkgs; [
swaylock
diff --git a/nixos/parts/scripts/deploy-dir b/nixos/profiles/workstation/scripts/deploy-dir
index bb7dfdf..bb7dfdf 100755
--- a/nixos/parts/scripts/deploy-dir
+++ b/nixos/profiles/workstation/scripts/deploy-dir
diff --git a/nixos/parts/scripts/reset-bg b/nixos/profiles/workstation/scripts/reset-bg
index 5aa20f6..5aa20f6 100644
--- a/nixos/parts/scripts/reset-bg
+++ b/nixos/profiles/workstation/scripts/reset-bg
diff --git a/nixos/parts/scripts/set-bg b/nixos/profiles/workstation/scripts/set-bg
index e78afdc..e78afdc 100644
--- a/nixos/parts/scripts/set-bg
+++ b/nixos/profiles/workstation/scripts/set-bg
diff --git a/nixos/rebuild b/nixos/rebuild
index 978dc87..80a52cd 100755
--- a/nixos/rebuild
+++ b/nixos/rebuild
@@ -28,4 +28,4 @@ nixpkgsPath=$(nix-eval --argstr channel "$channel" --expr '{channel}: (import ./
# nixos-rebuild always reads Nixpkgs from the NIX_PATH,
# so we need to set it explicitly to our pinned version
-exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath"
+exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath" -I top="$(pwd)"
diff --git a/nixos/parts/basics-physical.nix b/nixos/shared/basics-physical.nix
index 683c3b2..683c3b2 100644
--- a/nixos/parts/basics-physical.nix
+++ b/nixos/shared/basics-physical.nix
diff --git a/nixos/parts/tailscale.nix b/nixos/shared/tailscale.nix
index 5d5a99c..5d5a99c 100644
--- a/nixos/parts/tailscale.nix
+++ b/nixos/shared/tailscale.nix
diff --git a/user/zsh/.zshrc b/user/zsh/.zshrc
index a579784..4285c99 100644
--- a/user/zsh/.zshrc
+++ b/user/zsh/.zshrc
@@ -62,10 +62,7 @@ autoload -Uz compinit
[ -d "$XDG_CACHE_HOME"/zsh ] || mkdir -p "$XDG_CACHE_HOME"/zsh
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-$ZSH_VERSION
-# Environment-specifics
-if [ -n "$MYNIX_DEV" ]; then
- source "$ZDOTDIR/zshrc-dev.sh"
-fi
-if [ -n "$MYNIX_GRAPHICAL" ]; then
- source "$ZDOTDIR/zshrc-graphical.sh"
+# Profile-specifics
+if [ "$MYNIX_PROFILE" = "workstation" ]; then
+ source "$ZDOTDIR/zshrc-workstation.sh"
fi
diff --git a/user/zsh/zshrc-dev.sh b/user/zsh/zshrc-dev.sh
deleted file mode 100644
index 484007d..0000000
--- a/user/zsh/zshrc-dev.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is sourced by .zshrc if parts/dev.nix was imported.
-
-## Aliases
-alias code='codium'
-alias tokei='tokei -s code -n commas'
-
-## Environment variables
-export NPM_CONFIG_PREFIX="$HOME/.local/npm"
-
-path+=~/.cargo/bin
-path+=($NPM_CONFIG_PREFIX/bin)
diff --git a/user/zsh/zshrc-graphical.sh b/user/zsh/zshrc-workstation.sh
index 1e9bed7..04f9c88 100644
--- a/user/zsh/zshrc-graphical.sh
+++ b/user/zsh/zshrc-workstation.sh
@@ -1,4 +1,14 @@
-# This file is sourced by .zshrc if parts/graphical.nix was imported.
+# This file is sourced by .zshrc if profiles/workstation was imported.
+
+## Aliases
+alias code='codium'
+alias tokei='tokei -s code -n commas'
+
+## Environment variables
+export NPM_CONFIG_PREFIX="$HOME/.local/npm"
+
+path+=~/.cargo/bin
+path+=($NPM_CONFIG_PREFIX/bin)
function ssh() {
# In my ~/.ssh/config I configure host-specific background colors, for example: