summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2023-09-07 16:53:41 +0200
committerLinnnus <[email protected]>2023-09-07 16:53:41 +0200
commitedcc3acea595d3045253c3c2fe2462599c1c54e0 (patch)
tree81e17fc5fe4f0a52d30e8d0209c6080cc77eda32
parentd31d1bae8c38e145cdbafe105401d9528b416779 (diff)
Reorganize everything
-rw-r--r--flake.nix12
-rw-r--r--home/default.nix24
-rw-r--r--home/git/default.nix (renamed from use-cases/git/default.nix)0
-rw-r--r--home/neovim/default.nix (renamed from use-cases/neovim/default.nix)0
-rw-r--r--home/neovim/filetype.nix (renamed from use-cases/neovim/filetype.nix)0
-rw-r--r--home/neovim/lsp.nix (renamed from use-cases/neovim/lsp.nix)0
-rw-r--r--home/zsh/default.nix (renamed from use-cases/zsh/default.nix)0
-rw-r--r--home/zsh/plugins.nix (renamed from use-cases/zsh/plugins.nix)0
-rw-r--r--hosts/ahmed/configuration.nix9
-rw-r--r--hosts/ahmed/ssh.nix4
-rw-r--r--hosts/common.nix34
-rw-r--r--hosts/muhammed/configuration.nix7
-rw-r--r--lib/default.nix8
-rw-r--r--lib/secrets/default.nix (renamed from lib/secrets.nix)4
-rw-r--r--modules/default.nix5
-rw-r--r--use-cases/cli-basics.nix23
-rw-r--r--use-cases/default.nix37
-rw-r--r--use-cases/dev-cli-basics.nix10
18 files changed, 82 insertions, 95 deletions
diff --git a/flake.nix b/flake.nix
index 4cfe155..0ec1e03 100644
--- a/flake.nix
+++ b/flake.nix
@@ -17,7 +17,7 @@
let
args = {
flakeInputs = inputs;
- misc.metadata = nixpkgs.lib.importTOML ./metadata.toml;
+ metadata = nixpkgs.lib.importTOML ./metadata.toml;
};
in
{
@@ -29,8 +29,9 @@
{ _module.args = args; }
home-manager.darwinModules.home-manager
./hosts/muhammed/configuration.nix
- ./use-cases/default.nix
- ./services/default.nix
+ ./hosts/common.nix
+ ./home
+ ./lib
];
};
};
@@ -42,7 +43,10 @@
{ _module.args = args; }
home-manager.nixosModules.home-manager
./hosts/ahmed/configuration.nix
- ./use-cases/default.nix
+ ./hosts/common.nix
+ ./home
+ ./lib
+ ./modules/default.nix
./services/default.nix
];
};
diff --git a/home/default.nix b/home/default.nix
new file mode 100644
index 0000000..f0aa53b
--- /dev/null
+++ b/home/default.nix
@@ -0,0 +1,24 @@
+{ flakeInputs, metadata, ... }:
+
+{
+ # Use the flake input pkgs so Home Manager configuration can share overlays
+ # etc. with the rest of the configuration.
+ home-manager.useGlobalPkgs = true;
+
+ # Pass special arguments from flake.nix further down the chain. I really hate
+ # this split module system.
+ home-manager.extraSpecialArgs = { inherit flakeInputs metadata; };
+
+ # OKAY FUCK THIS SHIT. THERE IS ONE USER. IT IS ME. LINUS. I WILL ADD
+ # MULTIUSER SUPPORT IF IT EVER BECOMES A REQUIREMENT.
+ home-manager.users.linus = {
+ imports =
+ [
+ ./neovim
+ ./zsh
+ ./git
+ ];
+
+ xdg.enable = true;
+ };
+}
diff --git a/use-cases/git/default.nix b/home/git/default.nix
index 8df44db..8df44db 100644
--- a/use-cases/git/default.nix
+++ b/home/git/default.nix
diff --git a/use-cases/neovim/default.nix b/home/neovim/default.nix
index 883c170..883c170 100644
--- a/use-cases/neovim/default.nix
+++ b/home/neovim/default.nix
diff --git a/use-cases/neovim/filetype.nix b/home/neovim/filetype.nix
index 66d5e68..66d5e68 100644
--- a/use-cases/neovim/filetype.nix
+++ b/home/neovim/filetype.nix
diff --git a/use-cases/neovim/lsp.nix b/home/neovim/lsp.nix
index 588fb8b..588fb8b 100644
--- a/use-cases/neovim/lsp.nix
+++ b/home/neovim/lsp.nix
diff --git a/use-cases/zsh/default.nix b/home/zsh/default.nix
index 1b8ce16..1b8ce16 100644
--- a/use-cases/zsh/default.nix
+++ b/home/zsh/default.nix
diff --git a/use-cases/zsh/plugins.nix b/home/zsh/plugins.nix
index 3bebfce..3bebfce 100644
--- a/use-cases/zsh/plugins.nix
+++ b/home/zsh/plugins.nix
diff --git a/hosts/ahmed/configuration.nix b/hosts/ahmed/configuration.nix
index 95561bd..2dbf4e1 100644
--- a/hosts/ahmed/configuration.nix
+++ b/hosts/ahmed/configuration.nix
@@ -15,14 +15,7 @@
isNormalUser = true;
hashedPassword = "$y$j9T$kNJ5L50Si0sAhdrHyO19I1$YcwXZ46dI.ApLMgZSj7qImq9FrSL0CEUeoJUS8P1103";
extraGroups = [ "wheel" ];
- shell = pkgs.zsh;
};
- # Following are recommended when changing the default shell.
- # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue;
- programs.zsh.enable = true;
- environment.shells = [ pkgs.zsh ];
-
- my.use-cases = [ "development" "sysadmin" ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
@@ -57,8 +50,6 @@
networking.wireless.enable = true;
networking.wireless.networks."Rumpenettet_Guest".psk = "Rumpenerglad"; # NOCOMMIT
- nix.settings.experimental-features = [ "nix-command" ];
-
# Set up Minecraft server.
my.services.on-demand-minecraft = {
enable = true;
diff --git a/hosts/ahmed/ssh.nix b/hosts/ahmed/ssh.nix
index 9e34d99..f737437 100644
--- a/hosts/ahmed/ssh.nix
+++ b/hosts/ahmed/ssh.nix
@@ -1,6 +1,6 @@
# This file configures openSSH on this host.
-{ config, pkgs, lib, misc, ... }:
+{ lib, metadata, ... }:
{
# Who is allowed/expected to connect to this machine?
@@ -13,7 +13,7 @@
users.users = lib.genAttrs ["root" "linus"] (_: {
openssh.authorizedKeys.keys =
[
- misc.metadata.hosts.muhammed.sshPubKey
+ metadata.hosts.muhammed.sshPubKey
];
});
}
diff --git a/hosts/common.nix b/hosts/common.nix
new file mode 100644
index 0000000..87c6b27
--- /dev/null
+++ b/hosts/common.nix
@@ -0,0 +1,34 @@
+# Shared configuraion regardless of hosts.
+
+{ pkgs, ... }:
+
+{
+ # Enable de facto stable features.
+ nix.settings.experimental-features = [ "nix-command" "flakes" ];
+
+ # Set ZSH as the shell.
+ # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue
+ programs.zsh.enable = true;
+ environment.shells = [ pkgs.zsh ];
+ users.users.linus.shell = pkgs.zsh;
+
+ # Very basic system administration tools.
+ environment.systemPackages = with pkgs; [
+ tree
+ jc
+ jq
+ vim
+ comma
+ curl
+ ];
+
+ # Aliases that are burned into my muscle memory.
+ environment.shellAliases = {
+ "mv" = "mv -i";
+ "rm" = "rm -i";
+ "cp" = "cp -i";
+ "ls" = "ls -A --color=auto";
+ "grep" = "grep --color=auto";
+ "file" = "file --no-dereference";
+ };
+}
diff --git a/hosts/muhammed/configuration.nix b/hosts/muhammed/configuration.nix
index 0e41669..c824eb3 100644
--- a/hosts/muhammed/configuration.nix
+++ b/hosts/muhammed/configuration.nix
@@ -13,14 +13,7 @@
users.users.linus = {
description = "Personal user account";
home = "/Users/linus";
- shell = pkgs.zsh;
};
- # Following are recommended when changing the default shell.
- # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue;
- programs.zsh.enable = true; # TODO: move to common module
- environment.shells = [ pkgs.zsh ];
-
- my.use-cases = [ "gui" "development" ];
# Should match containing folder.
networking.hostName = "muhammed";
diff --git a/lib/default.nix b/lib/default.nix
new file mode 100644
index 0000000..d896ce2
--- /dev/null
+++ b/lib/default.nix
@@ -0,0 +1,8 @@
+{ ... }:
+
+{
+ imports =
+ [
+ ./secrets
+ ];
+}
diff --git a/lib/secrets.nix b/lib/secrets/default.nix
index 401d4a5..9592052 100644
--- a/lib/secrets.nix
+++ b/lib/secrets/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, config, lib, ... }:
+{ pkgs, config, lib, metadata, ... }:
with lib;
@@ -37,8 +37,6 @@ let
};
};
- metadata = lib.importTOML ./metadata.toml;
-
mkSecretOnDisk = name:
{ source, ... }:
pkgs.stdenv.mkDerivation {
diff --git a/modules/default.nix b/modules/default.nix
new file mode 100644
index 0000000..f6094ba
--- /dev/null
+++ b/modules/default.nix
@@ -0,0 +1,5 @@
+{ ... }:
+
+{
+ # Empty for now
+}
diff --git a/use-cases/cli-basics.nix b/use-cases/cli-basics.nix
deleted file mode 100644
index 17e29c7..0000000
--- a/use-cases/cli-basics.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-# This module defines Home Manager configuration options for the 'sysadmin' use
-# case. That is, basic system administration.
-
-{ pkgs, super, lib, ... }:
-
-{
- home.packages = with pkgs; [
- tree
- jc
- jq
- vim
- comma
- ];
-
- # basic qol shell aliases
- home.shellAliases = {
- "mv" = "mv -i";
- "rm" = "rm -i";
- "cp" = "cp -i";
- "ls" = "ls -A --color=auto";
- "grep" = "grep --color=auto";
- };
-}
diff --git a/use-cases/default.nix b/use-cases/default.nix
deleted file mode 100644
index e7a317a..0000000
--- a/use-cases/default.nix
+++ /dev/null
@@ -1,37 +0,0 @@
-{ config, pkgs, lib, flakeInputs, misc, ... }:
-
-let
- inherit (lib) mkOption types optional elem;
-
- hasUseCase = c: elem c config.my.use-cases;
- development = hasUseCase "development";
- sysadmin = hasUseCase "sysadmin";
- gui = hasUseCase "gui";
-in
-{
- options.my.use-cases = mkOption {
- description = "use-cases/modules to enable";
- type = types.listOf (types.enum ["gui" "development" "sysadmin"]);
- };
-
- config = {
- home-manager.users.linus = {
- imports = (optional development ./neovim)
- ++ (optional development ./git)
- ++ (optional development ./dev-cli-basics.nix)
- #++ (optional (development && gui && pkgs.stdenv.isDarwin) ./iterm2)
- #++ (optional (development && gui && pkgs.stdenv.isDarwin) ./st)
- ++ (optional (development || sysadmin) ./zsh)
- ++ (optional (development || sysadmin) ./cli-basics.nix);
-
- xdg.enable = true;
- };
-
- home-manager.extraSpecialArgs = {
- super = config;
- inherit flakeInputs misc;
- };
-
- home-manager.useGlobalPkgs = true;
- };
-}
diff --git a/use-cases/dev-cli-basics.nix b/use-cases/dev-cli-basics.nix
deleted file mode 100644
index fae49cd..0000000
--- a/use-cases/dev-cli-basics.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file specifies a home-manager config for basic development CLI
-# applications like interpreters and such.
-
-{ pkgs, ... }:
-
-{
- home.packages = with pkgs; [
- deno
- ];
-}