From 7aba10627ce324e87059f134630eaf65df478ae3 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sat, 2 Sep 2023 15:12:08 +0200 Subject: [PATCH] refactor: folder structure --- README.md | 10 +++++----- {gpg => assets/gpg}/pubkey_nitrokey.asc | 0 {ssh => assets/ssh}/known_hosts | 0 {yodaTab => hosts/yodaTab}/configuration.nix | 12 ++++++------ .../yodaTab}/hardware-configuration.nix | 0 {yodaTab => hosts/yodaTab}/home-manager.nix | 6 +++--- {yodaTab => modules}/fde-ssh-unlock.nix | 0 {yodaTab => modules}/git.home.nix | 0 {yodaTab => modules}/git.nix | 0 {yodaTab => modules}/nextcloud-integration.nix | 0 {yodaTab => modules}/nitrokey-ssh-gpg.home.nix | 2 +- {yodaTab => modules}/nitrokey-ssh-gpg.nix | 0 {yodaTab => modules}/print-and-scan.nix | 0 {yodaTab => modules}/programs.nix | 0 {yodaTab/nix => nix}/sources.json | 0 {yodaTab/nix => nix}/sources.nix | 0 16 files changed, 15 insertions(+), 15 deletions(-) rename {gpg => assets/gpg}/pubkey_nitrokey.asc (100%) rename {ssh => assets/ssh}/known_hosts (100%) rename {yodaTab => hosts/yodaTab}/configuration.nix (95%) rename {yodaTab => hosts/yodaTab}/hardware-configuration.nix (100%) rename {yodaTab => hosts/yodaTab}/home-manager.nix (92%) rename {yodaTab => modules}/fde-ssh-unlock.nix (100%) rename {yodaTab => modules}/git.home.nix (100%) rename {yodaTab => modules}/git.nix (100%) rename {yodaTab => modules}/nextcloud-integration.nix (100%) rename {yodaTab => modules}/nitrokey-ssh-gpg.home.nix (82%) rename {yodaTab => modules}/nitrokey-ssh-gpg.nix (100%) rename {yodaTab => modules}/print-and-scan.nix (100%) rename {yodaTab => modules}/programs.nix (100%) rename {yodaTab/nix => nix}/sources.json (100%) rename {yodaTab/nix => nix}/sources.nix (100%) diff --git a/README.md b/README.md index 6f06dc5..9f0d46a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ For each machine, there is a top-level directory, e.g. [yodaTab](yodaTab). Directly change to new config and make it default: ```shell -sudo nixos-rebuild -I nixos-config=yodaTab/configuration.nix switch +sudo nixos-rebuild -I nixos-config=hosts/yodaTab/configuration.nix switch ``` ## System updates @@ -32,7 +32,7 @@ sudo nix-channel --update # #niv --sources-file=yodaTab/nix/sources.json update # -(cd yodaTab && niv update) +niv update ``` Then run `nixos-rebuild switch`, see above. @@ -64,7 +64,7 @@ This evaluates `configuration.nix` (single module): ```shell NIXPKGS_ALLOW_UNFREE=1 nix-instantiate --strict --json --eval -E ' -import ./yodaTab/configuration.nix { +import ./hosts/yodaTab/configuration.nix { config = {}; pkgs = import {}; lib = import ; @@ -111,7 +111,7 @@ sudo nix-channel --list Use the corresponding branch: ```shell -(cd yodaTab && niv add nix-community/home-manager -n home-manager -b release-23.05) +niv add nix-community/home-manager -n home-manager -b release-23.05 ``` ## disko and nixos-anywhere @@ -144,7 +144,7 @@ Summary: * Re-generate hardware configuration: ```shell -sudo nixos-generate-config --dir yodaTab +sudo nixos-generate-config --dir hosts/yodaTab ``` ## GNOME extensions diff --git a/gpg/pubkey_nitrokey.asc b/assets/gpg/pubkey_nitrokey.asc similarity index 100% rename from gpg/pubkey_nitrokey.asc rename to assets/gpg/pubkey_nitrokey.asc diff --git a/ssh/known_hosts b/assets/ssh/known_hosts similarity index 100% rename from ssh/known_hosts rename to assets/ssh/known_hosts diff --git a/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix similarity index 95% rename from yodaTab/configuration.nix rename to hosts/yodaTab/configuration.nix index 62f938a..dc5c209 100644 --- a/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -12,12 +12,12 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./home-manager.nix - ./programs.nix - ./git.nix - ./print-and-scan.nix - ./nitrokey-ssh-gpg.nix - ./fde-ssh-unlock.nix - ./nextcloud-integration.nix + ../../modules/programs.nix + ../../modules/git.nix + ../../modules/print-and-scan.nix + ../../modules/nitrokey-ssh-gpg.nix + ../../modules/fde-ssh-unlock.nix + ../../modules/nextcloud-integration.nix ]; # Bootloader. diff --git a/yodaTab/hardware-configuration.nix b/hosts/yodaTab/hardware-configuration.nix similarity index 100% rename from yodaTab/hardware-configuration.nix rename to hosts/yodaTab/hardware-configuration.nix diff --git a/yodaTab/home-manager.nix b/hosts/yodaTab/home-manager.nix similarity index 92% rename from yodaTab/home-manager.nix rename to hosts/yodaTab/home-manager.nix index 4c2ab81..a58c8e3 100644 --- a/yodaTab/home-manager.nix +++ b/hosts/yodaTab/home-manager.nix @@ -1,14 +1,14 @@ { config, pkgs, ... }: let # Import Home Manager with niv. - home-manager = (import ./nix/sources.nix).home-manager; + home-manager = (import ../../nix/sources.nix).home-manager; in { imports = [ (import "${home-manager}/nixos") - ./git.home.nix + ../../modules/git.home.nix # TODO - #./nitrokey-ssh-gpg.home.nix + #../../modules/nitrokey-ssh-gpg.home.nix ]; /* Enable home-manager to configure GNOME */ diff --git a/yodaTab/fde-ssh-unlock.nix b/modules/fde-ssh-unlock.nix similarity index 100% rename from yodaTab/fde-ssh-unlock.nix rename to modules/fde-ssh-unlock.nix diff --git a/yodaTab/git.home.nix b/modules/git.home.nix similarity index 100% rename from yodaTab/git.home.nix rename to modules/git.home.nix diff --git a/yodaTab/git.nix b/modules/git.nix similarity index 100% rename from yodaTab/git.nix rename to modules/git.nix diff --git a/yodaTab/nextcloud-integration.nix b/modules/nextcloud-integration.nix similarity index 100% rename from yodaTab/nextcloud-integration.nix rename to modules/nextcloud-integration.nix diff --git a/yodaTab/nitrokey-ssh-gpg.home.nix b/modules/nitrokey-ssh-gpg.home.nix similarity index 82% rename from yodaTab/nitrokey-ssh-gpg.home.nix rename to modules/nitrokey-ssh-gpg.home.nix index de8ce71..03ac3a1 100644 --- a/yodaTab/nitrokey-ssh-gpg.home.nix +++ b/modules/nitrokey-ssh-gpg.home.nix @@ -5,7 +5,7 @@ programs.ssh = { enable = true; - userKnownHostsFile = "~/.ssh/known_hosts ${../ssh/known_hosts}"; + userKnownHostsFile = "~/.ssh/known_hosts ${../assets/ssh/known_hosts}"; matchBlocks = { "nas" = { hostname = "p1st.de"; diff --git a/yodaTab/nitrokey-ssh-gpg.nix b/modules/nitrokey-ssh-gpg.nix similarity index 100% rename from yodaTab/nitrokey-ssh-gpg.nix rename to modules/nitrokey-ssh-gpg.nix diff --git a/yodaTab/print-and-scan.nix b/modules/print-and-scan.nix similarity index 100% rename from yodaTab/print-and-scan.nix rename to modules/print-and-scan.nix diff --git a/yodaTab/programs.nix b/modules/programs.nix similarity index 100% rename from yodaTab/programs.nix rename to modules/programs.nix diff --git a/yodaTab/nix/sources.json b/nix/sources.json similarity index 100% rename from yodaTab/nix/sources.json rename to nix/sources.json diff --git a/yodaTab/nix/sources.nix b/nix/sources.nix similarity index 100% rename from yodaTab/nix/sources.nix rename to nix/sources.nix